summaryrefslogtreecommitdiff
path: root/modules/commands/bs_badwords.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/commands/bs_badwords.cpp
parent0b6476f06ff9ce06545c421143c7d7163c750aa5 (diff)
New event system
Diffstat (limited to 'modules/commands/bs_badwords.cpp')
-rw-r--r--modules/commands/bs_badwords.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/modules/commands/bs_badwords.cpp b/modules/commands/bs_badwords.cpp
index 551e89987..082dae0bd 100644
--- a/modules/commands/bs_badwords.cpp
+++ b/modules/commands/bs_badwords.cpp
@@ -12,6 +12,8 @@
#include "module.h"
#include "modules/bs_badwords.h"
+static EventHandlers<Event::BadWordEvents> *bwevents;
+
struct BadWordImpl : BadWord, Serializable
{
BadWordImpl() : Serializable("BadWord") { }
@@ -46,7 +48,7 @@ struct BadWordsImpl : BadWords
this->badwords->push_back(bw);
- FOREACH_MOD(OnBadWordAdd, (ci, bw));
+ (*bwevents)(&Event::BadWordEvents::OnBadWordAdd, ci, bw);
return bw;
}
@@ -71,7 +73,7 @@ struct BadWordsImpl : BadWords
if (this->badwords->empty() || index >= this->badwords->size())
return;
- FOREACH_MOD(OnBadWordDel, (ci, (*this->badwords)[index]));
+ (*bwevents)(&Event::BadWordEvents::OnBadWordDel, ci, (*this->badwords)[index]);
delete this->badwords->at(index);
}
@@ -457,11 +459,16 @@ class BSBadwords : public Module
CommandBSBadwords commandbsbadwords;
ExtensibleItem<BadWordsImpl> badwords;
Serialize::Type badword_type;
+ EventHandlers<Event::BadWordEvents> events;
public:
- BSBadwords(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
- commandbsbadwords(this), badwords(this, "badwords"), badword_type("BadWord", BadWordImpl::Unserialize)
+ BSBadwords(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR)
+ , commandbsbadwords(this)
+ , badwords(this, "badwords")
+ , badword_type("BadWord", BadWordImpl::Unserialize)
+ , events(this, "Badwords")
{
+ bwevents = &events;
}
};