1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-03 22:23:11 +02:00

Enable sending of named extended bans. This can be changed via the

configuration file via set::named-extended-bans <yes|no>; and now
defaults to yes.
Still to do:
* explicitly set names instead of using stupid module names
* update test suite to check for these new names (other git tree)
* backwards compatible sending to U5 and lower using ugly shit
This commit is contained in:
Bram Matthys
2021-08-14 10:08:08 +02:00
parent 34bf0d7ec6
commit a70580cc86
3 changed files with 16 additions and 2 deletions
+1
View File
@@ -112,6 +112,7 @@ struct Configuration {
char *restrict_usermodes;
char *restrict_channelmodes;
char *restrict_extendedbans;
int named_extended_bans;
char *channel_command_prefix;
long handshake_data_flood_amount;
long handshake_data_flood_ban_time;
+6 -2
View File
@@ -58,7 +58,7 @@ Extban *findmod_by_bantype(char *str, char **remainder)
{
if (ExtBan_Table[i].letter == str[1])
return &ExtBan_Table[i];
if (ExtBan_Table[i].name && !strncmp(ExtBan_Table[i].name, str+1, p-str-1))
if (ExtBan_Table[i].name && !strncmp(ExtBan_Table[i].name, str+1, strlen(ExtBan_Table[i].name)))
return &ExtBan_Table[i];
}
@@ -337,6 +337,10 @@ char *prefix_with_extban(char *remainder, BanContext *b, Extban *extban, char *b
if (remainder == NULL)
return NULL;
snprintf(buf, buflen, "~%c:%s", extban->letter, remainder);
if (iConf.named_extended_bans)
snprintf(buf, buflen, "~%s:%s", extban->name, remainder);
else
snprintf(buf, buflen, "~%c:%s", extban->letter, remainder);
return buf;
}
+9
View File
@@ -1848,6 +1848,8 @@ void config_setdefaultsettings(Configuration *i)
i->hide_idle_time = HIDE_IDLE_TIME_OPER_USERMODE;
i->who_limit = 100;
i->named_extended_bans = 1;
}
/** Similar to config_setdefaultsettings but this one is applied *AFTER*
@@ -7406,6 +7408,9 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce)
else if (!strcmp(cep->name, "restrict-extendedbans")) {
safe_strdup(tempiConf.restrict_extendedbans, cep->value);
}
else if (!strcmp(cep->name, "named-extended-bans")) {
tempiConf.named_extended_bans = config_checkval(cep->value, CFG_YESNO);
}
else if (!strcmp(cep->name, "anti-spam-quit-message-time")) {
tempiConf.anti_spam_quit_message_time = config_checkval(cep->value,CFG_TIME);
}
@@ -8273,6 +8278,10 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce)
CheckDuplicate(cep, restrict_extendedbans, "restrict-extendedbans");
CheckNull(cep);
}
else if (!strcmp(cep->name, "named-extended-bans"))
{
CheckNull(cep);
}
else if (!strcmp(cep->name, "link")) {
for (cepp = cep->items; cepp; cepp = cepp->next) {
CheckNull(cepp);