X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fu_listmode.h;h=a728eb8397e3c1a21552731bd585a762c79794b8;hb=68211809ee3111bdc9609fbd46dc3c875fbb5ea6;hp=c6e1f9add129abb98af4e4c131f6ab8246d54140;hpb=46a39046196f55b52336e19662bb7bac85b731ac;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/u_listmode.h b/src/modules/u_listmode.h index c6e1f9add..a728eb839 100644 --- a/src/modules/u_listmode.h +++ b/src/modules/u_listmode.h @@ -100,8 +100,6 @@ class ListModeBase : public ModeHandler configtag(ctag), extItem("listbase_mode_" + name + "_list", Creator) { list = true; - this->DoRehash(); - ServerInstance->Extensions.Register(&extItem); } /** See mode.h @@ -203,21 +201,23 @@ class ListModeBase : public ModeHandler if (limit.mask.size() && limit.limit > 0) chanlimits.push_back(limit); } - if (chanlimits.size() == 0) - { - ListLimit limit; - limit.mask = "*"; - limit.limit = 64; - chanlimits.push_back(limit); - } + + // Add the default entry. This is inserted last so if the user specifies a + // wildcard record in the config it will take precedence over this entry. + ListLimit limit; + limit.mask = "*"; + limit.limit = 64; + chanlimits.push_back(limit); } /** Populate the Implements list with the correct events for a List Mode */ virtual void DoImplements(Module* m) { + ServerInstance->Modules->AddService(extItem); + this->DoRehash(); Implementation eventlist[] = { I_OnSyncChannel, I_OnRehash }; - ServerInstance->Modules->Attach(eventlist, m, 2); + ServerInstance->Modules->Attach(eventlist, m, sizeof(eventlist)/sizeof(Implementation)); } /** Handle the list mode. @@ -294,6 +294,8 @@ class ListModeBase : public ModeHandler return MODEACTION_DENY; } } + else + break; } } @@ -303,7 +305,7 @@ class ListModeBase : public ModeHandler source->WriteNumeric(478, "%s %s %s :Channel ban/ignore list is full", source->nick.c_str(), channel->name.c_str(), parameter.c_str()); } - parameter = ""; + parameter.clear(); return MODEACTION_DENY; } else @@ -316,7 +318,7 @@ class ListModeBase : public ModeHandler if (parameter == it->mask) { el->erase(it); - if (el->size() == 0) + if (el->empty()) { extItem.unset(channel); } @@ -325,14 +327,14 @@ class ListModeBase : public ModeHandler } /* Tried to remove something that wasn't set */ TellNotSet(source, channel, parameter); - parameter = ""; + parameter.clear(); return MODEACTION_DENY; } else { /* Hmm, taking an exception off a non-existant list, DIE */ TellNotSet(source, channel, parameter); - parameter = ""; + parameter.clear(); return MODEACTION_DENY; } }