Author: Kev <klmitch@mit.edu>
[ircu2.10.12-pk.git] / ircd / channel.c
index 8ad335612209d469b065c72143cd5a1b44ffc80a..ea46920a1910d3bb3e41f4c616e39970fb846537 100644 (file)
@@ -47,7 +47,6 @@
 #include "s_misc.h"
 #include "s_user.h"
 #include "send.h"
-#include "sprintf_irc.h"
 #include "struct.h"
 #include "support.h"
 #include "sys.h"
@@ -169,7 +168,7 @@ static char *make_nick_user_host(const char *nick, const char *name,
                                  const char *host)
 {
   static char namebuf[NICKLEN + USERLEN + HOSTLEN + 3];
-  sprintf_irc(namebuf, "%s!%s@%s", nick, name, host);
+  ircd_snprintf(0, namebuf, sizeof(namebuf), "%s!%s@%s", nick, name, host);
   return namebuf;
 }
 
@@ -180,7 +179,8 @@ static char *make_nick_user_host(const char *nick, const char *name,
 static char *make_nick_user_ip(char *nick, char *name, struct in_addr ip)
 {
   static char ipbuf[NICKLEN + USERLEN + 16 + 3];
-  sprintf_irc(ipbuf, "%s!%s@%s", nick, name, ircd_ntoa((const char*) &ip));
+  ircd_snprintf(0, ipbuf, sizeof(ipbuf), "%s!%s@%s", nick, name,
+               ircd_ntoa((const char*) &ip));
   return ipbuf;
 }
 
@@ -313,18 +313,10 @@ int add_banid(struct Client *cptr, struct Channel *chptr, char *banid,
           len -= strlen(tmp->value.ban.banstr);
         }
         *banp = tmp->next;
-#if 0
-        /* Silently remove overlapping bans */
-        MyFree(tmp->value.ban.banstr);
-        MyFree(tmp->value.ban.who);
-        free_link(tmp);
-        tmp = 0;
-#else
         /* These will be sent to the user later as -b */
         tmp->next = removed_bans_list;
         removed_bans_list = tmp;
         removed_bans = 1;
-#endif
       }
       else if (!(tmp->flags & CHFL_BURST_BAN_WIPEOUT))
       {
@@ -763,7 +755,7 @@ void channel_modes(struct Client *cptr, char *mbuf, char *pbuf,
     *mbuf++ = 'n';
   if (chptr->mode.limit) {
     *mbuf++ = 'l';
-    sprintf_irc(pbuf, "%d", chptr->mode.limit);
+    ircd_snprintf(0, pbuf, sizeof(pbuf), "%d", chptr->mode.limit);
   }
 
   if (*chptr->mode.key) {
@@ -1431,7 +1423,7 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all)
 
   /* Ok, if we were given the OPMODE flag, hide the source if its a user */
   if (mbuf->mb_dest & MODEBUF_DEST_OPMODE && !IsServer(mbuf->mb_source))
-    app_source = (cli_user(mbuf->mb_source))->server;
+    app_source = &me;
   else
     app_source = mbuf->mb_source;
 
@@ -1480,7 +1472,7 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all)
       }
     } else if (MB_TYPE(mbuf, i) & MODE_LIMIT) {
       /* if it's a limit, we also format the number */
-      sprintf_irc(limitbuf, "%d", MB_UINT(mbuf, i));
+      ircd_snprintf(0, limitbuf, sizeof(limitbuf), "%d", MB_UINT(mbuf, i));
 
       tmp = strlen(limitbuf);
 
@@ -1539,14 +1531,24 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all)
     /* send the messages off to their destination */
     if (mbuf->mb_dest & MODEBUF_DEST_HACK2) {
       sendto_opmask_butone(0, SNO_HACK2, "HACK(2): %s MODE %s %s%s%s%s%s%s "
-                          "[%Tu]", cli_name(app_source),
+                          "[%Tu]",
+#ifdef HEAD_IN_SAND_SNOTICES
+                          cli_name(mbuf->mb_source),
+#else
+                          cli_name(app_source),
+#endif
                           mbuf->mb_channel->chname,
                           rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "",
                           addbuf, remstr, addstr,
                           mbuf->mb_channel->creationtime);
       sendcmdto_serv_butone(&me, CMD_DESYNCH, mbuf->mb_connect,
                            ":HACK: %s MODE %s %s%s%s%s%s%s [%Tu]",
-                           cli_name(app_source), mbuf->mb_channel->chname,
+#ifdef HEAD_IN_SAND_SNOTICES
+                           cli_name(mbuf->mb_source),
+#else
+                           cli_name(app_source),
+#endif
+                           mbuf->mb_channel->chname,
                            rembuf_i ? "-" : "", rembuf,
                            addbuf_i ? "+" : "", addbuf, remstr, addstr,
                            mbuf->mb_channel->creationtime);
@@ -1554,14 +1556,24 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all)
 
     if (mbuf->mb_dest & MODEBUF_DEST_HACK3)
       sendto_opmask_butone(0, SNO_HACK3, "BOUNCE or HACK(3): %s MODE %s "
-                          "%s%s%s%s%s%s [%Tu]", cli_name(app_source),
+                          "%s%s%s%s%s%s [%Tu]",
+#ifdef HEAD_IN_SAND_SNOTICES
+                          cli_name(mbuf->mb_source),
+#else
+                          cli_name(app_source),
+#endif
                           mbuf->mb_channel->chname, rembuf_i ? "-" : "",
                           rembuf, addbuf_i ? "+" : "", addbuf, remstr, addstr,
                           mbuf->mb_channel->creationtime);
 
     if (mbuf->mb_dest & MODEBUF_DEST_HACK4)
       sendto_opmask_butone(0, SNO_HACK4, "HACK(4): %s MODE %s %s%s%s%s%s%s "
-                          "[%Tu]", cli_name(app_source),
+                          "[%Tu]",
+#ifdef HEAD_IN_SAND_SNOTICES
+                          cli_name(mbuf->mb_source),
+#else
+                          cli_name(app_source),
+#endif
                           mbuf->mb_channel->chname,
                           rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "",
                           addbuf, remstr, addstr,