diff --git a/Changes b/Changes index 5d3973af9..736b6fa67 100644 --- a/Changes +++ b/Changes @@ -2056,3 +2056,5 @@ name="" /> - Some minor tweaks - Fix the detection for curl-without-c-ares a little (#0003940). +- Add an extban of the schema +b ~j:*!*@* which _only_ prevents a user + from joining a channel. diff --git a/help.conf b/help.conf index f787678aa..9b693bf7d 100644 --- a/help.conf +++ b/help.conf @@ -217,6 +217,10 @@ help ExtBans { " | | Example: "; " | | +bb ~n:*!*@*.aol.com ~n:nick*!*@* "; "-----------------------------------------------------------------------------------"; + " | | If a user matches this, he may not join the channel. "; + " ~j | join | He may perform all other activities if he is already on "; + " | | the channel, such as speaking and changing his nick. "; + "-----------------------------------------------------------------------------------"; " | | If the user is in this channel then (s)he is unable to "; " | [prefix] | join. A prefix can also be specified (+/%/@/&/~) which "; " ~c | channel | means that it will only match if the user has that "; diff --git a/include/h.h b/include/h.h index 633b96759..2abc994c8 100644 --- a/include/h.h +++ b/include/h.h @@ -193,7 +193,7 @@ extern int is_chanowner(aClient *, aChannel *); #ifndef DISABLE_EXTBAN_STACKING extern int ban_check_mask(aClient *, aChannel *, char *, int, int); extern int extban_is_ok_nuh_extban(aClient *, aChannel *, char *, int, int, int); -extern char* extban_conv_param_nuh_extban(char *); +extern char* extban_conv_param_nuh_or_extban(char *); #endif extern Ban *is_banned(aClient *, aChannel *, int); extern Ban *is_banned_with_nick(aClient *, aChannel *, int, char *); diff --git a/src/extbans.c b/src/extbans.c index 7b29dc9c9..ed7f7af6c 100644 --- a/src/extbans.c +++ b/src/extbans.c @@ -275,6 +275,23 @@ char *ban = banin + 3; #endif } +/* a ban that affects JOINs only */ +int extban_modej_is_banned(aClient *sptr, aChannel *chptr, char *banin, int type) +{ + char *sub_ban; + + if (type != BANCHK_JOIN) + return 0; + + sub_ban = banin + 3; + +#ifdef DISABLE_STACKED_EXTBANS + return extban_is_banned_helper(sub_ban); +#else + return ban_check_mask(sptr, chptr, sub_ban, type, 0); +#endif +} + #ifndef DISABLE_STACKED_EXTBANS /** General is_ok for n!u@h stuff that also deals with recursive extbans. */ @@ -454,6 +471,17 @@ void extban_init(void) req.is_banned = extban_modeq_is_banned; ExtbanAdd(NULL, req); + memset(&req, 0, sizeof(ExtbanInfo)); + req.flag = 'j'; +#ifdef DISABLE_STACKED_EXTBANS + req.conv_param = extban_conv_param_nuh; +#else + req.conv_param = extban_conv_param_nuh_or_extban; +#endif + req.is_banned = extban_modej_is_banned; + req.is_ok = extban_is_ok_nuh_extban; + ExtbanAdd(NULL, req); + memset(&req, 0, sizeof(ExtbanInfo)); req.flag = 'n'; #ifdef DISABLE_STACKED_EXTBANS