Do not try twice to process silences that were both added and deleted.
authorMichael Poole <mdpoole@troilus.org>
Tue, 27 Mar 2007 02:54:44 +0000 (02:54 +0000)
committerMichael Poole <mdpoole@troilus.org>
Tue, 27 Mar 2007 02:54:44 +0000 (02:54 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/branches/u2_10_12_branch@1790 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/m_silence.c

index 42aae94acac349e06fc7f2c2455999967e1af42a..e6537290394bfa1ad4affa64181b5ea278861e23 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-03-26  Michael Poole <mdpoole@troilus.org>
+
+       * ircd/m_silence.c (forward_silences): Do not try twice to process
+       silences that were both added and deleted.
+
 2007-03-26  Michael Poole <mdpoole@troilus.org>
 
        * ircd/ircd_parser.y (portblock): Restore old behavior for Port
index 4530d6bcb7d84c96e983c7768fe0f29fb745b71b..818c6ff3b6be085b0219c8374f2a2d9089c2ef25 100644 (file)
@@ -64,6 +64,7 @@ apply_silence(struct Client *sptr, char *mask)
 {
   struct Ban *sile;
   int flags;
+  int res;
   char orig_mask[NICKLEN+USERLEN+HOSTLEN+3];
 
   assert(mask && mask[0]);
@@ -100,7 +101,8 @@ apply_silence(struct Client *sptr, char *mask)
   }
 
   /* Apply it to the silence list. */
-  return apply_ban(&cli_user(sptr)->silence, sile, 1) ? NULL : sile;
+  res = apply_ban(&cli_user(sptr)->silence, sile, 1);
+  return res ? NULL : sile;
 }
 
 /** Apply and send silence updates for a user.
@@ -123,7 +125,6 @@ forward_silences(struct Client *sptr, char *silences, struct Client *dest)
       accepted[ac_count++] = sile;
   }
 
-
   if (MyUser(sptr)) {
     size_t siles, maxsiles, totlength, maxlength, jj;
 
@@ -258,8 +259,9 @@ forward_silences(struct Client *sptr, char *silences, struct Client *dest)
 
   /* Free any silence-deleting updates. */
   for (ii = 0; ii < ac_count; ++ii) {
-    if (accepted[ii]->flags & BAN_DEL)
+    if ((accepted[ii]->flags & (BAN_ADD | BAN_DEL)) == BAN_DEL) {
       free_ban(accepted[ii]);
+    }
   }
 }