From: Michael Poole Date: Mon, 31 Oct 2005 23:35:41 +0000 (+0000) Subject: Do not send MODE_WASDELJOINS changes to remote servers. X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=commitdiff_plain;h=dc34e930cafb74cffeebe249526f68913312a4c0 Do not send MODE_WASDELJOINS changes to remote servers. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/branches/u2_10_12_branch@1538 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- diff --git a/ChangeLog b/ChangeLog index fc991ab..ec0602f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-10-31 Michael Poole + (Based on a patch by Romain Bignon ) + + * ircd/channel.c: Some modes (currently only WASDELJOINS) should + not be propagated to remote servers. + 2005-10-30 Michael Poole * ircd/channel.c (mode_parse_apass): Move all send_reply() errors diff --git a/ircd/channel.c b/ircd/channel.c index 5502bb3..8b521c0 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -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? */