diff options
author | Adam <Adam@anope.org> | 2014-04-20 14:35:14 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2014-04-20 14:35:14 -0400 |
commit | 26ac315192e0d8a04d50e910697ab794eedf0cc1 (patch) | |
tree | b9916f14fe35ce5c4de95c4194ca4ea0cb30812f /modules/commands/bs_bot.cpp | |
parent | 0b6476f06ff9ce06545c421143c7d7163c750aa5 (diff) |
New event system
Diffstat (limited to 'modules/commands/bs_bot.cpp')
-rw-r--r-- | modules/commands/bs_bot.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/modules/commands/bs_bot.cpp b/modules/commands/bs_bot.cpp index 46550603d..9aa572f00 100644 --- a/modules/commands/bs_bot.cpp +++ b/modules/commands/bs_bot.cpp @@ -10,10 +10,14 @@ */ #include "module.h" +#include "modules/bs_bot.h" class CommandBSBot : public Command { - private: + EventHandlers<Event::BotCreate> OnBotCreate; + EventHandlers<Event::BotChange> OnBotChange; + EventHandlers<Event::BotDelete> OnBotDelete; + void DoAdd(CommandSource &source, const std::vector<Anope::string> ¶ms) { const Anope::string &nick = params[1]; @@ -81,8 +85,7 @@ class CommandBSBot : public Command source.Reply(_("%s!%s@%s (%s) added to the bot list."), bi->nick.c_str(), bi->GetIdent().c_str(), bi->host.c_str(), bi->realname.c_str()); - FOREACH_MOD(OnBotCreate, (bi)); - return; + this->OnBotCreate(&Event::BotCreate::OnBotCreate, bi); } void DoChange(CommandSource &source, const std::vector<Anope::string> ¶ms) @@ -220,8 +223,7 @@ class CommandBSBot : public Command source.Reply(_("Bot \002%s\002 has been changed to %s!%s@%s (%s)."), oldnick.c_str(), bi->nick.c_str(), bi->GetIdent().c_str(), bi->host.c_str(), bi->realname.c_str()); Log(LOG_ADMIN, source, this) << "CHANGE " << oldnick << " to " << bi->GetMask() << " " << bi->realname; - FOREACH_MOD(OnBotChange, (bi)); - return; + this->OnBotChange(&Event::BotChange::OnBotChange, bi); } void DoDel(CommandSource &source, const std::vector<Anope::string> ¶ms) @@ -247,16 +249,16 @@ class CommandBSBot : public Command return; } - FOREACH_MOD(OnBotDelete, (bi)); + this->OnBotDelete(&Event::BotDelete::OnBotDelete, bi); Log(LOG_ADMIN, source, this) << "DEL " << bi->nick; source.Reply(_("Bot \002%s\002 has been deleted."), nick.c_str()); delete bi; - return; } + public: - CommandBSBot(Module *creator) : Command(creator, "botserv/bot", 1, 6) + CommandBSBot(Module *creator) : Command(creator, "botserv/bot", 1, 6), OnBotCreate(creator, "OnBotCreate"), OnBotChange(creator, "OnBotChange"), OnBotDelete(creator, "OnBotDelete") { this->SetDesc(_("Maintains network bot list")); this->SetSyntax(_("\002ADD \037nick\037 \037user\037 \037host\037 \037real\037\002")); @@ -367,8 +369,8 @@ class BSBot : public Module CommandBSBot commandbsbot; public: - BSBot(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), - commandbsbot(this) + BSBot(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR) + , commandbsbot(this) { } |