diff options
| author | Adam <Adam@anope.org> | 2013-05-05 01:55:04 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2013-05-05 01:55:04 -0400 |
| commit | 1d0bb9b26b7ad58ab0bf979ac046f4511b3bf12b (patch) | |
| tree | 4486f0784bdf050fd7eb225c0cb9df352ce1f45a /modules | |
| parent | 781defb7076ddfddf723ca08cd0a518b6657b64f (diff) | |
Rework the config file reader to be much more flexible and move many configuration directives to the actual modules they are used in.
Diffstat (limited to 'modules')
120 files changed, 1561 insertions, 1226 deletions
diff --git a/modules/bs_autoassign.cpp b/modules/bs_autoassign.cpp index 134904925..3604fe69b 100644 --- a/modules/bs_autoassign.cpp +++ b/modules/bs_autoassign.cpp @@ -11,35 +11,28 @@ class BSAutoAssign : public Module { - Anope::string bot; - public: BSAutoAssign(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR) { - - Implementation i[] = { I_OnChanRegistered, I_OnReload }; + Implementation i[] = { I_OnChanRegistered }; ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation)); } void OnChanRegistered(ChannelInfo *ci) anope_override { - if (this->bot.empty()) + const Anope::string &bot = Config->GetModule(this)->Get<const Anope::string &>("bot"); + if (bot.empty()) return; - BotInfo *bi = BotInfo::Find(this->bot); + BotInfo *bi = BotInfo::Find(bot); if (bi == NULL) { - Log(this) << "bs_autoassign is configured to assign bot " << this->bot << ", but it does not exist?"; + Log(this) << "bs_autoassign is configured to assign bot " << bot << ", but it does not exist?"; return; } bi->Assign(NULL, ci); } - - void OnReload(ServerConfig *conf, ConfigReader &reader) anope_override - { - this->bot = reader.ReadValue("bs_autoassign", "bot", "", 0); - } }; MODULE_INIT(BSAutoAssign) diff --git a/modules/commands/bs_badwords.cpp b/modules/commands/bs_badwords.cpp index 90fbb875d..31dee8f8e 100644 --- a/modules/commands/bs_badwords.cpp +++ b/modules/commands/bs_badwords.cpp @@ -9,11 +9,8 @@ * Based on the original code of Services by Andy Church. */ -/*************************************************************************/ - #include "module.h" - class BadwordsDelCallback : public NumberList { CommandSource &source; @@ -146,17 +143,20 @@ class CommandBSBadwords : public Command realword = word.substr(0, pos); } - if (ci->GetBadWordCount() >= Config->BSBadWordsMax) + unsigned badwordsmax = Config->GetModule(this->module)->Get<unsigned>("badwordsmax"); + if (ci->GetBadWordCount() >= badwordsmax) { - source.Reply(_("Sorry, you can only have %d bad words entries on a channel."), Config->BSBadWordsMax); + source.Reply(_("Sorry, you can only have %d bad words entries on a channel."), badwordsmax); return; } + bool casesensitive = Config->GetModule("botserv")->Get<bool>("casesensitive"); + for (unsigned i = 0, end = ci->GetBadWordCount(); i < end; ++i) { const BadWord *bw = ci->GetBadWord(i); - if (!bw->word.empty() && ((Config->BSCaseSensitive && realword.equals_cs(bw->word)) || (!Config->BSCaseSensitive && realword.equals_ci(bw->word)))) + if ((casesensitive && realword.equals_cs(bw->word)) || (!casesensitive && realword.equals_ci(bw->word))) { source.Reply(_("\002%s\002 already exists in %s bad words list."), bw->word.c_str(), ci->name.c_str()); return; |
