From e1ebbf88edaf1898c04089409c177e37dde86ee1 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Fri, 11 Jan 2013 19:05:36 +0100 Subject: [PATCH] allow channel: Permit multiple channel items in one block again, was broken by patch from #4125. --- src/s_conf.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/s_conf.c b/src/s_conf.c index 04bb87bf5..fba1fa59f 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -5161,20 +5161,27 @@ int _conf_allow_channel(ConfigFile *conf, ConfigEntry *ce) { ConfigItem_allow_channel *allow = NULL; ConfigEntry *cep; + char *class = NULL; + + /* First, search for ::class, if any */ + for (cep = ce->ce_entries; cep; cep = cep->ce_next) + { + if (!strcmp(cep->ce_varname, "class")) + class = cep->ce_vardata; + } - allow = MyMallocEx(sizeof(ConfigItem_allow_channel)); for (cep = ce->ce_entries; cep; cep = cep->ce_next) { if (!strcmp(cep->ce_varname, "channel")) { + /* This way, we permit multiple ::channel items in one allow block */ + allow = MyMallocEx(sizeof(ConfigItem_allow_channel)); ircstrdup(allow->channel, cep->ce_vardata); - } - else if (!strcmp(cep->ce_varname, "class")) - { - ircstrdup(allow->class, cep->ce_vardata); + if (class) + ircstrdup(allow->class, class); + AddListItem(allow, conf_allow_channel); } } - AddListItem(allow, conf_allow_channel); return 1; }