Add channel mode +u to hide bans/quiets from non chanops

This commit is contained in:
Sam Dodrill 2014-05-28 18:54:39 -07:00
parent ccfdbe7bb9
commit 624e2c5aa5
2 changed files with 9 additions and 1 deletions

View File

@ -191,6 +191,7 @@ typedef int (*ExtbanFunc)(const char *data, struct Client *client_p,
#define MODE_NOREJOIN 0x200000 /* Block rejoin immediately after kick */ #define MODE_NOREJOIN 0x200000 /* Block rejoin immediately after kick */
#define MODE_NOREPEAT 0x400000 /* Block repeat messages */ #define MODE_NOREPEAT 0x400000 /* Block repeat messages */
#define MODE_NOOPERKICK 0x800000 /* disallow kicking opers */ #define MODE_NOOPERKICK 0x800000 /* disallow kicking opers */
#define MODE_HIDEBANS 0x1000000 /* disallow non-chanops from seeing ban/quiet lists */
#define CHFL_BAN 0x10000000 /* ban channel flag */ #define CHFL_BAN 0x10000000 /* ban channel flag */
#define CHFL_EXCEPTION 0x20000000 /* exception to ban channel flag */ #define CHFL_EXCEPTION 0x20000000 /* exception to ban channel flag */

View File

@ -907,6 +907,12 @@ chm_ban(struct Client *source_p, struct Channel *chptr,
} }
} }
if(chptr->mode.mode & MODE_HIDEBANS) {
if(alevel != CHFL_CHANOP && alevel != CHFL_ADMIN && alevel != CHFL_HALFOP && alevel != CHFL_OWNER) {
goto skiplistdone;
}
}
RB_DLINK_FOREACH(ptr, list->head) RB_DLINK_FOREACH(ptr, list->head)
{ {
banptr = ptr->data; banptr = ptr->data;
@ -914,6 +920,7 @@ chm_ban(struct Client *source_p, struct Channel *chptr,
me.name, source_p->name, chptr->chname, me.name, source_p->name, chptr->chname,
banptr->banstr, banptr->who, banptr->when); banptr->banstr, banptr->who, banptr->when);
} }
skiplistdone:
sendto_one(source_p, form_str(rpl_endlist), me.name, source_p->name, chptr->chname); sendto_one(source_p, form_str(rpl_endlist), me.name, source_p->name, chptr->chname);
return; return;
} }
@ -2004,7 +2011,7 @@ struct ChannelMode chmode_table[256] =
{chm_simple, MODE_REGONLY }, /* r */ {chm_simple, MODE_REGONLY }, /* r */
{chm_simple, MODE_SECRET }, /* s */ {chm_simple, MODE_SECRET }, /* s */
{chm_simple, MODE_TOPICLIMIT }, /* t */ {chm_simple, MODE_TOPICLIMIT }, /* t */
{chm_nosuch, 0 }, /* u */ {chm_simple, MODE_HIDEBANS }, /* u */
{chm_voice, 0 }, /* v */ {chm_voice, 0 }, /* v */
{chm_nosuch, 0 }, /* w */ {chm_nosuch, 0 }, /* w */
{chm_nosuch, 0 }, /* x */ {chm_nosuch, 0 }, /* x */