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/cs_mode.cpp | |
parent | 0b6476f06ff9ce06545c421143c7d7163c750aa5 (diff) |
New event system
Diffstat (limited to 'modules/commands/cs_mode.cpp')
-rw-r--r-- | modules/commands/cs_mode.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/modules/commands/cs_mode.cpp b/modules/commands/cs_mode.cpp index ed54c5164..2e858b382 100644 --- a/modules/commands/cs_mode.cpp +++ b/modules/commands/cs_mode.cpp @@ -11,6 +11,9 @@ #include "module.h" #include "modules/cs_mode.h" +#include "modules/cs_info.h" + +static EventHandlers<Event::MLockEvents> *events; struct ModeLockImpl : ModeLock, Serializable { @@ -87,7 +90,7 @@ struct ModeLocksImpl : ModeLocks ml->created = created; EventReturn MOD_RESULT; - FOREACH_RESULT(OnMLock, MOD_RESULT, (this->ci, ml)); + MOD_RESULT = (*events)(&Event::MLockEvents::OnMLock, this->ci, ml); if (MOD_RESULT == EVENT_STOP) { delete ml; @@ -115,7 +118,7 @@ struct ModeLocksImpl : ModeLocks continue; EventReturn MOD_RESULT; - FOREACH_RESULT(OnUnMLock, MOD_RESULT, (this->ci, m)); + MOD_RESULT = (*events)(&Event::MLockEvents::OnUnMLock, this->ci, m); if (MOD_RESULT == EVENT_STOP) break; @@ -863,19 +866,29 @@ class CommandCSModes : public Command }; class CSMode : public Module + , public EventHook<Event::CheckModes> + , public EventHook<Event::CreateChan> + , public EventHook<Event::ChanInfo> { CommandCSMode commandcsmode; CommandCSModes commandcsmodes; ExtensibleItem<ModeLocksImpl> modelocks; Serialize::Type modelocks_type; + EventHandlers<Event::MLockEvents> modelockevents; + public: - CSMode(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), - commandcsmode(this), commandcsmodes(this), - modelocks(this, "modelocks"), - modelocks_type("ModeLock", ModeLockImpl::Unserialize) + CSMode(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR) + , EventHook<Event::CheckModes>("OnCheckModes") + , EventHook<Event::CreateChan>("OnCreateChan") + , EventHook<Event::ChanInfo>("OnChanInfo") + , commandcsmode(this) + , commandcsmodes(this) + , modelocks(this, "modelocks") + , modelocks_type("ModeLock", ModeLockImpl::Unserialize) + , modelockevents(this, "MLock") { - + events = &modelockevents; } void OnReload(Configuration::Conf *conf) override |