diff options
author | Adam <Adam@anope.org> | 2010-07-31 21:37:45 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-07-31 21:37:45 -0400 |
commit | c770c47e18121e93bcdd06b1ab5f161440ffcfe2 (patch) | |
tree | 8e80d54507ab705e2dc51278c533c6000c8af1da /modules/core/ns_set_hide.cpp | |
parent | 9d0d44d738705a457ce08599ba50c97033a43c71 (diff) |
Don't dynamically allocate commands in modules anymore, instead made them members of modules. This means the commands are automatically destructed when the module is unloaded. Cleans up some old ugly code.
Diffstat (limited to 'modules/core/ns_set_hide.cpp')
-rw-r--r-- | modules/core/ns_set_hide.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/modules/core/ns_set_hide.cpp b/modules/core/ns_set_hide.cpp index 8432794ff..7cfef2dc7 100644 --- a/modules/core/ns_set_hide.cpp +++ b/modules/core/ns_set_hide.cpp @@ -16,7 +16,7 @@ class CommandNSSetHide : public Command { public: - CommandNSSetHide(const Anope::string &cname) : Command(cname, 2) + CommandNSSetHide() : Command("HIDE", 2) { } @@ -91,7 +91,7 @@ class CommandNSSetHide : public Command class CommandNSSASetHide : public Command { public: - CommandNSSASetHide(const Anope::string &cname) : Command(cname, 3, 3, "nickserv/saset/command") + CommandNSSASetHide() : Command("HIDE", 3, 3, "nickserv/saset/command") { } @@ -174,6 +174,9 @@ class CommandNSSASetHide : public Command class NSSetHide : public Module { + CommandNSSetHide commandnssethide; + CommandNSSASetHide commandnssasethide; + public: NSSetHide(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -182,22 +185,22 @@ class NSSetHide : public Module Command *c = FindCommand(NickServ, "SET"); if (c) - c->AddSubcommand(new CommandNSSetHide("HIDE")); + c->AddSubcommand(&commandnssethide); c = FindCommand(NickServ, "SASET"); if (c) - c->AddSubcommand(new CommandNSSASetHide("HIDE")); + c->AddSubcommand(&commandnssasethide); } ~NSSetHide() { Command *c = FindCommand(NickServ, "SET"); if (c) - c->DelSubcommand("HIDE"); + c->DelSubcommand(&commandnssethide); c = FindCommand(NickServ, "SASET"); if (c) - c->DelSubcommand("HIDE"); + c->DelSubcommand(&commandnssasethide); } }; |