summaryrefslogtreecommitdiff
path: root/modules/fantasy.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2014-04-20 14:35:14 -0400
committerAdam <Adam@anope.org>2014-04-20 14:35:14 -0400
commit26ac315192e0d8a04d50e910697ab794eedf0cc1 (patch)
treeb9916f14fe35ce5c4de95c4194ca4ea0cb30812f /modules/fantasy.cpp
parent0b6476f06ff9ce06545c421143c7d7163c750aa5 (diff)
New event system
Diffstat (limited to 'modules/fantasy.cpp')
-rw-r--r--modules/fantasy.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/modules/fantasy.cpp b/modules/fantasy.cpp
index 1e8bc4e10..e89b35365 100644
--- a/modules/fantasy.cpp
+++ b/modules/fantasy.cpp
@@ -10,6 +10,7 @@
*/
#include "module.h"
+#include "modules/fantasy.h"
class CommandBSSetFantasy : public Command
{
@@ -81,14 +82,22 @@ class CommandBSSetFantasy : public Command
};
class Fantasy : public Module
+ , public EventHook<Event::Privmsg>
{
SerializableExtensibleItem<bool> fantasy;
CommandBSSetFantasy commandbssetfantasy;
+ EventHandlers<Event::BotFantasy> OnBotFantasy;
+ EventHandlers<Event::BotNoFantasyAccess> OnBotNoFantasyAccess;
+
public:
- Fantasy(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
- fantasy(this, "BS_FANTASY"), commandbssetfantasy(this)
+ Fantasy(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR)
+ , EventHook<Event::Privmsg>("OnPrivmsg")
+ , fantasy(this, "BS_FANTASY")
+ , commandbssetfantasy(this)
+ , OnBotFantasy(this, "OnBotFantasy")
+ , OnBotNoFantasyAccess(this, "OnBotNoFantasyAccess")
{
}
@@ -168,11 +177,11 @@ class Fantasy : public Module
EventReturn MOD_RESULT;
if (has_fantasia)
{
- FOREACH_RESULT(OnBotFantasy, MOD_RESULT, (source, cmd, c->ci, params));
+ MOD_RESULT = this->OnBotFantasy(&Event::BotFantasy::OnBotFantasy, source, cmd, c->ci, params);
}
else
{
- FOREACH_RESULT(OnBotNoFantasyAccess, MOD_RESULT, (source, cmd, c->ci, params));
+ MOD_RESULT = this->OnBotNoFantasyAccess(&Event::BotNoFantasyAccess::OnBotNoFantasyAccess, source, cmd, c->ci, params);
}
if (MOD_RESULT == EVENT_STOP || !has_fantasia)
@@ -181,7 +190,7 @@ class Fantasy : public Module
if (MOD_RESULT != EVENT_ALLOW && !info.permission.empty() && !source.HasCommand(info.permission))
return;
- FOREACH_RESULT(OnPreCommand, MOD_RESULT, (source, cmd, params));
+ MOD_RESULT = Event::OnPreCommand(&Event::PreCommand::OnPreCommand, source, cmd, params);
if (MOD_RESULT == EVENT_STOP)
return;
@@ -189,7 +198,7 @@ class Fantasy : public Module
cmd->Execute(source, params);
if (!nc_reference)
source.nc = NULL;
- FOREACH_MOD(OnPostCommand, (source, cmd, params));
+ Event::OnPostCommand(&Event::PostCommand::OnPostCommand, source, cmd, params);
}
void OnBotInfo(CommandSource &source, BotInfo *bi, ChannelInfo *ci, InfoFormatter &info)