Author: Kev <klmitch@mit.edu>
[ircu2.10.12-pk.git] / ircd / m_burst.c
index 9e44eca07c8b03d716b0f4a61f01b2dffa3262d8..6618ebc8857a95656336fe201e01432755ba827e 100644 (file)
@@ -87,6 +87,7 @@
 #include "ircd.h"
 #include "ircd_alloc.h"
 #include "ircd_features.h"
+#include "ircd_log.h"
 #include "ircd_reply.h"
 #include "ircd_string.h"
 #include "list.h"
 #include "struct.h"
 #include "ircd_snprintf.h"
 
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
@@ -205,7 +206,7 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
   struct Channel *chptr;
   time_t timestamp;
   struct Membership *member, *nmember;
-  struct SLink *lp, **lp_p;
+  struct Ban *lp, **lp_p;
   unsigned int parse_flags = (MODE_PARSE_FORCE | MODE_PARSE_BURST);
   int param, nickpos = 0, banpos = 0;
   char modestr[BUFSIZE], nickstr[BUFSIZE], banstr[BUFSIZE];
@@ -274,13 +275,13 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
     modebuf_init(mbuf = &modebuf, &me, cptr, chptr,
                 MODEBUF_DEST_CHANNEL | MODEBUF_DEST_NOKEY);
     modebuf_mode(mbuf, MODE_DEL | chptr->mode.mode); /* wipeout modes */
-    chptr->mode.mode &= MODE_LISTED | MODE_BURSTADDED | MODE_WASDELJOINS;
+    chptr->mode.mode &= MODE_BURSTADDED | MODE_WASDELJOINS;
 
     parse_flags |= (MODE_PARSE_SET | MODE_PARSE_WIPEOUT); /* wipeout keys */
 
     /* mark bans for wipeout */
     for (lp = chptr->banlist; lp; lp = lp->next)
-      lp->flags |= CHFL_BURST_BAN_WIPEOUT;
+      lp->flags |= BAN_BURST_WIPEOUT;
 
     /* clear topic set by netrider (if set) */
     if (*chptr->topic) {
@@ -308,7 +309,7 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
     case '%': /* parameter contains bans */
       if (parse_flags & MODE_PARSE_SET) {
        char *banlist = parv[param] + 1, *p = 0, *ban, *ptr;
-       struct SLink *newban;
+       struct Ban *newban;
 
        for (ban = ircd_strtok(&p, banlist, " "); ban;
             ban = ircd_strtok(&p, 0, " ")) {
@@ -323,16 +324,16 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
             * shown below *sigh*
             */
          for (lp = chptr->banlist; lp; lp = lp->next) {
-           if (!ircd_strcmp(lp->value.ban.banstr, ban)) {
+           if (!ircd_strcmp(lp->banstr, ban)) {
              ban = 0; /* don't add ban */
-             lp->flags &= ~CHFL_BURST_BAN_WIPEOUT; /* not wiping out */
+             lp->flags &= ~BAN_BURST_WIPEOUT; /* not wiping out */
              break; /* new ban already existed; don't even repropagate */
-           } else if (!(lp->flags & CHFL_BURST_BAN_WIPEOUT) &&
-                      !mmatch(lp->value.ban.banstr, ban)) {
+           } else if (!(lp->flags & BAN_BURST_WIPEOUT) &&
+                      !mmatch(lp->banstr, ban)) {
              ban = 0; /* don't add ban unless wiping out bans */
              break; /* new ban is encompassed by an existing one; drop */
-           } else if (!mmatch(ban, lp->value.ban.banstr))
-             lp->flags |= CHFL_BAN_OVERLAPPED; /* remove overlapping ban */
+           } else if (!mmatch(ban, lp->banstr))
+             lp->flags |= BAN_OVERLAPPED; /* remove overlapping ban */
 
            if (!lp->next)
              break;
@@ -349,17 +350,15 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
            for (ptr = ban; *ptr; ptr++) /* add ban to buffer */
              banstr[banpos++] = *ptr;
 
-           newban = make_link(); /* create new ban */
+           newban = make_ban(ban); /* create new ban */
 
-           DupString(newban->value.ban.banstr, ban);
-
-            DupString(newban->value.ban.who, 
+            DupString(newban->who, 
                       cli_name(feature_bool(FEAT_HIS_BANWHO) ? &me : sptr));
-           newban->value.ban.when = TStime();
+           newban->when = TStime();
 
-           newban->flags = CHFL_BAN | CHFL_BURST_BAN; /* set flags */
+           newban->flags = BAN_BURSTED; /* set flags */
            if ((ptr = strrchr(ban, '@')) && check_if_ipmask(ptr + 1))
-             newban->flags |= CHFL_BAN_IPMASK;
+             newban->flags |= BAN_IPMASK;
 
            newban->next = 0;
            if (lp)
@@ -526,19 +525,18 @@ int ms_burst(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
       lp = *lp_p;
 
       /* remove ban from channel */
-      if (lp->flags & (CHFL_BAN_OVERLAPPED | CHFL_BURST_BAN_WIPEOUT)) {
+      if (lp->flags & (BAN_OVERLAPPED | BAN_BURST_WIPEOUT)) {
        modebuf_mode_string(mbuf, MODE_DEL | MODE_BAN,
-                           lp->value.ban.banstr, 1); /* let it free banstr */
-
+                           lp->banstr, 1); /* let it free banstr */
+        lp->banstr = NULL; /* do not free this string */
        *lp_p = lp->next; /* clip out of list */
-       MyFree(lp->value.ban.who); /* free who */
-       free_link(lp); /* free ban */
+        free_ban(lp);
        continue;
-      } else if (lp->flags & CHFL_BURST_BAN) /* add ban to channel */
+      } else if (lp->flags & BAN_BURSTED) /* add ban to channel */
        modebuf_mode_string(mbuf, MODE_ADD | MODE_BAN,
-                           lp->value.ban.banstr, 0); /* don't free banstr */
+                           lp->banstr, 0); /* don't free banstr */
 
-      lp->flags &= (CHFL_BAN | CHFL_BAN_IPMASK); /* reset the flag */
+      lp->flags &= BAN_IPMASK; /* reset the flag */
       lp_p = &(*lp_p)->next;
     }
   }