From e6c321c7dcd4e6dd5fb93479503fc0ad47e064f7 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Wed, 28 Aug 2019 18:08:38 +0200 Subject: [PATCH] Some cleanups / comments added, but no real code changes. --- src/conf.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/conf.c b/src/conf.c index 4bc056fa9..81241c627 100644 --- a/src/conf.c +++ b/src/conf.c @@ -2240,6 +2240,7 @@ void config_rehash() DelListItem(except_ptr, conf_except); MyFree(except_ptr); } + /* Free ban realname { }, ban server { } and ban version { } */ for (ban_ptr = conf_ban; ban_ptr; ban_ptr = (ConfigItem_ban *) next) { next = (ListStruct *)ban_ptr->next; @@ -2920,15 +2921,13 @@ ConfigItem_link *Find_link(char *servername, aClient *acptr) return NULL; } -ConfigItem_ban *Find_ban(aClient *sptr, char *host, short type) +/** Find a ban of type CONF_BAN_*, which is currently only + * CONF_BAN_SERVER, CONF_BAN_VERSION and CONF_BAN_REALNAME + */ +ConfigItem_ban *Find_ban(aClient *sptr, char *host, short type) { ConfigItem_ban *ban; - /* Check for an except ONLY if we find a ban, makes it - * faster since most users will not have a ban so excepts - * don't need to be searched -- codemastr - */ - for (ban = conf_ban; ban; ban = ban->next) { if (ban->flag.type == type) @@ -2955,15 +2954,14 @@ ConfigItem_ban *Find_ban(aClient *sptr, char *host, short type) return NULL; } +/** Find a ban of type CONF_BAN_*, which is currently only + * CONF_BAN_SERVER, CONF_BAN_VERSION and CONF_BAN_REALNAME + * This is the extended version, only used by m_svsnline. + */ ConfigItem_ban *Find_banEx(aClient *sptr, char *host, short type, short type2) { ConfigItem_ban *ban; - /* Check for an except ONLY if we find a ban, makes it - * faster since most users will not have a ban so excepts - * don't need to be searched -- codemastr - */ - for (ban = conf_ban; ban; ban = ban->next) { if ((ban->flag.type == type) && (ban->flag.type2 == type2)) @@ -6679,15 +6677,13 @@ int _conf_ban(ConfigFile *conf, ConfigEntry *ce) ca = MyMallocEx(sizeof(ConfigItem_ban)); if (!strcmp(ce->ce_vardata, "realname")) - { ca->flag.type = CONF_BAN_REALNAME; - } else if (!strcmp(ce->ce_vardata, "server")) ca->flag.type = CONF_BAN_SERVER; else if (!strcmp(ce->ce_vardata, "version")) { ca->flag.type = CONF_BAN_VERSION; - tempiConf.use_ban_version = 1; + tempiConf.use_ban_version = 1; /* enable CTCP VERSION on connect */ } else { int value;