2002-03-27 Kevin L Mitchell <klmitch@mit.edu>
+ * ircd/m_burst.c (ms_burst): use MODEBUF_DEST_NOKEY to suppress
+ sending of the key to the channel
+
+ * ircd/channel.c (modebuf_flush_int): when processing keys, only
+ include the actual key in the mode sent to the channel if
+ MODEBUF_DEST_NOKEY is not set
+
+ * include/channel.h: needed more bits for MODEBUF_DEST_*,
+ especially when adding MODEBUF_DEST_NOKEY to force keys in the
+ BURST to be reported as "*" to the channel
+
* ircd/m_oper.c (m_oper): clear the new oper's sendq so it gets
inherited from the class associated with the O-line
/* A mode w/args */
};
-#define MODEBUF_DEST_CHANNEL 0x0001 /* Mode is flushed to channel */
-#define MODEBUF_DEST_SERVER 0x0002 /* Mode is flushed to server */
+#define MODEBUF_DEST_CHANNEL 0x00001 /* Mode is flushed to channel */
+#define MODEBUF_DEST_SERVER 0x00002 /* Mode is flushed to server */
-#define MODEBUF_DEST_OPMODE 0x0100 /* Send server mode as OPMODE */
-#define MODEBUF_DEST_DEOP 0x0200 /* Deop the offender */
-#define MODEBUF_DEST_BOUNCE 0x0400 /* Bounce the modes */
-#define MODEBUF_DEST_LOG 0x0800 /* Log the mode changes to OPATH */
+#define MODEBUF_DEST_OPMODE 0x00100 /* Send server mode as OPMODE */
+#define MODEBUF_DEST_DEOP 0x00200 /* Deop the offender */
+#define MODEBUF_DEST_BOUNCE 0x00400 /* Bounce the modes */
+#define MODEBUF_DEST_LOG 0x00800 /* Log the mode changes to OPATH */
-#define MODEBUF_DEST_HACK2 0x2000 /* Send a HACK(2) notice, reverse */
-#define MODEBUF_DEST_HACK3 0x4000 /* Send a HACK(3) notice, TS == 0 */
-#define MODEBUF_DEST_HACK4 0x8000 /* Send a HACK(4) notice, TS == 0 */
+#define MODEBUF_DEST_HACK2 0x02000 /* Send a HACK(2) notice, reverse */
+#define MODEBUF_DEST_HACK3 0x04000 /* Send a HACK(3) notice, TS == 0 */
+#define MODEBUF_DEST_HACK4 0x08000 /* Send a HACK(4) notice, TS == 0 */
+
+#define MODEBUF_DEST_NOKEY 0x10000 /* Don't send the real key */
#define MB_TYPE(mb, i) ((mb)->mb_modeargs[(i)].mbm_type)
#define MB_UINT(mb, i) ((mb)->mb_modeargs[(i)].mbm_arg.mbma_uint)
bufptr[(*bufptr_i)++] = MB_TYPE(mbuf, i) & MODE_CHANOP ? 'o' : 'v';
totalbuflen -= IRCD_MAX(5, tmp) + 1;
}
- } else if (MB_TYPE(mbuf, i) & (MODE_KEY | MODE_BAN | MODE_APASS | MODE_UPASS)) {
+ } else if (MB_TYPE(mbuf, i) & (MODE_BAN | MODE_APASS | MODE_UPASS)) {
tmp = strlen(MB_STRING(mbuf, i));
if ((totalbuflen - tmp) <= 0) /* don't overflow buffer */
MB_TYPE(mbuf, i) |= MODE_SAVE; /* save for later */
else {
char mode_char;
- switch(MB_TYPE(mbuf, i) & (MODE_KEY | MODE_BAN | MODE_APASS | MODE_UPASS))
+ switch(MB_TYPE(mbuf, i) & (MODE_BAN | MODE_APASS | MODE_UPASS))
{
case MODE_APASS:
mode_char = 'A';
case MODE_UPASS:
mode_char = 'u';
break;
- case MODE_KEY:
- mode_char = 'k';
- break;
default:
mode_char = 'b';
break;
bufptr[(*bufptr_i)++] = mode_char;
totalbuflen -= tmp + 1;
}
+ } else if (MB_TYPE(mbuf, i) & MODE_KEY) {
+ tmp = (mbuf->mb_dest & MODEBUF_DEST_NOKEY ? 1 :
+ strlen(MB_STRING(mbuf, i)));
+
+ if ((totalbuflen - tmp) <= 0) /* don't overflow buffer */
+ MB_TYPE(mbuf, i) |= MODE_SAVE; /* save for later */
+ else {
+ bufptr[(*bufptr_i)++] = 'k';
+ totalbuflen -= tmp + 1;
+ }
} else if (MB_TYPE(mbuf, i) & MODE_LIMIT) {
/* if it's a limit, we also format the number */
ircd_snprintf(0, limitbuf, sizeof(limitbuf), "%u", MB_UINT(mbuf, i));
if (MB_TYPE(mbuf, i) & (MODE_CHANOP | MODE_VOICE))
build_string(strptr, strptr_i, cli_name(MB_CLIENT(mbuf, i)), 0, ' ');
- /* deal with strings... */
- else if (MB_TYPE(mbuf, i) & (MODE_KEY | MODE_BAN))
+ /* deal with bans... */
+ else if (MB_TYPE(mbuf, i) & MODE_BAN)
build_string(strptr, strptr_i, MB_STRING(mbuf, i), 0, ' ');
+ /* deal with keys... */
+ else if (MB_TYPE(mbuf, i) & MODE_KEY)
+ build_string(strptr, strptr_i, mbuf->mb_dest & MODEBUF_DEST_NOKEY ?
+ "*" : MB_STRING(mbuf, i), 0, ' ');
+
/* deal with invisible passwords */
else if (MB_TYPE(mbuf, i) & (MODE_APASS | MODE_UPASS))
build_string(strptr, strptr_i, "*", 0, ' ');
if (!chptr->creationtime || chptr->creationtime > timestamp) {
chptr->creationtime = timestamp;
- modebuf_init(mbuf = &modebuf, &me, cptr, chptr, MODEBUF_DEST_CHANNEL);
+ 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_ADD | MODE_DEL | MODE_PRIVATE | MODE_SECRET |
MODE_MODERATED | MODE_TOPICLIMIT | MODE_INVITEONLY |
for (lp = chptr->banlist; lp; lp = lp->next)
lp->flags |= CHFL_BURST_BAN_WIPEOUT;
} else if (chptr->creationtime == timestamp) {
- modebuf_init(mbuf = &modebuf, &me, cptr, chptr, MODEBUF_DEST_CHANNEL);
+ modebuf_init(mbuf = &modebuf, &me, cptr, chptr,
+ MODEBUF_DEST_CHANNEL | MODEBUF_DEST_NOKEY);
parse_flags |= MODE_PARSE_SET; /* set new modes */
}