Do not send MODE_WASDELJOINS changes to remote servers.
authorMichael Poole <mdpoole@troilus.org>
Mon, 31 Oct 2005 23:35:41 +0000 (23:35 +0000)
committerMichael Poole <mdpoole@troilus.org>
Mon, 31 Oct 2005 23:35:41 +0000 (23:35 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/branches/u2_10_12_branch@1538 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/channel.c

index fc991ab28650bb2c27bfb8956d1a6af72f6402c9..ec0602f474e8896b065da001ec67ae2cd832edbb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-10-31  Michael Poole <mdpoole@troilus.org>
+       (Based on a patch by Romain Bignon <progs@ir3.org>)
+
+       * ircd/channel.c: Some modes (currently only WASDELJOINS) should
+       not be propagated to remote servers.
+
 2005-10-30  Michael Poole <mdpoole@troilus.org>
 
        * ircd/channel.c (mode_parse_apass): Move all send_reply() errors
index 5502bb305360de0624ffa81587e27469761a903c..8b521c090b85868d2320cb1ec767bd11d54e49b6 100644 (file)
@@ -1518,7 +1518,6 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all)
     MODE_NOPRIVMSGS,   'n',
     MODE_REGONLY,      'r',
     MODE_DELJOINS,      'D',
-    MODE_WASDELJOINS,   'd',
 /*  MODE_KEY,          'k', */
 /*  MODE_BAN,          'b', */
     MODE_LIMIT,                'l',
@@ -1526,15 +1525,19 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all)
 /*  MODE_UPASS,                'U', */
     0x0, 0x0
   };
+  static int local_flags[] = {
+    MODE_WASDELJOINS,   'd',
+    0x0, 0x0
+  };
   int i;
   int *flag_p;
 
   struct Client *app_source; /* where the MODE appears to come from */
 
-  char addbuf[20]; /* accumulates +psmtin, etc. */
-  int addbuf_i = 0;
-  char rembuf[20]; /* accumulates -psmtin, etc. */
-  int rembuf_i = 0;
+  char addbuf[20], addbuf_local[20]; /* accumulates +psmtin, etc. */
+  int addbuf_i = 0, addbuf_local_i = 0;
+  char rembuf[20], rembuf_local[20]; /* accumulates -psmtin, etc. */
+  int rembuf_i = 0, rembuf_local_i = 0;
   char *bufptr; /* we make use of indirection to simplify the code */
   int *bufptr_i;
 
@@ -1580,6 +1583,14 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all)
       rembuf[rembuf_i++] = flag_p[1];
   }
 
+  /* Some flags may be for local display only. */
+  for (flag_p = local_flags; flag_p[0]; flag_p += 2) {
+    if (*flag_p & mbuf->mb_add)
+      addbuf_local[addbuf_local_i++] = flag_p[1];
+    else if (*flag_p & mbuf->mb_rem)
+      rembuf_local[rembuf_local_i++] = flag_p[1];
+  }
+
   /* Now go through the modes with arguments... */
   for (i = 0; i < mbuf->mb_count; i++) {
     if (MB_TYPE(mbuf, i) & MODE_ADD) { /* adding or removing? */
@@ -1649,6 +1660,8 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all)
   /* terminate the mode strings */
   addbuf[addbuf_i] = '\0';
   rembuf[rembuf_i] = '\0';
+  addbuf_local[addbuf_local_i] = '\0';
+  rembuf_local[rembuf_local_i] = '\0';
 
   /* If we're building a user visible MODE or HACK... */
   if (mbuf->mb_dest & (MODEBUF_DEST_CHANNEL | MODEBUF_DEST_HACK2 |
@@ -1736,9 +1749,12 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all)
 
     if (mbuf->mb_dest & MODEBUF_DEST_CHANNEL)
       sendcmdto_channel_butserv_butone(app_source, CMD_MODE, mbuf->mb_channel, NULL, 0,
-                               "%H %s%s%s%s%s%s", mbuf->mb_channel,
-                               rembuf_i ? "-" : "", rembuf,
-                               addbuf_i ? "+" : "", addbuf, remstr, addstr);
+                                       "%H %s%s%s%s%s%s%s%s", mbuf->mb_channel,
+                                       rembuf_i || rembuf_local_i ? "-" : "",
+                                       rembuf, rembuf_local,
+                                       addbuf_i || addbuf_local_i ? "+" : "",
+                                       addbuf, addbuf_local,
+                                       remstr, addstr);
   }
 
   /* Now are we supposed to propagate to other servers? */