Add channel mode +u to hide banlists

Banlists are silently hidden from all non-halfops or up. Bans still may
be seen as normally. This mode is entirely opt-in.
This commit is contained in:
Sam Dodrill 2014-05-28 19:36:14 -07:00
parent 9a90d0d80e
commit 050ea2b809
4 changed files with 15 additions and 7 deletions

View File

@ -26,6 +26,8 @@ NO PARAMETERS:
weakens +i control. weakens +i control.
+z - Op moderated. Messages blocked by +m, +b and +q are instead +z - Op moderated. Messages blocked by +m, +b and +q are instead
sent to ops. sent to ops.
+u - Hidden ban/quiet list. Ban/quiet lists may only be seen
by halfops or higher.
* +L - Large ban list. Increase maximum number of +beIq entries. * +L - Large ban list. Increase maximum number of +beIq entries.
* +P - Permanent. Channel does not disappear when empty. * +P - Permanent. Channel does not disappear when empty.
+F - Free target. Anyone may set forwards to this (otherwise +F - Free target. Anyone may set forwards to this (otherwise

View File

@ -24,6 +24,8 @@ NO PARAMETERS:
change nick. change nick.
+g - Free invite. Everyone may invite users. Significantly +g - Free invite. Everyone may invite users. Significantly
weakens +i control. weakens +i control.
+u - Hidden ban/quiet lists. Ban/quiet lists are hidden from all
channel members that are not a halfop or higher.
+z - Op moderated. Messages blocked by +m, +b and +q are instead +z - Op moderated. Messages blocked by +m, +b and +q are instead
sent to ops. sent to ops.
* +L - Large ban list. Increase maximum number of +beIq entries. * +L - Large ban list. Increase maximum number of +beIq entries.

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,13 +907,16 @@ chm_ban(struct Client *source_p, struct Channel *chptr,
} }
} }
RB_DLINK_FOREACH(ptr, list->head) if(!(chptr->mode.mode & MODE_HIDEBANS) || alevel & ONLY_CHANOPS) {
{ RB_DLINK_FOREACH(ptr, list->head)
banptr = ptr->data; {
sendto_one(source_p, form_str(rpl_list), banptr = ptr->data;
me.name, source_p->name, chptr->chname, sendto_one(source_p, form_str(rpl_list),
banptr->banstr, banptr->who, banptr->when); me.name, source_p->name, chptr->chname,
banptr->banstr, banptr->who, banptr->when);
}
} }
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 +2007,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 */