summaryrefslogtreecommitdiff
path: root/modules/hostserv/del.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2016-07-28 21:29:35 -0400
committerAdam <Adam@anope.org>2016-07-28 21:29:35 -0400
commit0e758a2ac23dc4a001e8e126cec14588da9a9769 (patch)
tree45df813323e023c5c89db7279426c4ad0943b4a9 /modules/hostserv/del.cpp
parenta3c8afae00c54d5b95c620248b51f90679d7d53f (diff)
Allow serializable fields to use storage in the respective objects.
Split service management code nito a proper servicemanager. Make service references managed instead of lazy lookup. Also made events and serializable use service manager instead of their respective systems for management
Diffstat (limited to 'modules/hostserv/del.cpp')
-rw-r--r--modules/hostserv/del.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/modules/hostserv/del.cpp b/modules/hostserv/del.cpp
index 0830cd5b5..37823b1b7 100644
--- a/modules/hostserv/del.cpp
+++ b/modules/hostserv/del.cpp
@@ -14,10 +14,8 @@
class CommandHSDel : public Command
{
- EventHandlers<Event::DeleteVhost> &OnDeleteVhost;
-
public:
- CommandHSDel(Module *creator, EventHandlers<Event::DeleteVhost> &onDeleteVhost) : Command(creator, "hostserv/del", 1, 1), OnDeleteVhost(onDeleteVhost)
+ CommandHSDel(Module *creator) : Command(creator, "hostserv/del", 1, 1)
{
this->SetDesc(_("Delete the vhost of another user"));
this->SetSyntax(_("\037user\037"));
@@ -37,7 +35,7 @@ class CommandHSDel : public Command
}
Log(LOG_ADMIN, source, this) << "for user " << na->GetNick();
- this->OnDeleteVhost(&Event::DeleteVhost::OnDeleteVhost, na);
+ EventManager::Get()->Dispatch(&Event::DeleteVhost::OnDeleteVhost, na);
na->RemoveVhost();
source.Reply(_("Vhost for \002{0}\002 has been removed."), na->GetNick());
}
@@ -51,10 +49,8 @@ class CommandHSDel : public Command
class CommandHSDelAll : public Command
{
- EventHandlers<Event::DeleteVhost> &ondeletevhost;
-
public:
- CommandHSDelAll(Module *creator, EventHandlers<Event::DeleteVhost> &event) : Command(creator, "hostserv/delall", 1, 1), ondeletevhost(event)
+ CommandHSDelAll(Module *creator) : Command(creator, "hostserv/delall", 1, 1)
{
this->SetDesc(_("Delete the vhost for all nicks in a group"));
this->SetSyntax(_("\037group\037"));
@@ -73,10 +69,10 @@ class CommandHSDelAll : public Command
return;
}
- this->ondeletevhost(&Event::DeleteVhost::OnDeleteVhost, na);
+ EventManager::Get()->Dispatch(&Event::DeleteVhost::OnDeleteVhost, na);
NickServ::Account *nc = na->GetAccount();
- for (NickServ::Nick *na2 : nc->GetRefs<NickServ::Nick *>(NickServ::nick))
+ for (NickServ::Nick *na2 : nc->GetRefs<NickServ::Nick *>())
na2->RemoveVhost();
Log(LOG_ADMIN, source, this) << "for all nicks in group " << nc->GetDisplay();
source.Reply(_("Vhosts for group \002{0}\002 have been removed."), nc->GetDisplay());
@@ -93,13 +89,11 @@ class HSDel : public Module
{
CommandHSDel commandhsdel;
CommandHSDelAll commandhsdelall;
- EventHandlers<Event::DeleteVhost> ondeletevhost;
public:
HSDel(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR)
- , commandhsdel(this, ondeletevhost)
- , commandhsdelall(this, ondeletevhost)
- , ondeletevhost(this)
+ , commandhsdel(this)
+ , commandhsdelall(this)
{
if (!IRCD || !IRCD->CanSetVHost)
throw ModuleException("Your IRCd does not support vhosts");