From: JD Horelick Date: Sat, 11 Sep 2010 17:23:35 +0000 (-0400) Subject: "Import" changeset 1346:c57955c5225e from charybdis by hand. X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/commitdiff_plain/e09ea16973ad7aef304558adef538e9a7fa160e4 "Import" changeset 1346:c57955c5225e from charybdis by hand. --- diff --git a/include/channel.h b/include/channel.h index 64bd1b1..d6514d2 100644 --- a/include/channel.h +++ b/include/channel.h @@ -268,7 +268,9 @@ extern void channel_member_names(struct Channel *chptr, struct Client *, extern void del_invite(struct Channel *chptr, struct Client *who); -const char *channel_modes(struct Channel *chptr, struct Client *who); +const char *channel_modes_real(struct Channel *chptr, struct Mode *mode, struct Client *who); +#define channel_modes(chptr, who) channel_modes_real(chptr, &(chptr)->mode, who) +#define channel_mlock(chptr, who) channel_modes_real(chptr, &(chptr)->mode_lock, who) extern int has_common_channel(struct Client *client1, struct Client *client2); diff --git a/src/channel.c b/src/channel.c index af30d4e..3749e7a 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1286,9 +1286,10 @@ has_common_channel(struct Client *client1, struct Client *client2) return 0; } -/* channel_modes() +/* channel_modes_real() * * inputs - pointer to channel + * - pointer to channel mode struct * - pointer to client * output - string with simple modes * side effects - result from previous calls overwritten @@ -1296,7 +1297,7 @@ has_common_channel(struct Client *client1, struct Client *client2) * Stolen from ShadowIRCd 4 --nenolod */ const char * -channel_modes(struct Channel *chptr, struct Client *client_p) +channel_modes_real(struct Channel *chptr, struct Mode *mode, struct Client *client_p) { int i; char buf1[BUFSIZE]; @@ -1312,41 +1313,41 @@ channel_modes(struct Channel *chptr, struct Client *client_p) { if(chmode_table[i].set_func == chm_hidden && !IsOper(client_p) && IsClient(client_p)) continue; - if(chptr->mode.mode & chmode_flags[i]) + if(mode->mode & chmode_flags[i]) *mbuf++ = i; } - if(chptr->mode.limit) + if(mode->limit) { *mbuf++ = 'l'; if(!IsClient(client_p) || IsMember(client_p, chptr)) - pbuf += rb_sprintf(pbuf, " %d", chptr->mode.limit); + pbuf += rb_sprintf(pbuf, " %d", mode->limit); } - if(*chptr->mode.key) + if(mode->key) { *mbuf++ = 'k'; if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr)) - pbuf += rb_sprintf(pbuf, " %s", chptr->mode.key); + pbuf += rb_sprintf(pbuf, " %s", mode->key); } - if(chptr->mode.join_num) + if(mode->join_num) { *mbuf++ = 'j'; if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr)) - pbuf += rb_sprintf(pbuf, " %d:%d", chptr->mode.join_num, - chptr->mode.join_time); + pbuf += rb_sprintf(pbuf, " %d:%d", mode->join_num, + mode->join_time); } - if(*chptr->mode.forward && (ModuleModes.MODE_FORWARD || !IsClient(client_p))) + if(mode->forward && (ModuleModes.MODE_FORWARD || !IsClient(client_p))) { *mbuf++ = 'f'; if(pbuf > buf2 || !IsClient(client_p) || IsMember(client_p, chptr)) - pbuf += rb_sprintf(pbuf, " %s", chptr->mode.forward); + pbuf += rb_sprintf(pbuf, " %s", mode->forward); } *mbuf = '\0';