diff options
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; @@ -168,8 +168,6 @@ class CommandBSBadwords : public Command ci->AddBadWord(realword, bwtype); source.Reply(_("\002%s\002 added to %s bad words list."), realword.c_str(), ci->name.c_str()); - - return; } void DoDelete(CommandSource &source, ChannelInfo *ci, const Anope::string &word) @@ -219,6 +217,7 @@ class CommandBSBadwords : public Command source.Reply(_("Bad words list is now empty.")); return; } + public: CommandBSBadwords(Module *creator) : Command(creator, "botserv/badwords", 2, 3) { @@ -289,7 +288,7 @@ class CommandBSBadwords : public Command "will be done if a user says a word that ends with\n" "\037word\037. If you don't specify anything, a kick will\n" "be issued every time \037word\037 is said by a user.\n" - " \n"), Config->UseStrictPrivMsgString.c_str(), source.service->nick.c_str(), source.command.c_str()); + " \n"), Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), source.command.c_str()); source.Reply(_("The \002DEL\002 command removes the given word from the\n" "bad words list. If a list of entry numbers is given, those\n" "entries are deleted. (See the example for LIST below.)\n" @@ -316,7 +315,6 @@ class BSBadwords : public Module BSBadwords(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), commandbsbadwords(this) { - } }; diff --git a/modules/commands/bs_bot.cpp b/modules/commands/bs_bot.cpp index f8ecb1a1d..16fd9f2f2 100644 --- a/modules/commands/bs_bot.cpp +++ b/modules/commands/bs_bot.cpp @@ -29,21 +29,23 @@ class CommandBSBot : public Command return; } - if (nick.length() > Config->NickLen) + Configuration::Block *networkinfo = Config->GetBlock("networkinfo"); + + if (nick.length() > networkinfo->Get<unsigned>("nicklen")) { - source.Reply(_("Bot nicks may only be %d characters long."), Config->NickLen); + source.Reply(_("Bot nicks may only be %d characters long."), networkinfo->Get<unsigned> |
