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 | |
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.
149 files changed, 743 insertions, 444 deletions
diff --git a/include/commands.h b/include/commands.h index 0c8b7bae1..714d1c48d 100644 --- a/include/commands.h +++ b/include/commands.h @@ -106,9 +106,15 @@ class CoreExport Command : public Flags<CommandFlag> virtual bool AddSubcommand(Command *c); /** Delete a subcommand from this command - * @param cname The subcommand name + * @param c The command + */ + virtual bool DelSubcommand(Command *c); + + /** Find a subcommand + * @param name The subcommand name + * @return The subcommand */ - virtual bool DelSubcommand(const Anope::string &cname); + virtual Command *FindSubcommand(const Anope::string &name); }; #endif // COMMANDS_H diff --git a/modules/core/bs_act.cpp b/modules/core/bs_act.cpp index ecfe76e94..d553aa950 100644 --- a/modules/core/bs_act.cpp +++ b/modules/core/bs_act.cpp @@ -73,13 +73,15 @@ class CommandBSAct : public Command class BSAct : public Module { + CommandBSAct commandbsact; + public: BSAct(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(BotServ, new CommandBSAct()); + this->AddCommand(BotServ, &commandbsact); } }; diff --git a/modules/core/bs_assign.cpp b/modules/core/bs_assign.cpp index 22f5f4487..ab24b1f39 100644 --- a/modules/core/bs_assign.cpp +++ b/modules/core/bs_assign.cpp @@ -83,13 +83,15 @@ class CommandBSAssign : public Command class BSAssign : public Module { + CommandBSAssign commandbsassign; + public: BSAssign(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(BotServ, new CommandBSAssign); + this->AddCommand(BotServ, &commandbsassign); } }; diff --git a/modules/core/bs_badwords.cpp b/modules/core/bs_badwords.cpp index e7dacb42b..92567252e 100644 --- a/modules/core/bs_badwords.cpp +++ b/modules/core/bs_badwords.cpp @@ -270,13 +270,15 @@ class CommandBSBadwords : public Command class BSBadwords : public Module { + CommandBSBadwords commandbsbadwords; + public: BSBadwords(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(BotServ, new CommandBSBadwords); + this->AddCommand(BotServ, &commandbsbadwords); } }; diff --git a/modules/core/bs_bot.cpp b/modules/core/bs_bot.cpp index b8de7050c..fdff5ba5c 100644 --- a/modules/core/bs_bot.cpp +++ b/modules/core/bs_bot.cpp @@ -396,13 +396,15 @@ class CommandBSBot : public Command class BSBot : public Module { + CommandBSBot commandbsbot; + public: BSBot(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(BotServ, new CommandBSBot()); + this->AddCommand(BotServ, &commandbsbot); } }; diff --git a/modules/core/bs_botlist.cpp b/modules/core/bs_botlist.cpp index a54b50154..0dbb8bedf 100644 --- a/modules/core/bs_botlist.cpp +++ b/modules/core/bs_botlist.cpp @@ -81,13 +81,15 @@ class CommandBSBotList : public Command class BSBotList : public Module { + CommandBSBotList commandbsbotlist; + public: BSBotList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(BotServ, new CommandBSBotList()); + this->AddCommand(BotServ, &commandbsbotlist); } }; diff --git a/modules/core/bs_help.cpp b/modules/core/bs_help.cpp index 08146f827..c41472ad3 100644 --- a/modules/core/bs_help.cpp +++ b/modules/core/bs_help.cpp @@ -41,13 +41,15 @@ class CommandBSHelp : public Command class BSHelp : public Module { + CommandBSHelp commandbshelp; + public: BSHelp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(BotServ, new CommandBSHelp()); + this->AddCommand(BotServ, &commandbshelp); } }; diff --git a/modules/core/bs_info.cpp b/modules/core/bs_info.cpp index 65147d859..2f1dafb81 100644 --- a/modules/core/bs_info.cpp +++ b/modules/core/bs_info.cpp @@ -216,13 +216,15 @@ class CommandBSInfo : public Command class BSInfo : public Module { + CommandBSInfo commandbsinfo; + public: BSInfo(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(BotServ, new CommandBSInfo()); + this->AddCommand(BotServ, &commandbsinfo); } }; diff --git a/modules/core/bs_kick.cpp b/modules/core/bs_kick.cpp index 4936f0112..cb0253874 100644 --- a/modules/core/bs_kick.cpp +++ b/modules/core/bs_kick.cpp @@ -376,13 +376,15 @@ class CommandBSKick : public Command class BSKick : public Module { + CommandBSKick commandbskick; + public: BSKick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(BotServ, new CommandBSKick()); + this->AddCommand(BotServ, &commandbskick); } }; diff --git a/modules/core/bs_say.cpp b/modules/core/bs_say.cpp index 81616cf32..ca9e6bde3 100644 --- a/modules/core/bs_say.cpp +++ b/modules/core/bs_say.cpp @@ -79,13 +79,15 @@ class CommandBSSay : public Command class BSSay : public Module { + CommandBSSay commandbssay; + public: BSSay(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(BotServ, new CommandBSSay()); + this->AddCommand(BotServ, &commandbssay); } }; diff --git a/modules/core/bs_set.cpp b/modules/core/bs_set.cpp index 9788c278c..1a329ee4f 100644 --- a/modules/core/bs_set.cpp +++ b/modules/core/bs_set.cpp @@ -203,13 +203,15 @@ class CommandBSSet : public Command class BSSet : public Module { + CommandBSSet commandbsset; + public: BSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(BotServ, new CommandBSSet()); + this->AddCommand(BotServ, &commandbsset); } }; diff --git a/modules/core/bs_unassign.cpp b/modules/core/bs_unassign.cpp index 3c6a3ccb1..8dd01f7f5 100644 --- a/modules/core/bs_unassign.cpp +++ b/modules/core/bs_unassign.cpp @@ -61,13 +61,15 @@ class CommandBSUnassign : public Command class BSUnassign : public Module { + CommandBSUnassign commandbsunassign; + public: BSUnassign(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(BotServ, new CommandBSUnassign); + this->AddCommand(BotServ, &commandbsunassign); } }; diff --git a/modules/core/cs_access.cpp b/modules/core/cs_access.cpp index 74c72fcbb..23e5a415b 100644 --- a/modules/core/cs_access.cpp +++ b/modules/core/cs_access.cpp @@ -609,14 +609,17 @@ class CommandCSLevels : public Command class CSAccess : public Module { + CommandCSAccess commandcsaccess; + CommandCSLevels commandcslevels; + public: CSAccess(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(ChanServ, new CommandCSAccess()); - this->AddCommand(ChanServ, new CommandCSLevels()); + this->AddCommand(ChanServ, &commandcsaccess); + this->AddCommand(ChanServ, &commandcslevels); } }; diff --git a/modules/core/cs_akick.cpp b/modules/core/cs_akick.cpp index 394669513..ee41c964b 100644 --- a/modules/core/cs_akick.cpp +++ b/modules/core/cs_akick.cpp @@ -571,13 +571,15 @@ class CommandCSAKick : public Command class CSAKick : public Module { + CommandCSAKick commandcsakick; + public: CSAKick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(ChanServ, new CommandCSAKick()); + this->AddCommand(ChanServ, &commandcsakick); } }; diff --git a/modules/core/cs_ban.cpp b/modules/core/cs_ban.cpp index 08cbc45ad..20e97503a 100644 --- a/modules/core/cs_ban.cpp +++ b/modules/core/cs_ban.cpp @@ -92,14 +92,16 @@ class CommandCSBan : public Command class CSBan : public Module { + CommandCSBan commandcsban, commandcskb; + public: - CSBan(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSBan(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), commandcsban("BAN"), commandcskb("KB") { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(ChanServ, new CommandCSBan("BAN")); - this->AddCommand(ChanServ, new CommandCSBan("KB")); + this->AddCommand(ChanServ, &commandcsban); + this->AddCommand(ChanServ, &commandcskb); } }; diff --git a/modules/core/cs_clear.cpp b/modules/core/cs_clear.cpp index 910552ac2..f62e2b5f0 100644 --- a/modules/core/cs_clear.cpp +++ b/modules/core/cs_clear.cpp @@ -162,13 +162,15 @@ class CommandCSClear : public Command class CSClear : public Module { + CommandCSClear commandcsclear; + public: CSClear(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(ChanServ, new CommandCSClear()); + this->AddCommand(ChanServ, &commandcsclear); } }; diff --git a/modules/core/cs_drop.cpp b/modules/core/cs_drop.cpp index cfbad70fa..5136772b2 100644 --- a/modules/core/cs_drop.cpp +++ b/modules/core/cs_drop.cpp @@ -104,13 +104,15 @@ class CommandCSDrop : public Command class CSDrop : public Module { + CommandCSDrop commandcsdrop; + public: CSDrop(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(ChanServ, new CommandCSDrop()); + this->AddCommand(ChanServ, &commandcsdrop); } }; diff --git a/modules/core/cs_forbid.cpp b/modules/core/cs_forbid.cpp index 94ad125b9..004b523cc 100644 --- a/modules/core/cs_forbid.cpp +++ b/modules/core/cs_forbid.cpp @@ -116,13 +116,15 @@ class CommandCSForbid : public Command class CSForbid : public Module { + CommandCSForbid commandcsforbid; + public: CSForbid(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(ChanServ, new CommandCSForbid()); + this->AddCommand(ChanServ, &commandcsforbid); } }; diff --git a/modules/core/cs_getkey.cpp b/modules/core/cs_getkey.cpp index 80fa564e8..c95330f60 100644 --- a/modules/core/cs_getkey.cpp +++ b/modules/core/cs_getkey.cpp @@ -63,13 +63,15 @@ class CommandCSGetKey : public Command class CSGetKey : public Module { + CommandCSGetKey commandcsgetkey; + public: CSGetKey(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(ChanServ, new CommandCSGetKey()); + this->AddCommand(ChanServ, &commandcsgetkey); } }; diff --git a/modules/core/cs_help.cpp b/modules/core/cs_help.cpp index 0a6ba7aaf..168c5fa07 100644 --- a/modules/core/cs_help.cpp +++ b/modules/core/cs_help.cpp @@ -61,13 +61,15 @@ class CommandCSHelp : public Command class CSHelp : public Module { + CommandCSHelp commandcshelp; + public: CSHelp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(ChanServ, new CommandCSHelp()); + this->AddCommand(ChanServ, &commandcshelp); } }; diff --git a/modules/core/cs_info.cpp b/modules/core/cs_info.cpp index 5f135ce4d..82722fe03 100644 --- a/modules/core/cs_info.cpp +++ b/modules/core/cs_info.cpp @@ -146,13 +146,15 @@ class CommandCSInfo : public Command class CSInfo : public Module { + CommandCSInfo commandcsinfo; + public: CSInfo(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(ChanServ, new CommandCSInfo()); + this->AddCommand(ChanServ, &commandcsinfo); } }; diff --git a/modules/core/cs_invite.cpp b/modules/core/cs_invite.cpp index 011a0bcf3..c4f3bd4fa 100644 --- a/modules/core/cs_invite.cpp +++ b/modules/core/cs_invite.cpp @@ -82,12 +82,15 @@ class CommandCSInvite : public Command class CSInvite : public Module { + CommandCSInvite commandcsinvite; + public: CSInvite(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(ChanServ, new CommandCSInvite()); + + this->AddCommand(ChanServ, &commandcsinvite); } }; diff --git a/modules/core/cs_kick.cpp b/modules/core/cs_kick.cpp index 44bfc6d89..5654e4479 100644 --- a/modules/core/cs_kick.cpp +++ b/modules/core/cs_kick.cpp @@ -78,14 +78,16 @@ class CommandCSKick : public Command class CSKick : public Module { + CommandCSKick commandcskick, commandcsk; + public: - CSKick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + CSKick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), commandcskick("KICK"), commandcsk("K") { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(ChanServ, new CommandCSKick("KICK")); - this->AddCommand(ChanServ, new CommandCSKick("K")); + this->AddCommand(ChanServ, &commandcskick); + this->AddCommand(ChanServ, &commandcsk); } }; diff --git a/modules/core/cs_list.cpp b/modules/core/cs_list.cpp index d6a55d774..284f90e84 100644 --- a/modules/core/cs_list.cpp +++ b/modules/core/cs_list.cpp @@ -148,13 +148,15 @@ public: class CSList : public Module { -public: + CommandCSList commandcslist; + + public: CSList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(ChanServ, new CommandCSList()); + this->AddCommand(ChanServ, &commandcslist); } }; diff --git a/modules/core/cs_modes.cpp b/modules/core/cs_modes.cpp index 5825b7a97..66f882147 100644 --- a/modules/core/cs_modes.cpp +++ b/modules/core/cs_modes.cpp @@ -399,16 +399,27 @@ class CommandCSDeOwner : public Command class CSModes : public Module { + CommandCSOwner commandcsowner; + CommandCSDeOwner commandcsdeowner; + CommandCSProtect commandcsprotect; + CommandCSDeProtect commandcsdeprotect; + CommandCSOp commandcsop; + CommandCSDeOp commandcsdeop; + CommandCSHalfOp commandcshalfop; + CommandCSDeHalfOp commandcsdehalfop; + CommandCSVoice commandcsvoice; + CommandCSDeVoice commandcsdevoice; + public: CSModes(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(ChanServ, new CommandCSOp()); - this->AddCommand(ChanServ, new CommandCSDeOp()); - this->AddCommand(ChanServ, new CommandCSVoice()); - this->AddCommand(ChanServ, new CommandCSDeVoice()); + this->AddCommand(ChanServ, &commandcsop); + this->AddCommand(ChanServ, &commandcsdeop); + this->AddCommand(ChanServ, &commandcsvoice); + this->AddCommand(ChanServ, &commandcsdevoice); if (Me && Me->IsSynced()) OnUplinkSync(NULL); @@ -421,31 +432,31 @@ class CSModes : public Module { if (ModeManager::FindChannelModeByName(CMODE_OWNER)) { - this->AddCommand(ChanServ, new CommandCSOwner()); - this->AddCommand(ChanServ, new CommandCSDeOwner()); + this->AddCommand(ChanServ, &commandcsowner); + this->AddCommand(ChanServ, &commandcsdeowner); } if (ModeManager::FindChannelModeByName(CMODE_PROTECT)) { - this->AddCommand(ChanServ, new CommandCSProtect()); - this->AddCommand(ChanServ, new CommandCSDeProtect()); + this->AddCommand(ChanServ, &commandcsprotect); + this->AddCommand(ChanServ, &commandcsdeprotect); } if (ModeManager::FindChannelModeByName(CMODE_HALFOP)) { - this->AddCommand(ChanServ, new CommandCSHalfOp()); - this->AddCommand(ChanServ, new CommandCSDeHalfOp()); + this->AddCommand(ChanServ, &commandcshalfop); + this->AddCommand(ChanServ, &commandcsdehalfop); } } void OnServerDisconnect() { - this->DelCommand(ChanServ, FindCommand(ChanServ, "OWNER")); - this->DelCommand(ChanServ, FindCommand(ChanServ, "DEOWNER")); - this->DelCommand(ChanServ, FindCommand(ChanServ, "PROTECT")); - this->DelCommand(ChanServ, FindCommand(ChanServ, "DEPROTECT")); - this->DelCommand(ChanServ, FindCommand(ChanServ, "HALFOP")); - this->DelCommand(ChanServ, FindCommand(ChanServ, "DEHALFOP")); + this->DelCommand(ChanServ, &commandcsowner); + this->DelCommand(ChanServ, &commandcsdeowner); + this->DelCommand(ChanServ, &commandcsprotect); + this->DelCommand(ChanServ, &commandcsdeprotect); + this->DelCommand(ChanServ, &commandcshalfop); + this->DelCommand(ChanServ, &commandcsdehalfop); } }; diff --git a/modules/core/cs_register.cpp b/modules/core/cs_register.cpp index 997247d65..5e570f40e 100644 --- a/modules/core/cs_register.cpp +++ b/modules/core/cs_register.cpp @@ -113,13 +113,15 @@ class CommandCSRegister : public Command class CSRegister : public Module { + CommandCSRegister commandcsregister; + public: CSRegister(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(ChanServ, new CommandCSRegister()); + this->AddCommand(ChanServ, &commandcsregister); } }; diff --git a/modules/core/cs_saset.cpp b/modules/core/cs_saset.cpp index ef139e90a..d00521645 100644 --- a/modules/core/cs_saset.cpp +++ b/modules/core/cs_saset.cpp @@ -19,14 +19,12 @@ class CommandCSSASet : public Command subcommand_map subcommands; public: - CommandCSSASet(const Anope::string &cname) : Command(cname, 2, 3) + CommandCSSASet() : Command("SASET", 2, 3) { } ~CommandCSSASet() { - for (subcommand_map::const_iterator it = this->subcommands.begin(), it_end = this->subcommands.end(); it != it_end; ++it) - delete it->second; this->subcommands.clear(); } @@ -92,9 +90,9 @@ class CommandCSSASet : public Command return this->subcommands.insert(std::make_pair(c->name, c)).second; } - bool DelSubcommand(const Anope::string &command) + bool DelSubcommand(Command *c) { - return this->subcommands.erase(command); + return this->subcommands.erase(c->name); } Command *FindCommand(const Anope::string &subcommand) @@ -110,13 +108,15 @@ class CommandCSSASet : public Command class CSSASet : public Module { + CommandCSSASet commandcssaset; + public: CSSASet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(ChanServ, new CommandCSSASet("SASET")); + this->AddCommand(ChanServ, &commandcssaset); } }; diff --git a/modules/core/cs_saset_noexpire.cpp b/modules/core/cs_saset_noexpire.cpp index a89f30c36..449239983 100644 --- a/modules/core/cs_saset_noexpire.cpp +++ b/modules/core/cs_saset_noexpire.cpp @@ -16,7 +16,7 @@ class CommandCSSASetNoexpire : public Command { public: - CommandCSSASetNoexpire(const Anope::string &cname) : Command(cname, 2, 2, "chanserv/saset/noexpire") + CommandCSSASetNoexpire() : Command("NOEXPIRE", 2, 2, "chanserv/saset/noexpire") { } @@ -61,6 +61,8 @@ class CommandCSSASetNoexpire : public Command class CSSetNoexpire : public Module { + CommandCSSASetNoexpire commandcssasetnoexpire; + public: CSSetNoexpire(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -69,14 +71,14 @@ class CSSetNoexpire : public Module Command *c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(new CommandCSSASetNoexpire("NOEXPIRE")); + c->AddSubcommand(&commandcssasetnoexpire); } ~CSSetNoexpire() { Command *c = FindCommand(ChanServ, "SASET"); if (c) - c->DelSubcommand("NOEXPIRE"); + c->DelSubcommand(&commandcssasetnoexpire); } }; diff --git a/modules/core/cs_set.cpp b/modules/core/cs_set.cpp index 219fbb3c1..49c5ca0fe 100644 --- a/modules/core/cs_set.cpp +++ b/modules/core/cs_set.cpp @@ -19,14 +19,12 @@ class CommandCSSet : public Command subcommand_map subcommands; public: - CommandCSSet(const Anope::string &cname) : Command(cname, 2, 3) + CommandCSSet() : Command("SET", 2, 3) { } ~CommandCSSet() { - for (subcommand_map::const_iterator it = this->subcommands.begin(), it_end = this->subcommands.end(); it != it_end; ++it) - delete it->second; this->subcommands.clear(); } @@ -97,9 +95,9 @@ class CommandCSSet : public Command return this->subcommands.insert(std::make_pair(c->name, c)).second; } - bool DelSubcommand(const Anope::string &command) + bool DelSubcommand(Command *c) { - return this->subcommands.erase(command); + return this->subcommands.erase(c->name); } Command *FindCommand(const Anope::string &subcommand) @@ -115,13 +113,15 @@ class CommandCSSet : public Command class CSSet : public Module { + CommandCSSet commandcsset; + public: CSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(ChanServ, new CommandCSSet("SET")); + this->AddCommand(ChanServ, &commandcsset); } }; diff --git a/modules/core/cs_set_bantype.cpp b/modules/core/cs_set_bantype.cpp index 90041c7e6..6f0830a55 100644 --- a/modules/core/cs_set_bantype.cpp +++ b/modules/core/cs_set_bantype.cpp @@ -16,7 +16,7 @@ class CommandCSSetBanType : public Command { public: - CommandCSSetBanType(const Anope::string &cname, const Anope::string &cpermission = "") : Command(cname, 2, 2, cpermission) + CommandCSSetBanType(const Anope::string &cpermission = "") : Command("BANTYPE", 2, 2, cpermission) { } @@ -62,7 +62,7 @@ class CommandCSSetBanType : public Command class CommandCSSASetBanType : public CommandCSSetBanType { public: - CommandCSSASetBanType(const Anope::string &cname) : CommandCSSetBanType(cname, "chanserv/saset/bantype") + CommandCSSASetBanType() : CommandCSSetBanType("chanserv/saset/bantype") { } @@ -81,6 +81,9 @@ class CommandCSSASetBanType : public CommandCSSetBanType class CSSetBanType : public Module { + CommandCSSetBanType commandcssetbantype; + CommandCSSASetBanType commandcssasetbantype; + public: CSSetBanType(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -89,22 +92,22 @@ class CSSetBanType : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(new CommandCSSetBanType("BANTYPE")); + c->AddSubcommand(&commandcssetbantype); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(new CommandCSSASetBanType("BANTYPE")); + c->AddSubcommand(&commandcssasetbantype); } ~CSSetBanType() { Command *c = FindCommand(ChanServ, "SET"); if (c) - c->DelSubcommand("BANTYPE"); + c->DelSubcommand(&commandcssetbantype); c = FindCommand(ChanServ, "SASET"); if (c) - c->DelSubcommand("BANTYPE"); + c->DelSubcommand(&commandcssasetbantype); } }; diff --git a/modules/core/cs_set_description.cpp b/modules/core/cs_set_description.cpp index 9186b55ab..a00a6d24e 100644 --- a/modules/core/cs_set_description.cpp +++ b/modules/core/cs_set_description.cpp @@ -16,7 +16,7 @@ class CommandCSSetDescription : public Command { public: - CommandCSSetDescription(const Anope::string &cname, const Anope::string &cpermission = "") : Command(cname, 2, 2, cpermission) + CommandCSSetDescription(const Anope::string &cpermission = "") : Command("DESC", 2, 2, cpermission) { } @@ -54,7 +54,7 @@ class CommandCSSetDescription : public Command class CommandCSSASetDescription : public CommandCSSetDescription { public: - CommandCSSASetDescription(const Anope::string &cname) : CommandCSSetDescription(cname, "chanserv/saset/description") + CommandCSSASetDescription() : CommandCSSetDescription("chanserv/saset/description") { } @@ -73,6 +73,9 @@ class CommandCSSASetDescription : public CommandCSSetDescription class CSSetDescription : public Module { + CommandCSSetDescription commandcssetdescription; + CommandCSSASetDescription commandcssasetdescription; + public: CSSetDescription(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -81,22 +84,22 @@ class CSSetDescription : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(new CommandCSSetDescription("DESC")); + c->AddSubcommand(&commandcssetdescription); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(new CommandCSSASetDescription("DESC")); + c->AddSubcommand(&commandcssasetdescription); } ~CSSetDescription() { Command *c = FindCommand(ChanServ, "SET"); if (c) - c->DelSubcommand("DESC"); + c->DelSubcommand(&commandcssetdescription); c = FindCommand(ChanServ, "SASET"); if (c) - c->DelSubcommand("DESC"); + c->DelSubcommand(&commandcssasetdescription); } }; diff --git a/modules/core/cs_set_entrymsg.cpp b/modules/core/cs_set_entrymsg.cpp index 362a5eea3..2e56cdba9 100644 --- a/modules/core/cs_set_entrymsg.cpp +++ b/modules/core/cs_set_entrymsg.cpp @@ -16,7 +16,7 @@ class CommandCSSetEntryMsg : public Command { public: - CommandCSSetEntryMsg(const Anope::string &cname, const Anope::string &cpermission = "") : Command(cname, 1, 2, cpermission) + CommandCSSetEntryMsg(const Anope::string &cpermission = "") : Command("ENTRYMSG", 1, 2, cpermission) { } @@ -61,7 +61,7 @@ class CommandCSSetEntryMsg : public Command class CommandCSSASetEntryMsg : public CommandCSSetEntryMsg { public: - CommandCSSASetEntryMsg(const Anope::string &cname) : CommandCSSetEntryMsg(cname, "chanserv/saset/entrymsg") + CommandCSSASetEntryMsg() : CommandCSSetEntryMsg("chanserv/saset/entrymsg") { } @@ -80,6 +80,9 @@ class CommandCSSASetEntryMsg : public CommandCSSetEntryMsg class CSSetEntryMsg : public Module { + CommandCSSetEntryMsg commandcssetentrymsg; + CommandCSSASetEntryMsg commandcssasetentrymsg; + public: CSSetEntryMsg(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -88,22 +91,22 @@ class CSSetEntryMsg : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(new CommandCSSetEntryMsg("ENTRYMSG")); + c->AddSubcommand(&commandcssetentrymsg); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(new CommandCSSASetEntryMsg("ENTRYMSG")); + c->AddSubcommand(&commandcssasetentrymsg); } ~CSSetEntryMsg() { Command *c = FindCommand(ChanServ, "SET"); if (c) - c->DelSubcommand("ENTRYMSG"); + c->DelSubcommand(&commandcssetentrymsg); c = FindCommand(ChanServ, "SASET"); if (c) - c->DelSubcommand("ENTRYMSG"); + c->DelSubcommand(&commandcssasetentrymsg); } }; diff --git a/modules/core/cs_set_founder.cpp b/modules/core/cs_set_founder.cpp index 4fb83a9ec..5daefcba9 100644 --- a/modules/core/cs_set_founder.cpp +++ b/modules/core/cs_set_founder.cpp @@ -16,7 +16,7 @@ class CommandCSSetFounder : public Command { public: - CommandCSSetFounder(const Anope::string &cname, const Anope::string &cpermission = "") : Command(cname, 2, 2, cpermission) + CommandCSSetFounder(const Anope::string &cpermission = "") : Command("FOUNDER", 2, 2, cpermission) { } @@ -89,7 +89,7 @@ class CommandCSSetFounder : public Command class CommandCSSASetFounder : public CommandCSSetFounder { public: - CommandCSSASetFounder(const Anope::string &cname) : CommandCSSetFounder(cname, "chanserv/saset/founder") + CommandCSSASetFounder() : CommandCSSetFounder("chanserv/saset/founder") { } @@ -108,6 +108,9 @@ class CommandCSSASetFounder : public CommandCSSetFounder class CSSetFounder : public Module { + CommandCSSetFounder commandcssetfounder; + CommandCSSASetFounder commandcssasetfounder; + public: CSSetFounder(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -116,22 +119,22 @@ class CSSetFounder : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(new CommandCSSetFounder("FOUNDER")); + c->AddSubcommand(&commandcssetfounder); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(new CommandCSSASetFounder("FOUNDER")); + c->AddSubcommand(&commandcssasetfounder); } ~CSSetFounder() { Command *c = FindCommand(ChanServ, "SET"); if (c) - c->DelSubcommand("FOUNDER"); + c->DelSubcommand(&commandcssetfounder); c = FindCommand(ChanServ, "SASET"); if (c) - c->DelSubcommand("FOUNDER"); + c->DelSubcommand(&commandcssasetfounder); } }; diff --git a/modules/core/cs_set_keeptopic.cpp b/modules/core/cs_set_keeptopic.cpp index 28a6cd550..df494f48b 100644 --- a/modules/core/cs_set_keeptopic.cpp +++ b/modules/core/cs_set_keeptopic.cpp @@ -16,7 +16,7 @@ class CommandCSSetKeepTopic : public Command { public: - CommandCSSetKeepTopic(const Anope::string &cname, const Anope::string &cpermission = "") : Command(cname, 2, 2, cpermission) + CommandCSSetKeepTopic(const Anope::string &cpermission = "") : Command("KEEPTOPIC", 2, 2, cpermission) { } @@ -62,7 +62,7 @@ class CommandCSSetKeepTopic : public Command class CommandCSSASetKeepTopic : public CommandCSSetKeepTopic { public: - CommandCSSASetKeepTopic(const Anope::string &cname) : CommandCSSetKeepTopic(cname, "chanserv/saset/keeptopic") + CommandCSSASetKeepTopic() : CommandCSSetKeepTopic("chanserv/saset/keeptopic") { } @@ -80,6 +80,9 @@ class CommandCSSASetKeepTopic : public CommandCSSetKeepTopic class CSSetKeepTopic : public Module { + CommandCSSetKeepTopic commandcssetkeeptopic; + CommandCSSASetKeepTopic commandcssasetkeeptopic; + public: CSSetKeepTopic(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -88,22 +91,22 @@ class CSSetKeepTopic : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(new CommandCSSetKeepTopic("KEEPTOPIC")); + c->AddSubcommand(&commandcssetkeeptopic); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(new CommandCSSASetKeepTopic("KEEPTOPIC")); + c->AddSubcommand(&commandcssasetkeeptopic); } ~CSSetKeepTopic() { Command *c = FindCommand(ChanServ, "SET"); if (c) - c->DelSubcommand("KEEPTOPIC"); + c->DelSubcommand(&commandcssetkeeptopic); c = FindCommand(ChanServ, "SASET"); if (c) - c->DelSubcommand("KEEPTOPIC"); + c->DelSubcommand(&commandcssasetkeeptopic); } }; diff --git a/modules/core/cs_set_mlock.cpp b/modules/core/cs_set_mlock.cpp index ec41913b9..263f7e477 100644 --- a/modules/core/cs_set_mlock.cpp +++ b/modules/core/cs_set_mlock.cpp @@ -16,7 +16,7 @@ class CommandCSSetMLock : public Command { public: - CommandCSSetMLock(const Anope::string &cname, const Anope::string &cpermission = "") : Command(cname, 1, 0, cpermission) + CommandCSSetMLock(const Anope::string &cpermission = "") : Command("MLOCK", 1, 0, cpermission) { } @@ -133,7 +133,7 @@ class CommandCSSetMLock : public Command class CommandCSSASetMLock : public CommandCSSetMLock { public: - CommandCSSASetMLock(const Anope::string &cname) : CommandCSSetMLock(cname, "chanserv/saset/mlock") + CommandCSSASetMLock() : CommandCSSetMLock("chanserv/saset/mlock") { } @@ -152,6 +152,9 @@ class CommandCSSASetMLock : public CommandCSSetMLock class CSSetMLock : public Module { + CommandCSSetMLock commandcssetmlock; + CommandCSSASetMLock commandcssasetmlock; + public: CSSetMLock(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -160,22 +163,22 @@ class CSSetMLock : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(new CommandCSSetMLock("MLOCK")); + c->AddSubcommand(&commandcssetmlock); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(new CommandCSSASetMLock("MLOCK")); + c->AddSubcommand(&commandcssasetmlock); } ~CSSetMLock() { Command *c = FindCommand(ChanServ, "SET"); if (c) - c->DelSubcommand("MLOCK"); + c->DelSubcommand(&commandcssetmlock); c = FindCommand(ChanServ, "SASET"); if (c) - c->DelSubcommand("MLOCK"); + c->DelSubcommand(&commandcssasetmlock); } }; diff --git a/modules/core/cs_set_opnotice.cpp b/modules/core/cs_set_opnotice.cpp index 2b835451c..69db85109 100644 --- a/modules/core/cs_set_opnotice.cpp +++ b/modules/core/cs_set_opnotice.cpp @@ -16,7 +16,7 @@ class CommandCSSetOpNotice : public Command { public: - CommandCSSetOpNotice(const Anope::string &cname, const Anope::string &cpermission = "") : Command(cname, 2, 2, cpermission) + CommandCSSetOpNotice(const Anope::string &cpermission = "") : Command("OPNOTICE", 2, 2, cpermission) { } @@ -62,7 +62,7 @@ class CommandCSSetOpNotice : public Command class CommandCSSASetOpNotice : public CommandCSSetOpNotice { public: - CommandCSSASetOpNotice(const Anope::string &cname) : CommandCSSetOpNotice(cname, "chanserv/saset/opnotice") + CommandCSSASetOpNotice() : CommandCSSetOpNotice("chanserv/saset/opnotice") { } @@ -80,6 +80,9 @@ class CommandCSSASetOpNotice : public CommandCSSetOpNotice class CSSetOpNotice : public Module { + CommandCSSetOpNotice commandcssetopnotice; + CommandCSSASetOpNotice commandcssasetopnotice; + public: CSSetOpNotice(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -88,22 +91,22 @@ class CSSetOpNotice : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(new CommandCSSetOpNotice("OPNOTICE")); + c->AddSubcommand(&commandcssetopnotice); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(new CommandCSSASetOpNotice("OPNOTICE")); + c->AddSubcommand(&commandcssasetopnotice); } ~CSSetOpNotice() { Command *c = FindCommand(ChanServ, "SET"); if (c) - c->DelSubcommand("OPNOTICE"); + c->DelSubcommand(&commandcssetopnotice); c = FindCommand(ChanServ, "SASET"); if (c) - c->DelSubcommand("OPNOTICE"); + c->DelSubcommand(&commandcssasetopnotice); } }; diff --git a/modules/core/cs_set_peace.cpp b/modules/core/cs_set_peace.cpp index aa058b416..f8c21132a 100644 --- a/modules/core/cs_set_peace.cpp +++ b/modules/core/cs_set_peace.cpp @@ -16,7 +16,7 @@ class CommandCSSetPeace : public Command { public: - CommandCSSetPeace(const Anope::string &cname, const Anope::string &cpermission = "") : Command(cname, 2, 2, cpermission) + CommandCSSetPeace(const Anope::string &cpermission = "") : Command("PEACE", 2, 2, cpermission) { } @@ -62,7 +62,7 @@ class CommandCSSetPeace : public Command class CommandCSSASetPeace : public CommandCSSetPeace { public: - CommandCSSASetPeace(const Anope::string &cname) : CommandCSSetPeace(cname, "chanserv/saset/peace") + CommandCSSASetPeace() : CommandCSSetPeace("chanserv/saset/peace") { } @@ -80,6 +80,9 @@ class CommandCSSASetPeace : public CommandCSSetPeace class CSSetPeace : public Module { + CommandCSSetPeace commandcssetpeace; + CommandCSSASetPeace commandcssasetpeace; + public: CSSetPeace(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -88,22 +91,22 @@ class CSSetPeace : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(new CommandCSSetPeace("PEACE")); + c->AddSubcommand(&commandcssetpeace); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(new CommandCSSASetPeace("PEACE")); + c->AddSubcommand(&commandcssasetpeace); } ~CSSetPeace() { Command *c = FindCommand(ChanServ, "SET"); if (c) - c->DelSubcommand("PEACE"); + c->DelSubcommand(&commandcssetpeace); c = FindCommand(ChanServ, "SASET"); if (c) - c->DelSubcommand("PEACE"); + c->DelSubcommand(&commandcssasetpeace); } }; diff --git a/modules/core/cs_set_persist.cpp b/modules/core/cs_set_persist.cpp index 2ab310f2a..4b650327d 100644 --- a/modules/core/cs_set_persist.cpp +++ b/modules/core/cs_set_persist.cpp @@ -16,7 +16,7 @@ class CommandCSSetPersist : public Command { public: - CommandCSSetPersist(const Anope::string &cname, const Anope::string &cpermission = "") : Command(cname, 2, 2, cpermission) + CommandCSSetPersist(const Anope::string &cpermission = "") : Command("PERSIST", 2, 2, cpermission) { } @@ -107,7 +107,7 @@ class CommandCSSetPersist : public Command class CommandCSSASetPersist : public CommandCSSetPersist { public: - CommandCSSASetPersist(const Anope::string &cname) : CommandCSSetPersist(cname, "chanserv/saset/persist") + CommandCSSASetPersist() : CommandCSSetPersist("chanserv/saset/persist") { } @@ -125,6 +125,9 @@ class CommandCSSASetPersist : public CommandCSSetPersist class CSSetPersist : public Module { + CommandCSSetPersist commandcssetpeace; + CommandCSSASetPersist commandcssasetpeace; + public: CSSetPersist(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -133,22 +136,22 @@ class CSSetPersist : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(new CommandCSSetPersist("PERSIST")); + c->AddSubcommand(&commandcssetpeace); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(new CommandCSSASetPersist("PERSIST")); + c->AddSubcommand(&commandcssasetpeace); } ~CSSetPersist() { Command *c = FindCommand(ChanServ, "SET"); if (c) - c->DelSubcommand("PERSIST"); + c->DelSubcommand(&commandcssetpeace); c = FindCommand(ChanServ, "SASET"); if (c) - c->DelSubcommand("PERSIST"); + c->DelSubcommand(&commandcssasetpeace); } }; diff --git a/modules/core/cs_set_private.cpp b/modules/core/cs_set_private.cpp index 7d1cd0d82..68ed17fa5 100644 --- a/modules/core/cs_set_private.cpp +++ b/modules/core/cs_set_private.cpp @@ -16,7 +16,7 @@ class CommandCSSetPrivate : public Command { public: - CommandCSSetPrivate(const Anope::string &cname, const Anope::string &cpermission = "") : Command(cname, 2, 2, cpermission) + CommandCSSetPrivate(const Anope::string &cpermission = "") : Command("PRIVATE", 2, 2, cpermission) { } @@ -62,7 +62,7 @@ class CommandCSSetPrivate : public Command class CommandCSSASetPrivate : public CommandCSSetPrivate { public: - CommandCSSASetPrivate(const Anope::string &cname) : CommandCSSetPrivate(cname, "chanserv/saset/private") + CommandCSSASetPrivate() : CommandCSSetPrivate("chanserv/saset/private") { } @@ -80,6 +80,9 @@ class CommandCSSASetPrivate : public CommandCSSetPrivate class CSSetPrivate : public Module { + CommandCSSetPrivate commandcssetprivate; + CommandCSSASetPrivate commandcssasetprivate; + public: CSSetPrivate(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -88,22 +91,22 @@ class CSSetPrivate : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(new CommandCSSetPrivate("PRIVATE")); + c->AddSubcommand(&commandcssetprivate); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(new CommandCSSASetPrivate("PRIVATE")); + c->AddSubcommand(&commandcssasetprivate); } ~CSSetPrivate() { Command *c = FindCommand(ChanServ, "SET"); if (c) - c->DelSubcommand("PRIVATE"); + c->DelSubcommand(&commandcssetprivate); c = FindCommand(ChanServ, "SASET"); if (c) - c->DelSubcommand("PRIVATE"); + c->DelSubcommand(&commandcssasetprivate); } }; diff --git a/modules/core/cs_set_restricted.cpp b/modules/core/cs_set_restricted.cpp index e51024baa..23531c80b 100644 --- a/modules/core/cs_set_restricted.cpp +++ b/modules/core/cs_set_restricted.cpp @@ -15,7 +15,7 @@ class CommandCSSetRestricted : public Command { public: - CommandCSSetRestricted(const Anope::string &cname, const Anope::string &cpermission = "") : Command(cname, 2, 2, cpermission) + CommandCSSetRestricted(const Anope::string &cpermission = "") : Command("RESTRICTED", 2, 2, cpermission) { } @@ -65,7 +65,7 @@ class CommandCSSetRestricted : public Command class CommandCSSASetRestricted : public CommandCSSetRestricted { public: - CommandCSSASetRestricted(const Anope::string &cname) : CommandCSSetRestricted(cname, "chanserv/saset/restricted") + CommandCSSASetRestricted() : CommandCSSetRestricted("chanserv/saset/restricted") { } @@ -83,6 +83,9 @@ class CommandCSSASetRestricted : public CommandCSSetRestricted class CSSetRestricted : public Module { + CommandCSSetRestricted commandcssetrestricted; + CommandCSSASetRestricted commandcssasetrestricted; + public: CSSetRestricted(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -91,22 +94,22 @@ class CSSetRestricted : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(new CommandCSSetRestricted("RESTRICTED")); + c->AddSubcommand(&commandcssetrestricted); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(new CommandCSSASetRestricted("RESTRICTED")); + c->AddSubcommand(&commandcssasetrestricted); } ~CSSetRestricted() { Command *c = FindCommand(ChanServ, "SET"); if (c) - c->DelSubcommand("RESTRICTED"); + c->DelSubcommand(&commandcssetrestricted); c = FindCommand(ChanServ, "SASET"); if (c) - c->DelSubcommand("RESTRICTED"); + c->DelSubcommand(&commandcssasetrestricted); } }; diff --git a/modules/core/cs_set_secure.cpp b/modules/core/cs_set_secure.cpp index 98babf1d7..9e25c45be 100644 --- a/modules/core/cs_set_secure.cpp +++ b/modules/core/cs_set_secure.cpp @@ -16,7 +16,7 @@ class CommandCSSetSecure : public Command { public: - CommandCSSetSecure(const Anope::string &cname, const Anope::string &cpermission = "") : Command(cname, 2, 2, cpermission) + CommandCSSetSecure(const Anope::string &cpermission = "") : Command("SECURE", 2, 2, cpermission) { } @@ -62,7 +62,7 @@ class CommandCSSetSecure : public Command class CommandCSSASetSecure : public CommandCSSetSecure { public: - CommandCSSASetSecure(const Anope::string &cname) : CommandCSSetSecure(cname, "chanserv/saset/secure") + CommandCSSASetSecure() : CommandCSSetSecure("chanserv/saset/secure") { } @@ -80,6 +80,9 @@ class CommandCSSASetSecure : public CommandCSSetSecure class CSSetSecure : public Module { + CommandCSSetSecure commandcssetsecure; + CommandCSSASetSecure commandcssasetsecure; + public: CSSetSecure(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -88,22 +91,22 @@ class CSSetSecure : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(new CommandCSSetSecure("SECURE")); + c->AddSubcommand(&commandcssetsecure); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(new CommandCSSASetSecure("SECURE")); + c->AddSubcommand(&commandcssasetsecure); } ~CSSetSecure() { Command *c = FindCommand(ChanServ, "SET"); if (c) - c->DelSubcommand("SECURE"); + c->DelSubcommand(&commandcssetsecure); c = FindCommand(ChanServ, "SASET"); if (c) - c->DelSubcommand("SECURE"); + c->DelSubcommand(&commandcssasetsecure); } }; diff --git a/modules/core/cs_set_securefounder.cpp b/modules/core/cs_set_securefounder.cpp index d6ef6aef8..bf2db2048 100644 --- a/modules/core/cs_set_securefounder.cpp +++ b/modules/core/cs_set_securefounder.cpp @@ -16,7 +16,7 @@ class CommandCSSetSecureFounder : public Command { public: - CommandCSSetSecureFounder(const Anope::string &cname, const Anope::string &cpermission = "") : Command(cname, 2, 2, cpermission) + CommandCSSetSecureFounder(const Anope::string &cpermission = "") : Command("SECUREFOUNDER", 2, 2, cpermission) { } @@ -68,7 +68,7 @@ class CommandCSSetSecureFounder : public Command class CommandCSSASetSecureFounder : public CommandCSSetSecureFounder { public: - CommandCSSASetSecureFounder(const Anope::string &cname) : CommandCSSetSecureFounder(cname, "chanserv/saset/securefounder") + CommandCSSASetSecureFounder() : CommandCSSetSecureFounder("chanserv/saset/securefounder") { } @@ -86,6 +86,9 @@ class CommandCSSASetSecureFounder : public CommandCSSetSecureFounder class CSSetSecureFounder : public Module { + CommandCSSetSecureFounder commandcssetsecurefounder; + CommandCSSASetSecureFounder commandcssasetsecurefounder; + public: CSSetSecureFounder(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -94,22 +97,22 @@ class CSSetSecureFounder : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(new CommandCSSetSecureFounder("SECUREFOUNDER")); + c->AddSubcommand(&commandcssetsecurefounder); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(new CommandCSSASetSecureFounder("SECUREFOUNDER")); + c->AddSubcommand(&commandcssasetsecurefounder); } ~CSSetSecureFounder() { Command *c = FindCommand(ChanServ, "SET"); if (c) - c->DelSubcommand("SECUREFOUNDER"); + c->DelSubcommand(&commandcssetsecurefounder); c = FindCommand(ChanServ, "SASET"); if (c) - c->DelSubcommand("SECUREFOUNDER"); + c->DelSubcommand(&commandcssasetsecurefounder); } }; diff --git a/modules/core/cs_set_secureops.cpp b/modules/core/cs_set_secureops.cpp index c9367dae7..d0c4554f6 100644 --- a/modules/core/cs_set_secureops.cpp +++ b/modules/core/cs_set_secureops.cpp @@ -16,7 +16,7 @@ class CommandCSSetSecureOps : public Command { public: - CommandCSSetSecureOps(const Anope::string &cname, const Anope::string &cpermission = "") : Command(cname, 2, 2, cpermission) + CommandCSSetSecureOps(const Anope::string &cpermission = "") : Command("SECUREOPS", 2, 2, cpermission) { } @@ -62,7 +62,7 @@ class CommandCSSetSecureOps : public Command class CommandCSSASetSecureOps : public CommandCSSetSecureOps { public: - CommandCSSASetSecureOps(const Anope::string &cname) : CommandCSSetSecureOps(cname, "chanserv/saset/secureops") + CommandCSSASetSecureOps() : CommandCSSetSecureOps("chanserv/saset/secureops") { } @@ -80,6 +80,9 @@ class CommandCSSASetSecureOps : public CommandCSSetSecureOps class CSSetSecureOps : public Module { + CommandCSSetSecureOps commandcssetsecureops; + CommandCSSASetSecureOps commandcssasetsecureops; + public: CSSetSecureOps(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -88,22 +91,22 @@ class CSSetSecureOps : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(new CommandCSSetSecureOps("SECUREOPS")); + c->AddSubcommand(&commandcssetsecureops); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(new CommandCSSASetSecureOps("SECUREOPS")); + c->AddSubcommand(&commandcssasetsecureops); } ~CSSetSecureOps() { Command *c = FindCommand(ChanServ, "SET"); if (c) - c->DelSubcommand("SECUREOPS"); + c->DelSubcommand(&commandcssetsecureops); c = FindCommand(ChanServ, "SASET"); if (c) - c->DelSubcommand("SECUREOPS"); + c->DelSubcommand(&commandcssasetsecureops); } }; diff --git a/modules/core/cs_set_signkick.cpp b/modules/core/cs_set_signkick.cpp index d62a5eec4..c0d39d7cf 100644 --- a/modules/core/cs_set_signkick.cpp +++ b/modules/core/cs_set_signkick.cpp @@ -16,7 +16,7 @@ class CommandCSSetSignKick : public Command { public: - CommandCSSetSignKick(const Anope::string &cname, const Anope::string &cpermission = "") : Command(cname, 2, 2, cpermission) + CommandCSSetSignKick(const Anope::string &cpermission = "") : Command("SIGNKICK", 2, 2, cpermission) { } @@ -70,7 +70,7 @@ class CommandCSSetSignKick : public Command class CommandCSSASetSignKick : public CommandCSSetSignKick { public: - CommandCSSASetSignKick(const Anope::string &cname) : CommandCSSetSignKick(cname, "chanserv/saset/signkick") + CommandCSSASetSignKick() : CommandCSSetSignKick("chanserv/saset/signkick") { } @@ -88,6 +88,9 @@ class CommandCSSASetSignKick : public CommandCSSetSignKick class CSSetSignKick : public Module { + CommandCSSetSignKick commandcssetsignkick; + CommandCSSASetSignKick commandcssasetsignkick; + public: CSSetSignKick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -96,22 +99,22 @@ class CSSetSignKick : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(new CommandCSSetSignKick("SIGNKICK")); + c->AddSubcommand(&commandcssetsignkick); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(new CommandCSSASetSignKick("SIGNKICK")); + c->AddSubcommand(&commandcssasetsignkick); } ~CSSetSignKick() { Command *c = FindCommand(ChanServ, "SET"); if (c) - c->DelSubcommand("SIGNKICK"); + c->DelSubcommand(&commandcssetsignkick); c = FindCommand(ChanServ, "SASET"); if (c) - c->DelSubcommand("SIGNKICK"); + c->DelSubcommand(&commandcssasetsignkick); } }; diff --git a/modules/core/cs_set_successor.cpp b/modules/core/cs_set_successor.cpp index c0c913487..10ae237a7 100644 --- a/modules/core/cs_set_successor.cpp +++ b/modules/core/cs_set_successor.cpp @@ -16,7 +16,7 @@ class CommandCSSetSuccessor : public Command { public: - CommandCSSetSuccessor(const Anope::string &cname, const Anope::string &cpermission = "") : Command(cname, 1, 2, cpermission) + CommandCSSetSuccessor(const Anope::string &cpermission = "") : Command("SUCCESSOR", 1, 2, cpermission) { } @@ -91,7 +91,7 @@ class CommandCSSetSuccessor : public Command class CommandCSSASetSuccessor : public CommandCSSetSuccessor { public: - CommandCSSASetSuccessor(const Anope::string &cname) : CommandCSSetSuccessor(cname, "chanserv/saset/successor") + CommandCSSASetSuccessor() : CommandCSSetSuccessor("chanserv/saset/successor") { } @@ -110,6 +110,9 @@ class CommandCSSASetSuccessor : public CommandCSSetSuccessor class CSSetSuccessor : public Module { + CommandCSSetSuccessor commandcssetsuccessor; + CommandCSSASetSuccessor commandcssasetsuccessor; + public: CSSetSuccessor(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -118,22 +121,22 @@ class CSSetSuccessor : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(new CommandCSSetSuccessor("SUCCESSOR")); + c->AddSubcommand(&commandcssetsuccessor); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(new CommandCSSetSuccessor("SUCCESSOR")); + c->AddSubcommand(&commandcssasetsuccessor); } ~CSSetSuccessor() { Command *c = FindCommand(ChanServ, "SET"); if (c) - c->DelSubcommand("SUCCESSOR"); + c->DelSubcommand(&commandcssetsuccessor); c = FindCommand(ChanServ, "SASET"); if (c) - c->DelSubcommand("SUCCESSOR"); + c->DelSubcommand(&commandcssasetsuccessor); } }; diff --git a/modules/core/cs_set_topiclock.cpp b/modules/core/cs_set_topiclock.cpp index b60a687b4..44ae5390c 100644 --- a/modules/core/cs_set_topiclock.cpp +++ b/modules/core/cs_set_topiclock.cpp @@ -16,7 +16,7 @@ class CommandCSSetTopicLock : public Command { public: - CommandCSSetTopicLock(const Anope::string &cname, const Anope::string &cpermission = "") : Command(cname, 2, 2, cpermission) + CommandCSSetTopicLock(const Anope::string &cpermission = "") : Command("TOPICLOCK", 2, 2, cpermission) { } @@ -62,7 +62,7 @@ class CommandCSSetTopicLock : public Command class CommandCSSASetTopicLock : public CommandCSSetTopicLock { public: - CommandCSSASetTopicLock(const Anope::string &cname) : CommandCSSetTopicLock(cname, "chanserv/saset/topiclock") + CommandCSSASetTopicLock() : CommandCSSetTopicLock("chanserv/saset/topiclock") { } @@ -80,6 +80,9 @@ class CommandCSSASetTopicLock : public CommandCSSetTopicLock class CSSetTopicLock : public Module { + CommandCSSetTopicLock commandcssettopiclock; + CommandCSSASetTopicLock commandcssasettopiclock; + public: CSSetTopicLock(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -88,22 +91,22 @@ class CSSetTopicLock : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(new CommandCSSetTopicLock("TOPICLOCK")); + c->AddSubcommand(&commandcssettopiclock); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(new CommandCSSASetTopicLock("TOPICLOCK")); + c->AddSubcommand(&commandcssasettopiclock); } ~CSSetTopicLock() { Command *c = FindCommand(ChanServ, "SET"); if (c) - c->DelSubcommand("TOPICLOCK"); + c->DelSubcommand(&commandcssettopiclock); c = FindCommand(ChanServ, "SASET"); if (c) - c->DelSubcommand("TOPICLOCK"); + c->DelSubcommand(&commandcssasettopiclock); } }; diff --git a/modules/core/cs_set_xop.cpp b/modules/core/cs_set_xop.cpp index c7d4017b0..1c4c2f431 100644 --- a/modules/core/cs_set_xop.cpp +++ b/modules/core/cs_set_xop.cpp @@ -17,7 +17,7 @@ class CommandCSSetXOP : public Command { public: - CommandCSSetXOP(const Anope::string &cname, const Anope::string &cpermission = "") : Command(cname, 2, 2, cpermission) + CommandCSSetXOP(const Anope::string &cpermission = "") : Command("XOP", 2, 2, cpermission) { } @@ -100,7 +100,7 @@ class CommandCSSetXOP : public Command class CommandCSSASetXOP : public CommandCSSetXOP { public: - CommandCSSASetXOP(const Anope::string &cname) : CommandCSSetXOP(cname, "chanserv/saset/xop") + CommandCSSASetXOP() : CommandCSSetXOP("chanserv/saset/xop") { } @@ -118,6 +118,9 @@ class CommandCSSASetXOP : public CommandCSSetXOP class CSSetXOP : public Module { + CommandCSSetXOP commandcssetxop; + CommandCSSASetXOP commandcssasetxop; + public: CSSetXOP(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -126,22 +129,22 @@ class CSSetXOP : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(new CommandCSSetXOP("XOP")); + c->AddSubcommand(&commandcssetxop); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(new CommandCSSASetXOP("XOP")); + c->AddSubcommand(&commandcssasetxop); } ~CSSetXOP() { Command *c = FindCommand(ChanServ, "SET"); if (c) - c->DelSubcommand("XOP"); + c->DelSubcommand(&commandcssetxop); c = FindCommand(ChanServ, "SASET"); if (c) - c->DelSubcommand("XOP"); + c->DelSubcommand(&commandcssasetxop); } }; diff --git a/modules/core/cs_status.cpp b/modules/core/cs_status.cpp index 01c95796d..0d41a5481 100644 --- a/modules/core/cs_status.cpp +++ b/modules/core/cs_status.cpp @@ -63,13 +63,15 @@ class CommandCSStatus : public Command class CSStatus : public Module { + CommandCSStatus commandcsstatus; + public: CSStatus(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(ChanServ, new CommandCSStatus()); + this->AddCommand(ChanServ, &commandcsstatus); } }; diff --git a/modules/core/cs_suspend.cpp b/modules/core/cs_suspend.cpp index 53bbaec92..24a7019f4 100644 --- a/modules/core/cs_suspend.cpp +++ b/modules/core/cs_suspend.cpp @@ -173,14 +173,17 @@ class CommandCSUnSuspend : public Command class CSSuspend : public Module { + CommandCSSuspend commandcssuspend; + CommandCSUnSuspend commandcsunsuspend; + public: CSSuspend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(ChanServ, new CommandCSSuspend()); - this->AddCommand(ChanServ, new CommandCSUnSuspend()); + this->AddCommand(ChanServ, &commandcssuspend); + this->AddCommand(ChanServ, &commandcsunsuspend); } }; diff --git a/modules/core/cs_topic.cpp b/modules/core/cs_topic.cpp index d0a6843b5..913ceb239 100644 --- a/modules/core/cs_topic.cpp +++ b/modules/core/cs_topic.cpp @@ -81,13 +81,15 @@ class CommandCSTopic : public Command class CSTopic : public Module { + CommandCSTopic commandcstopic; + public: CSTopic(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(ChanServ, new CommandCSTopic()); + this->AddCommand(ChanServ, &commandcstopic); } }; diff --git a/modules/core/cs_unban.cpp b/modules/core/cs_unban.cpp index 0d248b8eb..9b9360f23 100644 --- a/modules/core/cs_unban.cpp +++ b/modules/core/cs_unban.cpp @@ -75,13 +75,15 @@ class CommandCSUnban : public Command class CSUnban : public Module { + CommandCSUnban commandcsunban; + public: CSUnban(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(ChanServ, new CommandCSUnban()); + this->AddCommand(ChanServ, &commandcsunban); } }; diff --git a/modules/core/cs_xop.cpp b/modules/core/cs_xop.cpp index ca11c74fe..b9b271ea3 100644 --- a/modules/core/cs_xop.cpp +++ b/modules/core/cs_xop.cpp @@ -626,15 +626,21 @@ class CommandCSVOP : public XOPBase class CSXOP : public Module { + CommandCSQOP commandcsqop; + CommandCSSOP commandcssop; + CommandCSAOP commandcsaop; + CommandCSHOP commandcshop; + CommandCSVOP commandcsvop; + public: CSXOP(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(ChanServ, new CommandCSSOP()); - this->AddCommand(ChanServ, new CommandCSAOP()); - this->AddCommand(ChanServ, new CommandCSVOP()); + this->AddCommand(ChanServ, &commandcssop); + this->AddCommand(ChanServ, &commandcsaop); + this->AddCommand(ChanServ, &commandcsvop); if (Me && Me->IsSynced()) OnUplinkSync(NULL); @@ -646,15 +652,15 @@ class CSXOP : public Module void OnUplinkSync(Server *) { if (ModeManager::FindChannelModeByName(CMODE_OWNER)) - this->AddCommand(ChanServ, new CommandCSQOP()); + this->AddCommand(ChanServ, &commandcsqop); if (ModeManager::FindChannelModeByName(CMODE_HALFOP)) - this->AddCommand(ChanServ, new CommandCSHOP()); + this->AddCommand(ChanServ, &commandcshop); } void OnServerDisconnect() { - this->DelCommand(ChanServ, FindCommand(ChanServ, "QOP")); - this->DelCommand(ChanServ, FindCommand(ChanServ, "HOP")); + this->DelCommand(ChanServ, &commandcsqop); + this->DelCommand(ChanServ, &commandcshop); } }; diff --git a/modules/core/hs_del.cpp b/modules/core/hs_del.cpp index a35b349a6..3030a7a27 100644 --- a/modules/core/hs_del.cpp +++ b/modules/core/hs_del.cpp @@ -60,13 +60,15 @@ class CommandHSDel : public Command class HSDel : public Module { + CommandHSDel commandhsdel; + public: HSDel(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(HostServ, new CommandHSDel()); + this->AddCommand(HostServ, &commandhsdel); } }; diff --git a/modules/core/hs_delall.cpp b/modules/core/hs_delall.cpp index b91ac1a4f..328b77854 100644 --- a/modules/core/hs_delall.cpp +++ b/modules/core/hs_delall.cpp @@ -65,13 +65,15 @@ class CommandHSDelAll : public Command class HSDelAll : public Module { + CommandHSDelAll commandhsdelall; + public: HSDelAll(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(HostServ, new CommandHSDelAll()); + this->AddCommand(HostServ, &commandhsdelall); } }; diff --git a/modules/core/hs_group.cpp b/modules/core/hs_group.cpp index 3aa0fc3c4..00a30cb54 100644 --- a/modules/core/hs_group.cpp +++ b/modules/core/hs_group.cpp @@ -51,13 +51,15 @@ class CommandHSGroup : public Command class HSGroup : public Module { + CommandHSGroup commandhsgroup; + public: HSGroup(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(HostServ, new CommandHSGroup()); + this->AddCommand(HostServ, &commandhsgroup); } }; diff --git a/modules/core/hs_help.cpp b/modules/core/hs_help.cpp index 4645590f5..78480651a 100644 --- a/modules/core/hs_help.cpp +++ b/modules/core/hs_help.cpp @@ -38,13 +38,15 @@ class CommandHSHelp : public Command class HSHelp : public Module { + CommandHSHelp commandhshelp; + public: HSHelp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(HostServ, new CommandHSHelp()); + this->AddCommand(HostServ, &commandhshelp); } }; diff --git a/modules/core/hs_list.cpp b/modules/core/hs_list.cpp index 9bb01e3c7..d85ace345 100644 --- a/modules/core/hs_list.cpp +++ b/modules/core/hs_list.cpp @@ -119,13 +119,15 @@ class CommandHSList : public Command class HSList : public Module { + CommandHSList commandhslist; + public: HSList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(HostServ, new CommandHSList()); + this->AddCommand(HostServ, &commandhslist); } }; diff --git a/modules/core/hs_off.cpp b/modules/core/hs_off.cpp index 187854188..ed64e2368 100644 --- a/modules/core/hs_off.cpp +++ b/modules/core/hs_off.cpp @@ -49,13 +49,15 @@ class CommandHSOff : public Command class HSOff : public Module { + CommandHSOff commandhsoff; + public: HSOff(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(HostServ, new CommandHSOff()); + this->AddCommand(HostServ, &commandhsoff); } }; diff --git a/modules/core/hs_on.cpp b/modules/core/hs_on.cpp index 25c21f8ec..1cc38e3f8 100644 --- a/modules/core/hs_on.cpp +++ b/modules/core/hs_on.cpp @@ -59,13 +59,15 @@ class CommandHSOn : public Command class HSOn : public Module { + CommandHSOn commandhson; + public: HSOn(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(HostServ, new CommandHSOn()); + this->AddCommand(HostServ, &commandhson); } }; diff --git a/modules/core/hs_set.cpp b/modules/core/hs_set.cpp index e492e9ff5..604593e34 100644 --- a/modules/core/hs_set.cpp +++ b/modules/core/hs_set.cpp @@ -114,13 +114,15 @@ class CommandHSSet : public Command class HSSet : public Module { + CommandHSSet commandhsset; + public: HSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(HostServ, new CommandHSSet()); + this->AddCommand(HostServ, &commandhsset); } }; diff --git a/modules/core/hs_setall.cpp b/modules/core/hs_setall.cpp index adf2f9610..9bf6369fe 100644 --- a/modules/core/hs_setall.cpp +++ b/modules/core/hs_setall.cpp @@ -117,13 +117,15 @@ class CommandHSSetAll : public Command class HSSetAll : public Module { + CommandHSSetAll commandhssetall; + public: HSSetAll(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(HostServ, new CommandHSSetAll()); + this->AddCommand(HostServ, &commandhssetall); } }; diff --git a/modules/core/ms_cancel.cpp b/modules/core/ms_cancel.cpp index 9e3c52417..3a170d812 100644 --- a/modules/core/ms_cancel.cpp +++ b/modules/core/ms_cancel.cpp @@ -75,13 +75,15 @@ class CommandMSCancel : public Command class MSCancel : public Module { + CommandMSCancel commandmscancel; + public: MSCancel(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(MemoServ, new CommandMSCancel()); + this->AddCommand(MemoServ, &commandmscancel); } }; diff --git a/modules/core/ms_check.cpp b/modules/core/ms_check.cpp index 9f237fa15..299be5302 100644 --- a/modules/core/ms_check.cpp +++ b/modules/core/ms_check.cpp @@ -93,13 +93,15 @@ class CommandMSCheck : public Command class MSCheck : public Module { + CommandMSCheck commandmscheck; + public: MSCheck(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(MemoServ, new CommandMSCheck()); + this->AddCommand(MemoServ, &commandmscheck); } }; diff --git a/modules/core/ms_del.cpp b/modules/core/ms_del.cpp index f6e21269e..8d5b45c04 100644 --- a/modules/core/ms_del.cpp +++ b/modules/core/ms_del.cpp @@ -146,13 +146,15 @@ class CommandMSDel : public Command class MSDel : public Module { + CommandMSDel commandmsdel; + public: MSDel(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(MemoServ, new CommandMSDel()); + this->AddCommand(MemoServ, &commandmsdel); } }; diff --git a/modules/core/ms_help.cpp b/modules/core/ms_help.cpp index 793006a60..535b051f0 100644 --- a/modules/core/ms_help.cpp +++ b/modules/core/ms_help.cpp @@ -39,13 +39,15 @@ class CommandMSHelp : public Command class MSHelp : public Module { + CommandMSHelp commandmshelp; + public: MSHelp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(MemoServ, new CommandMSHelp()); + this->AddCommand(MemoServ, &commandmshelp); } }; diff --git a/modules/core/ms_info.cpp b/modules/core/ms_info.cpp index f5a3f8c4c..89b816a60 100644 --- a/modules/core/ms_info.cpp +++ b/modules/core/ms_info.cpp @@ -202,13 +202,15 @@ class CommandMSInfo : public Command class MSInfo : public Module { + CommandMSInfo commandmsinfo; + public: MSInfo(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(MemoServ, new CommandMSInfo()); + this->AddCommand(MemoServ, &commandmsinfo); } }; diff --git a/modules/core/ms_list.cpp b/modules/core/ms_list.cpp index bf6eda5f9..d3dcde4f6 100644 --- a/modules/core/ms_list.cpp +++ b/modules/core/ms_list.cpp @@ -163,13 +163,15 @@ class CommandMSList : public Command class MSList : public Module { + CommandMSList commandmslist; + public: MSList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(MemoServ, new CommandMSList()); + this->AddCommand(MemoServ, &commandmslist); } }; diff --git a/modules/core/ms_read.cpp b/modules/core/ms_read.cpp index d2593daf1..5f25230e3 100644 --- a/modules/core/ms_read.cpp +++ b/modules/core/ms_read.cpp @@ -146,13 +146,15 @@ class CommandMSRead : public Command class MSRead : public Module { + CommandMSRead commandmsread; + public: MSRead(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(MemoServ, new CommandMSRead()); + this->AddCommand(MemoServ, &commandmsread); } }; diff --git a/modules/core/ms_rsend.cpp b/modules/core/ms_rsend.cpp index 1caa9fe74..ed0c51998 100644 --- a/modules/core/ms_rsend.cpp +++ b/modules/core/ms_rsend.cpp @@ -73,6 +73,8 @@ class CommandMSRSend : public Command class MSRSend : public Module { + CommandMSRSend commandmsrsend; + public: MSRSend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -82,7 +84,7 @@ class MSRSend : public Module this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(MemoServ, new CommandMSRSend()); + this->AddCommand(MemoServ, &commandmsrsend); } }; diff --git a/modules/core/ms_send.cpp b/modules/core/ms_send.cpp index fd2f3636c..67fe265d1 100644 --- a/modules/core/ms_send.cpp +++ b/modules/core/ms_send.cpp @@ -47,13 +47,15 @@ class CommandMSSend : public Command class MSSend : public Module { + CommandMSSend commandmssend; + public: MSSend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(MemoServ, new CommandMSSend()); + this->AddCommand(MemoServ, &commandmssend); } }; diff --git a/modules/core/ms_sendall.cpp b/modules/core/ms_sendall.cpp index 35efd2f1e..aa19cfb6c 100644 --- a/modules/core/ms_sendall.cpp +++ b/modules/core/ms_sendall.cpp @@ -63,13 +63,15 @@ class CommandMSSendAll : public Command class MSSendAll : public Module { + CommandMSSendAll commandmssendall; + public: MSSendAll(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(MemoServ, new CommandMSSendAll()); + this->AddCommand(MemoServ, &commandmssendall); } }; diff --git a/modules/core/ms_set.cpp b/modules/core/ms_set.cpp index 58f33b1ee..f0abdc5de 100644 --- a/modules/core/ms_set.cpp +++ b/modules/core/ms_set.cpp @@ -260,13 +260,15 @@ class CommandMSSet : public Command class MSSet : public Module { + CommandMSSet commandmsset; + public: MSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(MemoServ, new CommandMSSet()); + this->AddCommand(MemoServ, &commandmsset); } }; diff --git a/modules/core/ms_staff.cpp b/modules/core/ms_staff.cpp index 7f81aafe2..a53289610 100644 --- a/modules/core/ms_staff.cpp +++ b/modules/core/ms_staff.cpp @@ -60,13 +60,15 @@ class CommandMSStaff : public Command class MSStaff : public Module { + CommandMSStaff commandmsstaff; + public: MSStaff(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(MemoServ, new CommandMSStaff()); + this->AddCommand(MemoServ, &commandmsstaff); } }; diff --git a/modules/core/ns_access.cpp b/modules/core/ns_access.cpp index 4f74d182d..3e097427d 100644 --- a/modules/core/ns_access.cpp +++ b/modules/core/ns_access.cpp @@ -167,13 +167,15 @@ class CommandNSAccess : public Command class NSAccess : public Module { + CommandNSAccess commandnsaccess; + public: NSAccess(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSAccess()); + this->AddCommand(NickServ, &commandnsaccess); } }; diff --git a/modules/core/ns_alist.cpp b/modules/core/ns_alist.cpp index a7d4d7e4a..174b6fc80 100644 --- a/modules/core/ns_alist.cpp +++ b/modules/core/ns_alist.cpp @@ -137,13 +137,15 @@ class CommandNSAList : public Command class NSAList : public Module { + CommandNSAList commandnsalist; + public: NSAList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSAList()); + this->AddCommand(NickServ, &commandnsalist); } }; diff --git a/modules/core/ns_drop.cpp b/modules/core/ns_drop.cpp index e85b2cebb..d5758197a 100644 --- a/modules/core/ns_drop.cpp +++ b/modules/core/ns_drop.cpp @@ -114,13 +114,15 @@ class CommandNSDrop : public Command class NSDrop : public Module { + CommandNSDrop commandnsdrop; + public: NSDrop(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSDrop()); + this->AddCommand(NickServ, &commandnsdrop); } }; diff --git a/modules/core/ns_forbid.cpp b/modules/core/ns_forbid.cpp index ad313d62b..511ef3a2f 100644 --- a/modules/core/ns_forbid.cpp +++ b/modules/core/ns_forbid.cpp @@ -108,13 +108,15 @@ class CommandNSForbid : public Command class NSForbid : public Module { + CommandNSForbid commandnsforbid; + public: NSForbid(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSForbid()); + this->AddCommand(NickServ, &commandnsforbid); } }; diff --git a/modules/core/ns_getemail.cpp b/modules/core/ns_getemail.cpp index eeb3c705d..3cf795772 100644 --- a/modules/core/ns_getemail.cpp +++ b/modules/core/ns_getemail.cpp @@ -70,13 +70,14 @@ class CommandNSGetEMail : public Command class NSGetEMail : public Module { + CommandNSGetEMail commandnsgetemail; public: NSGetEMail(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSGetEMail()); + this->AddCommand(NickServ, &commandnsgetemail); } }; diff --git a/modules/core/ns_getpass.cpp b/modules/core/ns_getpass.cpp index 97654d2d5..e1e16d96b 100644 --- a/modules/core/ns_getpass.cpp +++ b/modules/core/ns_getpass.cpp @@ -77,6 +77,8 @@ class CommandNSGetPass : public Command class NSGetPass : public Module { + CommandNSGetPass commandnsgetpass; + public: NSGetPass(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -87,7 +89,7 @@ class NSGetPass : public Module this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSGetPass()); + this->AddCommand(NickServ, &commandnsgetpass); } }; diff --git a/modules/core/ns_ghost.cpp b/modules/core/ns_ghost.cpp index ac1e0787f..9fb82a9d4 100644 --- a/modules/core/ns_ghost.cpp +++ b/modules/core/ns_ghost.cpp @@ -90,13 +90,15 @@ class CommandNSGhost : public Command class NSGhost : public Module { + CommandNSGhost commandnsghost; + public: NSGhost(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSGhost()); + this->AddCommand(NickServ, &commandnsghost); } }; diff --git a/modules/core/ns_group.cpp b/modules/core/ns_group.cpp index 7cdac0a4f..574b5ae39 100644 --- a/modules/core/ns_group.cpp +++ b/modules/core/ns_group.cpp @@ -276,15 +276,19 @@ class CommandNSGList : public Command class NSGroup : public Module { + CommandNSGroup commandnsgroup; + CommandNSUngroup commandnsungroup; + CommandNSGList commandnsglist; + public: NSGroup(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSGroup()); - this->AddCommand(NickServ, new CommandNSUngroup()); - this->AddCommand(NickServ, new CommandNSGList()); + this->AddCommand(NickServ, &commandnsgroup); + this->AddCommand(NickServ, &commandnsungroup); + this->AddCommand(NickServ, &commandnsglist); } }; diff --git a/modules/core/ns_help.cpp b/modules/core/ns_help.cpp index ba4ad8a4c..1ece4bc00 100644 --- a/modules/core/ns_help.cpp +++ b/modules/core/ns_help.cpp @@ -54,13 +54,15 @@ class CommandNSHelp : public Command class NSHelp : public Module { + CommandNSHelp commandnshelp; + public: NSHelp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSHelp()); + this->AddCommand(NickServ, &commandnshelp); } }; diff --git a/modules/core/ns_identify.cpp b/modules/core/ns_identify.cpp index bdf6beffa..db9a70a55 100644 --- a/modules/core/ns_identify.cpp +++ b/modules/core/ns_identify.cpp @@ -113,14 +113,16 @@ class CommandNSIdentify : public Command class NSIdentify : public Module { + CommandNSIdentify commandnsidentify, commandnsid; + public: - NSIdentify(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSIdentify(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), commandnsidentify("IDENTIFY"), commandnsid("ID") { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSIdentify("IDENTIFY")); - this->AddCommand(NickServ, new CommandNSIdentify("ID")); + this->AddCommand(NickServ, &commandnsidentify); + this->AddCommand(NickServ, &commandnsid); } }; diff --git a/modules/core/ns_info.cpp b/modules/core/ns_info.cpp index 60af29baa..153faa623 100644 --- a/modules/core/ns_info.cpp +++ b/modules/core/ns_info.cpp @@ -178,13 +178,15 @@ class CommandNSInfo : public Command class NSInfo : public Module { + CommandNSInfo commandnsinfo; + public: NSInfo(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSInfo()); + this->AddCommand(NickServ, &commandnsinfo); } }; diff --git a/modules/core/ns_list.cpp b/modules/core/ns_list.cpp index 324a3bceb..680d332e0 100644 --- a/modules/core/ns_list.cpp +++ b/modules/core/ns_list.cpp @@ -195,13 +195,15 @@ class CommandNSList : public Command class NSList : public Module { + CommandNSList commandnslist; + public: NSList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSList()); + this->AddCommand(NickServ, &commandnslist); } }; diff --git a/modules/core/ns_logout.cpp b/modules/core/ns_logout.cpp index e0e8f0c7b..e2504b978 100644 --- a/modules/core/ns_logout.cpp +++ b/modules/core/ns_logout.cpp @@ -81,13 +81,15 @@ class CommandNSLogout : public Command class NSLogout : public Module { + CommandNSLogout commandnslogout; + public: NSLogout(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSLogout()); + this->AddCommand(NickServ, &commandnslogout); } }; diff --git a/modules/core/ns_recover.cpp b/modules/core/ns_recover.cpp index e3280c90d..b8107e08a 100644 --- a/modules/core/ns_recover.cpp +++ b/modules/core/ns_recover.cpp @@ -87,7 +87,6 @@ class CommandNSRecover : public Command Anope::string relstr = duration(u->Account(), Config.NSReleaseTimeout); notice_help(Config.s_NickServ, u, NICK_HELP_RECOVER, relstr.c_str()); - //do_help_limited(Config.s_NickServ, u, this); return true; } @@ -105,13 +104,15 @@ class CommandNSRecover : public Command class NSRecover : public Module { + CommandNSRecover commandnsrecover; + public: NSRecover(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSRecover()); + this->AddCommand(NickServ, &commandnsrecover); } }; diff --git a/modules/core/ns_register.cpp b/modules/core/ns_register.cpp index 46764cd9e..51afc6e3e 100644 --- a/modules/core/ns_register.cpp +++ b/modules/core/ns_register.cpp @@ -368,15 +368,19 @@ class CommandNSResend : public Command class NSRegister : public Module { + CommandNSRegister commandnsregister; + CommandNSConfirm commandnsconfirm; + CommandNSResend commandnsrsend; + public: - NSRegister(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + NSRegister(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator), commandnsconfirm("CONFIRM", 1, 1) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSRegister()); - this->AddCommand(NickServ, new CommandNSConfirm("CONFIRM", 1, 1)); - this->AddCommand(NickServ, new CommandNSResend()); + this->AddCommand(NickServ, &commandnsregister); + this->AddCommand(NickServ, &commandnsconfirm); + this->AddCommand(NickServ, &commandnsrsend); } }; diff --git a/modules/core/ns_release.cpp b/modules/core/ns_release.cpp index cb59ac6a1..bbf5401ca 100644 --- a/modules/core/ns_release.cpp +++ b/modules/core/ns_release.cpp @@ -91,13 +91,15 @@ class CommandNSRelease : public Command class NSRelease : public Module { + CommandNSRelease commandnsrelease; + public: NSRelease(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSRelease()); + this->AddCommand(NickServ, &commandnsrelease); } }; diff --git a/modules/core/ns_resetpass.cpp b/modules/core/ns_resetpass.cpp index 23bb8095e..b0f95d8ef 100644 --- a/modules/core/ns_resetpass.cpp +++ b/modules/core/ns_resetpass.cpp @@ -63,6 +63,8 @@ class CommandNSResetPass : public Command class NSResetPass : public Module { + CommandNSResetPass commandnsresetpass; + public: NSResetPass(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -72,7 +74,7 @@ class NSResetPass : public Module this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSResetPass()); + this->AddCommand(NickServ, &commandnsresetpass); ModuleManager::Attach(I_OnPreCommand, this); } diff --git a/modules/core/ns_saset.cpp b/modules/core/ns_saset.cpp index 624f25b7b..c42a1939f 100644 --- a/modules/core/ns_saset.cpp +++ b/modules/core/ns_saset.cpp @@ -19,14 +19,12 @@ class CommandNSSASet : public Command subcommand_map subcommands; public: - CommandNSSASet(const Anope::string &cname) : Command(cname, 2, 4) + CommandNSSASet() : Command("SASET", 2, 4) { } ~CommandNSSASet() { - for (subcommand_map::const_iterator it = this->subcommands.begin(), it_end = this->subcommands.end(); it != it_end; ++it) - delete it->second; this->subcommands.clear(); } @@ -102,9 +100,9 @@ class CommandNSSASet : public Command return this->subcommands.insert(std::make_pair(c->name, c)).second; } - bool DelSubcommand(const Anope::string &command) + bool DelSubcommand(Command *c) { - return this->subcommands.erase(command); + return this->subcommands.erase(c->name); } Command *FindCommand(const Anope::string &subcommand) @@ -121,7 +119,7 @@ class CommandNSSASet : public Command class CommandNSSASetDisplay : public Command { public: - CommandNSSASetDisplay(const Anope::string &cname) : Command(cname, 2, 2, "nickserv/saset/display") + CommandNSSASetDisplay() : Command("DISPLAY", 2, 2, "nickserv/saset/display") { } @@ -164,7 +162,7 @@ class CommandNSSASetDisplay : public Command class CommandNSSASetPassword : public Command { public: - CommandNSSASetPassword(const Anope::string &cname) : Command(cname, 2, 2, "nickserv/saset/password") + CommandNSSASetPassword() : Command("PASSWORD", 2, 2, "nickserv/saset/password") { } @@ -232,16 +230,20 @@ class CommandNSSASetPassword : public Command class NSSASet : public Module { -public: + CommandNSSASet commandnssaset; + CommandNSSASetDisplay commandnssasetdisplay; + CommandNSSASetPassword commandnssasetpassword; + + public: NSSASet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - Command *c = new CommandNSSASet("SASET"); - this->AddCommand(NickServ, c); - c->AddSubcommand(new CommandNSSASetDisplay("DISPLAY")); - c->AddSubcommand(new CommandNSSASetPassword("PASSWORD")); + this->AddCommand(NickServ, &commandnssaset); + + commandnssaset.AddSubcommand(&commandnssasetdisplay); + commandnssaset.AddSubcommand(&commandnssasetpassword); } }; diff --git a/modules/core/ns_saset_noexpire.cpp b/modules/core/ns_saset_noexpire.cpp index 62b93d7e9..3404a0db2 100644 --- a/modules/core/ns_saset_noexpire.cpp +++ b/modules/core/ns_saset_noexpire.cpp @@ -16,7 +16,7 @@ class CommandNSSASetNoexpire : public Command { public: - CommandNSSASetNoexpire(const Anope::string &cname) : Command(cname, 1, 2, "nickserv/saset/noexpire") + CommandNSSASetNoexpire() : Command("NOEXPIRE", 1, 2, "nickserv/saset/noexpire") { } @@ -63,6 +63,8 @@ class CommandNSSASetNoexpire : public Command class NSSASetNoexpire : public Module { + CommandNSSASetNoexpire commandnssasetnoexpire; + public: NSSASetNoexpire(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -71,14 +73,14 @@ class NSSASetNoexpire : public Module Command *c = FindCommand(NickServ, "SASET"); if (c) - c->AddSubcommand(new CommandNSSASetNoexpire("NOEXPIRE")); + c->AddSubcommand(&commandnssasetnoexpire); } ~NSSASetNoexpire() { Command *c = FindCommand(NickServ, "SASET"); if (c) - c->DelSubcommand("NOEXPIRE"); + c->DelSubcommand(&commandnssasetnoexpire); } }; diff --git a/modules/core/ns_sendpass.cpp b/modules/core/ns_sendpass.cpp index 61a61f356..30783a5b6 100644 --- a/modules/core/ns_sendpass.cpp +++ b/modules/core/ns_sendpass.cpp @@ -70,6 +70,8 @@ class CommandNSSendPass : public Command class NSSendPass : public Module { + CommandNSSendPass commandnssendpass; + public: NSSendPass(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -83,7 +85,7 @@ class NSSendPass : public Module this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSSendPass()); + this->AddCommand(NickServ, &commandnssendpass); } }; diff --git a/modules/core/ns_set.cpp b/modules/core/ns_set.cpp index f05e9ccdb..fff85538e 100644 --- a/modules/core/ns_set.cpp +++ b/modules/core/ns_set.cpp @@ -19,14 +19,12 @@ class CommandNSSet : public Command subcommand_map subcommands; public: - CommandNSSet(const Anope::string &cname) : Command(cname, 1, 3) + CommandNSSet() : Command("SET", 1, 3) { } ~CommandNSSet() { - for (subcommand_map::const_iterator it = this->subcommands.begin(), it_end = this->subcommands.end(); it != it_end; ++it) - delete it->second; this->subcommands.clear(); } @@ -116,7 +114,7 @@ class CommandNSSet : public Command class CommandNSSetDisplay : public Command { public: - CommandNSSetDisplay(const Anope::string &cname) : Command(cname, 1) + CommandNSSetDisplay() : Command("DISPLAY", 1) { } @@ -156,7 +154,7 @@ class CommandNSSetDisplay : public Command class CommandNSSetPassword : public Command { public: - CommandNSSetPassword(const Anope::string &cname) : Command(cname, 1) + CommandNSSetPassword() : Command("PASSWORD", 1) { } @@ -214,16 +212,20 @@ class CommandNSSetPassword : public Command class NSSet : public Module { + CommandNSSet commandnsset; + CommandNSSetDisplay commandnssetdisplay; + CommandNSSetPassword commandnssetpassword; + public: NSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - Command *set = new CommandNSSet("SET"); - this->AddCommand(NickServ, set); - set->AddSubcommand(new CommandNSSetDisplay("DISPLAY")); - set->AddSubcommand(new CommandNSSetPassword("PASSWORD")); + this->AddCommand(NickServ, &commandnsset); + + commandnsset.AddSubcommand(&commandnssetdisplay); + commandnsset.AddSubcommand(&commandnssetpassword); } }; diff --git a/modules/core/ns_set_autoop.cpp b/modules/core/ns_set_autoop.cpp index da8b8ccb9..408110239 100644 --- a/modules/core/ns_set_autoop.cpp +++ b/modules/core/ns_set_autoop.cpp @@ -16,7 +16,7 @@ class CommandNSSetAutoOp : public Command { public: - CommandNSSetAutoOp(const Anope::string &cname) : Command(cname, 2) + CommandNSSetAutoOp() : Command("AUTOOP", 2) { } @@ -58,7 +58,7 @@ class CommandNSSetAutoOp : public Command class CommandNSSASetAutoOp : public Command { public: - CommandNSSASetAutoOp(const Anope::string &cname) : Command(cname, 2, 2, "nickserv/saset/autoop") + CommandNSSASetAutoOp() : Command("AUTOOP", 2, 2, "nickserv/saset/autoop") { } @@ -105,6 +105,9 @@ class CommandNSSASetAutoOp : public Command class NSSetAutoOp : public Module { + CommandNSSetAutoOp commandnssetautoop; + CommandNSSASetAutoOp commandnssasetautoop; + public: NSSetAutoOp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -113,22 +116,22 @@ class NSSetAutoOp : public Module Command *c = FindCommand(NickServ, "SET"); if (c) - c->AddSubcommand(new CommandNSSetAutoOp("AUTOOP")); + c->AddSubcommand(&commandnssetautoop); c = FindCommand(NickServ, "SASET"); if (c) - c->AddSubcommand(new CommandNSSASetAutoOp("AUTOOP")); + c->AddSubcommand(&commandnssasetautoop); } ~NSSetAutoOp() { Command *c = FindCommand(NickServ, "SET"); if (c) - c->DelSubcommand("AUTOOP"); + c->DelSubcommand(&commandnssetautoop); c = FindCommand(NickServ, "SASET"); if (c) - c->DelSubcommand("AUTOOP"); + c->DelSubcommand(&commandnssasetautoop); } }; diff --git a/modules/core/ns_set_email.cpp b/modules/core/ns_set_email.cpp index 070e93026..8b10f01ad 100644 --- a/modules/core/ns_set_email.cpp +++ b/modules/core/ns_set_email.cpp @@ -16,7 +16,7 @@ class CommandNSSetEmail : public Command { public: - CommandNSSetEmail(const Anope::string &cname) : Command(cname, 0) + CommandNSSetEmail() : Command("EMAIL", 0) { } @@ -64,7 +64,7 @@ class CommandNSSetEmail : public Command class CommandNSSASetEmail : public Command { public: - CommandNSSASetEmail(const Anope::string &cname) : Command(cname, 1, 2, "nickserv/saset/email") + CommandNSSASetEmail() : Command("EMAIL", 1, 2, "nickserv/saset/email") { } @@ -122,6 +122,9 @@ class CommandNSSASetEmail : public Command class NSSetEmail : public Module { + CommandNSSetEmail commandnssetemail; + CommandNSSASetEmail commandnssasetemail; + public: NSSetEmail(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -130,22 +133,22 @@ class NSSetEmail : public Module Command *c = FindCommand(NickServ, "SET"); if (c) - c->AddSubcommand(new CommandNSSetEmail("EMAIL")); + c->AddSubcommand(&commandnssetemail); c = FindCommand(NickServ, "SASET"); if (c) - c->AddSubcommand(new CommandNSSASetEmail("EMAIL")); + c->AddSubcommand(&commandnssasetemail); } ~NSSetEmail() { Command *c = FindCommand(NickServ, "SET"); if (c) - c->DelSubcommand("EMAIL"); + c->DelSubcommand(&commandnssetemail); c = FindCommand(NickServ, "SASET"); if (c) - c->DelSubcommand("EMAIL"); + c->DelSubcommand(&commandnssasetemail); } }; diff --git a/modules/core/ns_set_greet.cpp b/modules/core/ns_set_greet.cpp index 4704bf1ca..d807f3afc 100644 --- a/modules/core/ns_set_greet.cpp +++ b/modules/core/ns_set_greet.cpp @@ -16,7 +16,7 @@ class CommandNSSetGreet : public Command { public: - CommandNSSetGreet(const Anope::string &cname) : Command(cname, 0) + CommandNSSetGreet() : Command("GREET", 0) { } @@ -51,7 +51,7 @@ class CommandNSSetGreet : public Command class CommandNSSASetGreet : public Command { public: - CommandNSSASetGreet(const Anope::string &cname) : Command(cname, 1, 2, "nickserv/saset/greet") + CommandNSSASetGreet() : Command("GREET", 1, 2, "nickserv/saset/greet") { } @@ -91,6 +91,9 @@ class CommandNSSASetGreet : public Command class NSSetGreet : public Module { + CommandNSSetGreet commandnssetgreet; + CommandNSSASetGreet commandnssasetgreet; + public: NSSetGreet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -99,22 +102,22 @@ class NSSetGreet : public Module Command *c = FindCommand(NickServ, "SET"); if (c) - c->AddSubcommand(new CommandNSSetGreet("GREET")); + c->AddSubcommand(&commandnssetgreet); c = FindCommand(NickServ, "SASET"); if (c) - c->AddSubcommand(new CommandNSSASetGreet("GREET")); + c->AddSubcommand(&commandnssasetgreet); } ~NSSetGreet() { Command *c = FindCommand(NickServ, "SET"); if (c) - c->DelSubcommand("GREET"); + c->DelSubcommand(&commandnssetgreet); c = FindCommand(NickServ, "SASET"); if (c) - c->DelSubcommand("GREET"); + c->DelSubcommand(&commandnssasetgreet); } }; 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); } }; diff --git a/modules/core/ns_set_kill.cpp b/modules/core/ns_set_kill.cpp index cad473543..5293625cb 100644 --- a/modules/core/ns_set_kill.cpp +++ b/modules/core/ns_set_kill.cpp @@ -16,7 +16,7 @@ class CommandNSSetKill : public Command { public: - CommandNSSetKill(const Anope::string &cname) : Command(cname, 1) + CommandNSSetKill() : Command("KILL", 1) { } @@ -81,7 +81,7 @@ class CommandNSSetKill : public Command class CommandNSSASetKill : public Command { public: - CommandNSSASetKill(const Anope::string &cname) : Command(cname, 2, 2, "nickserv/saset/kill") + CommandNSSASetKill() : Command("KILL", 2, 2, "nickserv/saset/kill") { } @@ -151,6 +151,9 @@ class CommandNSSASetKill : public Command class NSSetKill : public Module { + CommandNSSetKill commandnssetkill; + CommandNSSASetKill commandnssasetkill; + public: NSSetKill(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -159,22 +162,22 @@ class NSSetKill : public Module Command *c = FindCommand(NickServ, "SET"); if (c) - c->AddSubcommand(new CommandNSSetKill("KILL")); + c->AddSubcommand(&commandnssetkill); c = FindCommand(NickServ, "SASET"); if (c) - c->AddSubcommand(new CommandNSSASetKill("KILL")); + c->AddSubcommand(&commandnssasetkill); } ~NSSetKill() { Command *c = FindCommand(NickServ, "SET"); if (c) - c->DelSubcommand("KILL"); + c->DelSubcommand(&commandnssetkill); c = FindCommand(NickServ, "SASET"); if (c) - c->DelSubcommand("KILL"); + c->DelSubcommand(&commandnssasetkill); } }; diff --git a/modules/core/ns_set_language.cpp b/modules/core/ns_set_language.cpp index c76bf0fef..6535376e5 100644 --- a/modules/core/ns_set_language.cpp +++ b/modules/core/ns_set_language.cpp @@ -16,7 +16,7 @@ class CommandNSSetLanguage : public Command { public: - CommandNSSetLanguage(const Anope::string &cname) : Command(cname, 1) + CommandNSSetLanguage() : Command("LANGUAGE", 1) { } @@ -63,7 +63,7 @@ class CommandNSSetLanguage : public Command class CommandNSSASetLanguage : public Command { public: - CommandNSSASetLanguage(const Anope::string &cname) : Command(cname, 2, 2, "nickserv/saset/language") + CommandNSSASetLanguage() : Command("LANGUAGE", 2, 2, "nickserv/saset/language") { } @@ -111,6 +111,9 @@ class CommandNSSASetLanguage : public Command class NSSetLanguage : public Module { + CommandNSSetLanguage commandnssetlanguage; + CommandNSSASetLanguage commandnssasetlanguage; + public: NSSetLanguage(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -119,22 +122,22 @@ class NSSetLanguage : public Module Command *c = FindCommand(NickServ, "SET"); if (c) - c->AddSubcommand(new CommandNSSetLanguage("LANGUAGE")); + c->AddSubcommand(&commandnssetlanguage); c = FindCommand(NickServ, "SASET"); if (c) - c->AddSubcommand(new CommandNSSASetLanguage("LANGUAGE")); + c->AddSubcommand(&commandnssasetlanguage); } ~NSSetLanguage() { Command *c = FindCommand(NickServ, "SET"); if (c) - c->DelSubcommand("LANGUAGE"); + c->DelSubcommand(&commandnssetlanguage); c = FindCommand(NickServ, "SASET"); if (c) - c->DelSubcommand("LANGUAGE"); + c->DelSubcommand(&commandnssasetlanguage); } }; diff --git a/modules/core/ns_set_message.cpp b/modules/core/ns_set_message.cpp index f31d4aebe..45b6bbc91 100644 --- a/modules/core/ns_set_message.cpp +++ b/modules/core/ns_set_message.cpp @@ -16,7 +16,7 @@ class CommandNSSetMessage : public Command { public: - CommandNSSetMessage(const Anope::string &cname) : Command(cname, 1) + CommandNSSetMessage() : Command("MESSAGE", 1) { } @@ -64,7 +64,7 @@ class CommandNSSetMessage : public Command class CommandNSSASetMessage : public Command { public: - CommandNSSASetMessage(const Anope::string &cname) : Command(cname, 2, 2, "nickserv/saset/message") + CommandNSSASetMessage() : Command("MESSAGE", 2, 2, "nickserv/saset/message") { } @@ -117,6 +117,9 @@ class CommandNSSASetMessage : public Command class NSSetMessage : public Module { + CommandNSSetMessage commandnssetmessage; + CommandNSSASetMessage commandnssasetmessage; + public: NSSetMessage(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -125,22 +128,22 @@ class NSSetMessage : public Module Command *c = FindCommand(NickServ, "SET"); if (c) - c->AddSubcommand(new CommandNSSetMessage("MSG")); + c->AddSubcommand(&commandnssetmessage); c = FindCommand(NickServ, "SASET"); if (c) - c->AddSubcommand(new CommandNSSASetMessage("MSG")); + c->AddSubcommand(&commandnssasetmessage); } ~NSSetMessage() { Command *c = FindCommand(NickServ, "SET"); if (c) - c->DelSubcommand("MSG"); + c->DelSubcommand(&commandnssetmessage); c = FindCommand(NickServ, "SASET"); if (c) - c->DelSubcommand("MSG"); + c->DelSubcommand(&commandnssasetmessage); } }; diff --git a/modules/core/ns_set_private.cpp b/modules/core/ns_set_private.cpp index c3ce5c8eb..dabfaa09f 100644 --- a/modules/core/ns_set_private.cpp +++ b/modules/core/ns_set_private.cpp @@ -16,7 +16,7 @@ class CommandNSSetPrivate : public Command { public: - CommandNSSetPrivate(const Anope::string &cname) : Command(cname, 1) + CommandNSSetPrivate() : Command("PRIVATE", 1) { } @@ -58,7 +58,7 @@ class CommandNSSetPrivate : public Command class CommandNSSASetPrivate : public Command { public: - CommandNSSASetPrivate(const Anope::string &cname) : Command(cname, 2, 2, "nickserv/saset/private") + CommandNSSASetPrivate() : Command("PRIVATE", 2, 2, "nickserv/saset/private") { } @@ -105,6 +105,9 @@ class CommandNSSASetPrivate : public Command class NSSetPrivate : public Module { + CommandNSSetPrivate commandnssetprivate; + CommandNSSASetPrivate commandnssasetprivate; + public: NSSetPrivate(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -113,22 +116,22 @@ class NSSetPrivate : public Module Command *c = FindCommand(NickServ, "SET"); if (c) - c->AddSubcommand(new CommandNSSetPrivate("PRIVATE")); + c->AddSubcommand(&commandnssetprivate); c = FindCommand(NickServ, "SASET"); if (c) - c->AddSubcommand(new CommandNSSASetPrivate("PRIVATE")); + c->AddSubcommand(&commandnssasetprivate); } ~NSSetPrivate() { Command *c = FindCommand(NickServ, "SET"); if (c) - c->DelSubcommand("PRIVATE"); + c->DelSubcommand(&commandnssetprivate); c = FindCommand(NickServ, "SASET"); if (c) - c->DelSubcommand("PRIVATE"); + c->DelSubcommand(&commandnssasetprivate); } }; diff --git a/modules/core/ns_set_secure.cpp b/modules/core/ns_set_secure.cpp index 872829924..bfaddce48 100644 --- a/modules/core/ns_set_secure.cpp +++ b/modules/core/ns_set_secure.cpp @@ -16,7 +16,7 @@ class CommandNSSetSecure : public Command { public: - CommandNSSetSecure(const Anope::string &cname) : Command(cname, 1) + CommandNSSetSecure() : Command("SECURE", 1) { } @@ -58,7 +58,7 @@ class CommandNSSetSecure : public Command class CommandNSSASetSecure : public Command { public: - CommandNSSASetSecure(const Anope::string &cname) : Command(cname, 2, 2, "nickserv/saset/secure") + CommandNSSASetSecure() : Command("SECURE", 2, 2, "nickserv/saset/secure") { } @@ -105,6 +105,9 @@ class CommandNSSASetSecure : public Command class NSSetSecure : public Module { + CommandNSSetSecure commandnssetsecure; + CommandNSSASetSecure commandnssasetsecure; + public: NSSetSecure(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -113,22 +116,22 @@ class NSSetSecure : public Module Command *c = FindCommand(NickServ, "SET"); if (c) - c->AddSubcommand(new CommandNSSetSecure("SECURE")); + c->AddSubcommand(&commandnssetsecure); c = FindCommand(NickServ, "SASET"); if (c) - c->AddSubcommand(new CommandNSSASetSecure("SECURE")); + c->AddSubcommand(&commandnssasetsecure); } ~NSSetSecure() { Command *c = FindCommand(NickServ, "SET"); if (c) - c->DelSubcommand("SECURE"); + c->DelSubcommand(&commandnssetsecure); c = FindCommand(NickServ, "SASET"); if (c) - c->DelSubcommand("SECURE"); + c->DelSubcommand(&commandnssasetsecure); } }; diff --git a/modules/core/ns_status.cpp b/modules/core/ns_status.cpp index 074d80c23..7a92fe819 100644 --- a/modules/core/ns_status.cpp +++ b/modules/core/ns_status.cpp @@ -62,13 +62,15 @@ class CommandNSStatus : public Command class NSStatus : public Module { + CommandNSStatus commandnsstatus; + public: NSStatus(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSStatus()); + this->AddCommand(NickServ, &commandnsstatus); } }; diff --git a/modules/core/ns_suspend.cpp b/modules/core/ns_suspend.cpp index 375349fba..da8ea4e50 100644 --- a/modules/core/ns_suspend.cpp +++ b/modules/core/ns_suspend.cpp @@ -169,14 +169,17 @@ class CommandNSUnSuspend : public Command class NSSuspend : public Module { + CommandNSSuspend commandnssuspend; + CommandNSUnSuspend commandnsunsuspend; + public: NSSuspend(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSSuspend()); - this->AddCommand(NickServ, new CommandNSUnSuspend()); + this->AddCommand(NickServ, &commandnssuspend); + this->AddCommand(NickServ, &commandnsunsuspend); } }; diff --git a/modules/core/ns_update.cpp b/modules/core/ns_update.cpp index 7192932e1..7e4ae6e01 100644 --- a/modules/core/ns_update.cpp +++ b/modules/core/ns_update.cpp @@ -52,13 +52,15 @@ class CommandNSUpdate : public Command class NSUpdate : public Module { + CommandNSUpdate commandnsupdate; + public: NSUpdate(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSUpdate()); + this->AddCommand(NickServ, &commandnsupdate); } }; diff --git a/modules/core/os_akill.cpp b/modules/core/os_akill.cpp index 44ba85cfb..b46e9ae7f 100644 --- a/modules/core/os_akill.cpp +++ b/modules/core/os_akill.cpp @@ -397,13 +397,15 @@ class CommandOSAKill : public Command class OSAKill : public Module { + CommandOSAKill commandosakill; + public: OSAKill(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSAKill()); + this->AddCommand(OperServ, &commandosakill); } }; diff --git a/modules/core/os_chankill.cpp b/modules/core/os_chankill.cpp index 52eef6b1a..4f8b7f34c 100644 --- a/modules/core/os_chankill.cpp +++ b/modules/core/os_chankill.cpp @@ -103,13 +103,15 @@ class CommandOSChanKill : public Command class OSChanKill : public Module { + CommandOSChanKill commandoschankill; + public: OSChanKill(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSChanKill()); + this->AddCommand(OperServ, &commandoschankill); } }; diff --git a/modules/core/os_chanlist.cpp b/modules/core/os_chanlist.cpp index b8a4f7c83..774a4e2c7 100644 --- a/modules/core/os_chanlist.cpp +++ b/modules/core/os_chanlist.cpp @@ -86,13 +86,15 @@ class CommandOSChanList : public Command class OSChanList : public Module { + CommandOSChanList commandoschanlist; + public: OSChanList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSChanList()); + this->AddCommand(OperServ, &commandoschanlist); } }; diff --git a/modules/core/os_clearmodes.cpp b/modules/core/os_clearmodes.cpp index c6f28c8e6..ddea9379d 100644 --- a/modules/core/os_clearmodes.cpp +++ b/modules/core/os_clearmodes.cpp @@ -174,13 +174,15 @@ class CommandOSClearModes : public Command class OSClearModes : public Module { + CommandOSClearModes commandosclearmodes; + public: OSClearModes(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSClearModes()); + this->AddCommand(OperServ, &commandosclearmodes); } }; diff --git a/modules/core/os_defcon.cpp b/modules/core/os_defcon.cpp index cb25b50bf..ca7f2ace4 100644 --- a/modules/core/os_defcon.cpp +++ b/modules/core/os_defcon.cpp @@ -52,10 +52,10 @@ class DefConTimeout : public Timer }; static DefConTimeout *timeout; -class CommandOSDEFCON : public Command +class CommandOSDefcon : public Command { public: - CommandOSDEFCON() : Command("DEFCON", 1, 1, "operserv/defcon") + CommandOSDefcon() : Command("DEFCON", 1, 1, "operserv/defcon") { } @@ -130,10 +130,12 @@ class CommandOSDEFCON : public Command } }; -class OSDEFCON : public Module +class OSDefcon : public Module { + CommandOSDefcon commandosdefcon; + public: - OSDEFCON(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) + OSDefcon(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { if (!Config.DefConLevel) throw ModuleException("Invalid configuration settings"); @@ -144,7 +146,7 @@ class OSDEFCON : public Module Implementation i[] = { I_OnPreUserConnect, I_OnChannelModeSet, I_OnChannelModeUnset, I_OnPreCommandRun, I_OnPreCommand, I_OnUserConnect, I_OnChannelModeAdd, I_OnChannelCreate }; ModuleManager::Attach(i, this, 8); - this->AddCommand(OperServ, new CommandOSDEFCON()); + this->AddCommand(OperServ, &commandosdefcon); defconParseModeString(Config.DefConChanModes); } @@ -489,4 +491,4 @@ static Anope::string defconReverseModes(const Anope::string &modes) return newmodes; } -MODULE_INIT(OSDEFCON) +MODULE_INIT(OSDefcon) diff --git a/modules/core/os_global.cpp b/modules/core/os_global.cpp index 25c2dfe85..01c4dee5f 100644 --- a/modules/core/os_global.cpp +++ b/modules/core/os_global.cpp @@ -49,13 +49,15 @@ class CommandOSGlobal : public Command class OSGlobal : public Module { + CommandOSGlobal commandosglobal; + public: OSGlobal(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSGlobal()); + this->AddCommand(OperServ, &commandosglobal); } }; diff --git a/modules/core/os_help.cpp b/modules/core/os_help.cpp index d2ab5412e..ad26fb2d6 100644 --- a/modules/core/os_help.cpp +++ b/modules/core/os_help.cpp @@ -38,13 +38,15 @@ class CommandOSHelp : public Command class OSHelp : public Module { + CommandOSHelp commandoshelp; + public: OSHelp(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSHelp()); + this->AddCommand(OperServ, &commandoshelp); } }; diff --git a/modules/core/os_ignore.cpp b/modules/core/os_ignore.cpp index 5a97462fd..eb15ad3b1 100644 --- a/modules/core/os_ignore.cpp +++ b/modules/core/os_ignore.cpp @@ -133,13 +133,15 @@ class CommandOSIgnore : public Command class OSIgnore : public Module { + CommandOSIgnore commandosignore; + public: OSIgnore(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSIgnore()); + this->AddCommand(OperServ, &commandosignore); Implementation i[] = { I_OnDatabaseRead, I_OnDatabaseWrite }; ModuleManager::Attach(i, this, 2); diff --git a/modules/core/os_jupe.cpp b/modules/core/os_jupe.cpp index 68ff2841a..a6d478708 100644 --- a/modules/core/os_jupe.cpp +++ b/modules/core/os_jupe.cpp @@ -64,13 +64,15 @@ class CommandOSJupe : public Command class OSJupe : public Module { + CommandOSJupe commandosjupe; + public: OSJupe(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSJupe()); + this->AddCommand(OperServ, &commandosjupe); } }; diff --git a/modules/core/os_kick.cpp b/modules/core/os_kick.cpp index edb92436a..44a474d04 100644 --- a/modules/core/os_kick.cpp +++ b/modules/core/os_kick.cpp @@ -67,13 +67,15 @@ class CommandOSKick : public Command class OSKick : public Module { + CommandOSKick commandoskick; + public: OSKick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSKick()); + this->AddCommand(OperServ, &commandoskick); } }; diff --git a/modules/core/os_mode.cpp b/modules/core/os_mode.cpp index 40ed4cfe0..52d73e88a 100644 --- a/modules/core/os_mode.cpp +++ b/modules/core/os_mode.cpp @@ -58,13 +58,15 @@ class CommandOSMode : public Command class OSMode : public Module { + CommandOSMode commandosmode; + public: OSMode(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSMode()); + this->AddCommand(OperServ, &commandosmode); } }; diff --git a/modules/core/os_modinfo.cpp b/modules/core/os_modinfo.cpp index e2dccc673..83864ef54 100644 --- a/modules/core/os_modinfo.cpp +++ b/modules/core/os_modinfo.cpp @@ -67,13 +67,15 @@ class CommandOSModInfo : public Command class OSModInfo : public Module { + CommandOSModInfo commandosmodinfo; + public: OSModInfo(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSModInfo()); + this->AddCommand(OperServ, &commandosmodinfo); } }; diff --git a/modules/core/os_modlist.cpp b/modules/core/os_modlist.cpp index 265776917..0089c4b92 100644 --- a/modules/core/os_modlist.cpp +++ b/modules/core/os_modlist.cpp @@ -217,13 +217,15 @@ class CommandOSModList : public Command class OSModList : public Module { + CommandOSModList commandosmodlist; + public: OSModList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSModList()); + this->AddCommand(OperServ, &commandosmodlist); } }; diff --git a/modules/core/os_modload.cpp b/modules/core/os_modload.cpp index a75fa9489..dbc07139f 100644 --- a/modules/core/os_modload.cpp +++ b/modules/core/os_modload.cpp @@ -59,6 +59,8 @@ class CommandOSModLoad : public Command class OSModLoad : public Module { + CommandOSModLoad commandosmodload; + public: OSModLoad(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -66,7 +68,7 @@ class OSModLoad : public Module this->SetType(CORE); this->SetPermanent(true); - this->AddCommand(OperServ, new CommandOSModLoad()); + this->AddCommand(OperServ, &commandosmodload); } }; diff --git a/modules/core/os_modunload.cpp b/modules/core/os_modunload.cpp index 50720459e..de70a6bb0 100644 --- a/modules/core/os_modunload.cpp +++ b/modules/core/os_modunload.cpp @@ -61,6 +61,8 @@ class CommandOSModUnLoad : public Command class OSModUnLoad : public Module { + CommandOSModUnLoad commandosmodunload; + public: OSModUnLoad(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -68,7 +70,7 @@ class OSModUnLoad : public Module this->SetType(CORE); this->SetPermanent(true); - this->AddCommand(OperServ, new CommandOSModUnLoad()); + this->AddCommand(OperServ, &commandosmodunload); } }; diff --git a/modules/core/os_news.cpp b/modules/core/os_news.cpp index 42ca764c3..03cfe3603 100644 --- a/modules/core/os_news.cpp +++ b/modules/core/os_news.cpp @@ -398,15 +398,19 @@ class CommandOSRandomNews : public NewsBase class OSNews : public Module { + CommandOSLogonNews commandoslogonnews; + CommandOSOperNews commandosopernews; + CommandOSRandomNews commandosrandomnews; + public: OSNews(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSLogonNews()); - this->AddCommand(OperServ, new CommandOSOperNews()); - this->AddCommand(OperServ, new CommandOSRandomNews()); + this->AddCommand(OperServ, &commandoslogonnews); + this->AddCommand(OperServ, &commandosopernews); + this->AddCommand(OperServ, &commandosrandomnews); Implementation i[] = { I_OnUserModeSet, I_OnUserConnect, I_OnDatabaseRead, I_OnDatabaseWrite }; ModuleManager::Attach(i, this, 4); diff --git a/modules/core/os_noop.cpp b/modules/core/os_noop.cpp index 1cf480bc8..91c1b93e8 100644 --- a/modules/core/os_noop.cpp +++ b/modules/core/os_noop.cpp @@ -76,13 +76,15 @@ class CommandOSNOOP : public Command class OSNOOP : public Module { + CommandOSNOOP commandosnoop; + public: OSNOOP(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSNOOP()); + this->AddCommand(OperServ, &commandosnoop); } }; diff --git a/modules/core/os_oline.cpp b/modules/core/os_oline.cpp index 4d90072ca..64f89b0e5 100644 --- a/modules/core/os_oline.cpp +++ b/modules/core/os_oline.cpp @@ -67,6 +67,8 @@ class CommandOSOLine : public Command class OSOLine : public Module { + CommandOSOLine commandosoline; + public: OSOLine(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -76,7 +78,7 @@ class OSOLine : public Module this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSOLine()); + this->AddCommand(OperServ, &commandosoline); } }; diff --git a/modules/core/os_quit.cpp b/modules/core/os_quit.cpp index fb8fce2fd..a2c86bc82 100644 --- a/modules/core/os_quit.cpp +++ b/modules/core/os_quit.cpp @@ -45,13 +45,15 @@ class CommandOSQuit : public Command class OSQuit : public Module { + CommandOSQuit commandosquit; + public: OSQuit(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSQuit()); + this->AddCommand(OperServ, &commandosquit); } }; diff --git a/modules/core/os_reload.cpp b/modules/core/os_reload.cpp index 4e64bba8d..722a6bd27 100644 --- a/modules/core/os_reload.cpp +++ b/modules/core/os_reload.cpp @@ -47,13 +47,15 @@ class CommandOSReload : public Command class OSReload : public Module { + CommandOSReload commandosreload; + public: OSReload(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSReload()); + this->AddCommand(OperServ, &commandosreload); } }; diff --git a/modules/core/os_restart.cpp b/modules/core/os_restart.cpp index ae7075661..00f273958 100644 --- a/modules/core/os_restart.cpp +++ b/modules/core/os_restart.cpp @@ -45,13 +45,15 @@ class CommandOSRestart : public Command class OSRestart : public Module { + CommandOSRestart commandosrestart; + public: OSRestart(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSRestart()); + this->AddCommand(OperServ, &commandosrestart); } }; diff --git a/modules/core/os_session.cpp b/modules/core/os_session.cpp index 879dc6cf7..8b8e06dca 100644 --- a/modules/core/os_session.cpp +++ b/modules/core/os_session.cpp @@ -460,14 +460,17 @@ class CommandOSException : public Command class OSSession : public Module { + CommandOSSession commandossession; + CommandOSException commandosexception; + public: OSSession(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSSession()); - this->AddCommand(OperServ, new CommandOSException()); + this->AddCommand(OperServ, &commandossession); + this->AddCommand(OperServ, &commandosexception); } }; diff --git a/modules/core/os_set.cpp b/modules/core/os_set.cpp index 4bfdaa68a..74398cb9a 100644 --- a/modules/core/os_set.cpp +++ b/modules/core/os_set.cpp @@ -299,13 +299,15 @@ class CommandOSSet : public Command class OSSet : public Module { + CommandOSSet commandosset; + public: OSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSSet()); + this->AddCommand(OperServ, &commandosset); } }; diff --git a/modules/core/os_shutdown.cpp b/modules/core/os_shutdown.cpp index afd04d1a9..c65a21673 100644 --- a/modules/core/os_shutdown.cpp +++ b/modules/core/os_shutdown.cpp @@ -44,13 +44,15 @@ class CommandOSShutdown : public Command class OSShutdown : public Module { + CommandOSShutdown commandosshutdown; + public: OSShutdown(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSShutdown()); + this->AddCommand(OperServ, &commandosshutdown); } }; diff --git a/modules/core/os_snline.cpp b/modules/core/os_snline.cpp index c401a40c5..0c01e6b75 100644 --- a/modules/core/os_snline.cpp +++ b/modules/core/os_snline.cpp @@ -415,6 +415,8 @@ class CommandOSSNLine : public Command class OSSNLine : public Module { + CommandOSSNLine commandossnline; + public: OSSNLine(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -424,7 +426,7 @@ class OSSNLine : public Module this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSSNLine()); + this->AddCommand(OperServ, &commandossnline); } }; diff --git a/modules/core/os_sqline.cpp b/modules/core/os_sqline.cpp index c2e446b6b..dbf0d4c18 100644 --- a/modules/core/os_sqline.cpp +++ b/modules/core/os_sqline.cpp @@ -395,6 +395,8 @@ class CommandOSSQLine : public Command class OSSQLine : public Module { + CommandOSSQLine commandossqline; + public: OSSQLine(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -404,7 +406,7 @@ class OSSQLine : public Module this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSSQLine()); + this->AddCommand(OperServ, &commandossqline); } }; diff --git a/modules/core/os_staff.cpp b/modules/core/os_staff.cpp index db701fc55..e8a8bf0a9 100644 --- a/modules/core/os_staff.cpp +++ b/modules/core/os_staff.cpp @@ -69,13 +69,15 @@ class CommandOSStaff : public Command class OSStaff : public Module { + CommandOSStaff commandosstaff; + public: OSStaff(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSStaff()); + this->AddCommand(OperServ, &commandosstaff); } }; diff --git a/modules/core/os_stats.cpp b/modules/core/os_stats.cpp index 7b6bccae7..9cb3865a1 100644 --- a/modules/core/os_stats.cpp +++ b/modules/core/os_stats.cpp @@ -294,13 +294,15 @@ class CommandOSStats : public Command class OSStats : public Module { + CommandOSStats commandosstats; + public: OSStats(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSStats()); + this->AddCommand(OperServ, &commandosstats); } }; diff --git a/modules/core/os_svsnick.cpp b/modules/core/os_svsnick.cpp index 0277aed76..78d6e0485 100644 --- a/modules/core/os_svsnick.cpp +++ b/modules/core/os_svsnick.cpp @@ -83,6 +83,8 @@ class CommandOSSVSNick : public Command class OSSVSNick : public Module { + CommandOSSVSNick commandossvsnick; + public: OSSVSNick(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -92,7 +94,7 @@ class OSSVSNick : public Module this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSSVSNick()); + this->AddCommand(OperServ, &commandossvsnick); } }; diff --git a/modules/core/os_szline.cpp b/modules/core/os_szline.cpp index 94ef5f792..73d6fc0fe 100644 --- a/modules/core/os_szline.cpp +++ b/modules/core/os_szline.cpp @@ -393,6 +393,8 @@ class CommandOSSZLine : public Command class OSSZLine : public Module { + CommandOSSZLine commandosszline; + public: OSSZLine(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -402,7 +404,7 @@ class OSSZLine : public Module this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSSZLine()); + this->AddCommand(OperServ, &commandosszline); } }; diff --git a/modules/core/os_umode.cpp b/modules/core/os_umode.cpp index 1f8f55ddb..1b65e7e18 100644 --- a/modules/core/os_umode.cpp +++ b/modules/core/os_umode.cpp @@ -70,6 +70,8 @@ class CommandOSUMode : public Command class OSUMode : public Module { + CommandOSUMode commandosumode; + public: OSUMode(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -79,7 +81,7 @@ class OSUMode : public Module this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSUMode()); + this->AddCommand(OperServ, &commandosumode); } }; diff --git a/modules/core/os_update.cpp b/modules/core/os_update.cpp index 5f19d142d..0765b6acd 100644 --- a/modules/core/os_update.cpp +++ b/modules/core/os_update.cpp @@ -41,13 +41,15 @@ class CommandOSUpdate : public Command class OSUpdate : public Module { + CommandOSUpdate commandosupdate; + public: OSUpdate(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSUpdate()); + this->AddCommand(OperServ, &commandosupdate); } }; diff --git a/modules/core/os_userlist.cpp b/modules/core/os_userlist.cpp index 96ae9659b..dbc055cb6 100644 --- a/modules/core/os_userlist.cpp +++ b/modules/core/os_userlist.cpp @@ -86,13 +86,15 @@ class CommandOSUserList : public Command class OSUserList : public Module { + CommandOSUserList commandosuserlist; + public: OSUserList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { this->SetAuthor("Anope"); this->SetType(CORE); - this->AddCommand(OperServ, new CommandOSUserList()); + this->AddCommand(OperServ, &commandosuserlist); } }; diff --git a/modules/core/ss_main.cpp b/modules/core/ss_main.cpp index b15e8ce9e..ffe06c795 100644 --- a/modules/core/ss_main.cpp +++ b/modules/core/ss_main.cpp @@ -29,6 +29,8 @@ class CommandSSHelp : public Command class SSMain : public Module { + CommandSSHelp commandsshelp; + public: SSMain(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -44,7 +46,7 @@ class SSMain : public Module } Alog() << "Done creating SS"; - this->AddCommand(statserv, new CommandSSHelp()); + this->AddCommand(statserv, &commandsshelp); } ~SSMain() diff --git a/modules/extra/cs_appendtopic.cpp b/modules/extra/cs_appendtopic.cpp index 8d376e661..42ccb8187 100644 --- a/modules/extra/cs_appendtopic.cpp +++ b/modules/extra/cs_appendtopic.cpp @@ -130,6 +130,8 @@ class CommandCSAppendTopic : public Command class CSAppendTopic : public Module { + CommandCSAppendTopic commandcsappendtopic; + public: CSAppendTopic(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -138,7 +140,7 @@ class CSAppendTopic : public Module this->SetAuthor(AUTHOR); this->SetType(SUPPORTED); - this->AddCommand(ChanServ, new CommandCSAppendTopic()); + this->AddCommand(ChanServ, &commandcsappendtopic); /* English (US) */ const char *langtable_en_us[] = { diff --git a/modules/extra/cs_enforce.cpp b/modules/extra/cs_enforce.cpp index a32d5a8f5..cba949e1d 100644 --- a/modules/extra/cs_enforce.cpp +++ b/modules/extra/cs_enforce.cpp @@ -220,6 +220,8 @@ class CommandCSEnforce : public Command class CSEnforce : public Module { + CommandCSEnforce commandcsenforce; + public: CSEnforce(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { @@ -228,7 +230,7 @@ class CSEnforce : public Module this->SetAuthor(AUTHOR); this->SetType(SUPPORTED); - this->AddCommand(ChanServ, new CommandCSEnforce()); + this->AddCommand(ChanServ, &commandcsenforce); /* English (US) */ const char *langtable_en_us[] = { diff --git a/modules/extra/cs_set_misc.cpp b/modules/extra/cs_set_misc.cpp index d287a24c1..48cd636e7 100644 --- a/modules/extra/cs_set_misc.cpp +++ b/modules/extra/cs_set_misc.cpp @@ -69,6 +69,7 @@ class CSSetMisc : public Module Anope::string Name; Anope::string Desc; bool ShowHidden; + Command *c; CommandInfo(const Anope::string &name, const Anope::string &desc, bool showhidden) : Name(name), Desc(desc), ShowHidden(showhidden) { } }; @@ -89,10 +90,23 @@ class CSSetMisc : public Module for (std::map<Anope::string, CommandInfo *>::const_iterator it = this->Commands.begin(), it_end = this->Commands.end(); it != it_end; ++it) { if (set) - set->DelSubcommand(it->first); + { + Command *c = set->FindSubcommand(it->second->Name); + if (c) + { + set->DelSubcommand(c); + delete c; + } + } if (saset) - saset->DelSubcommand(it->first); - delete it->second; + { + Command *c = saset->FindSubcommand(it->second->Name); + if (c) + { + saset->DelSubcommand(c); + delete c; + } + } } this->Commands.clear(); diff --git a/modules/extra/cs_tban.cpp b/modules/extra/cs_tban.cpp index d09677df6..d01c96ee5 100644 --- a/modules/extra/cs_tban.cpp +++ b/modules/extra/cs_tban.cpp @@ -91,12 +91,14 @@ class CommandCSTBan : public Command class CSTBan : public Module { + CommandCSTBan commandcstban; + public: CSTBan(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { me = this; - this->AddCommand(ChanServ, new CommandCSTBan()); + this->AddCommand(ChanServ, &commandcstban); this->SetAuthor(AUTHOR); this->SetType(SUPPORTED); diff --git a/modules/extra/hs_request.cpp b/modules/extra/hs_request.cpp index 5c5a649f0..6fd48a3ef 100644 --- a/modules/extra/hs_request.cpp +++ b/modules/extra/hs_request.cpp @@ -342,15 +342,20 @@ class CommandHSWaiting : public HSListBase class HSRequest : public Module { + CommandHSRequest commandhsrequest; + CommandHSActivate commandhsactive; + CommandHSReject commandhsreject; + CommandHSWaiting commandhswaiting; + public: HSRequest(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { me = this; - this->AddCommand(HostServ, new CommandHSRequest()); - this->AddCommand(HostServ, new CommandHSActivate()); - this->AddCommand(HostServ, new CommandHSReject()); - this->AddCommand(HostServ, new CommandHSWaiting()); + this->AddCommand(HostServ, &commandhsrequest); + this->AddCommand(HostServ, &commandhsactive); + this->AddCommand(HostServ, &commandhsreject); + this->AddCommand(HostServ, &commandhswaiting); this->SetAuthor(AUTHOR); this->SetType(SUPPORTED); diff --git a/modules/extra/ns_set_misc.cpp b/modules/extra/ns_set_misc.cpp index 8ab54fd05..87113fb67 100644 --- a/modules/extra/ns_set_misc.cpp +++ b/modules/extra/ns_set_misc.cpp @@ -107,10 +107,23 @@ class NSSetMisc : public Module for (std::map<Anope::string, CommandInfo *>::const_iterator it = this->Commands.begin(), it_end = this->Commands.end(); it != it_end; ++it) { if (set) - set->DelSubcommand(it->first); + { + Command *c = set->FindSubcommand(it->second->Name); + if (c) + { + set->DelSubcommand(c); + delete c; + } + } if (saset) - saset->DelSubcommand(it->first); - delete it->second; + { + Command *c = saset->FindSubcommand(it->second->Name); + if (c) + { + saset->DelSubcommand(c); + delete c; + } + } } this->Commands.clear(); diff --git a/src/command.cpp b/src/command.cpp index de9842d78..93c1f978c 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -16,6 +16,8 @@ Command::Command(const Anope::string &sname, size_t min_params, size_t max_param Command::~Command() { + if (this->module) + this->module->DelCommand(this->service, this); } CommandReturn Command::Execute(User *u, const std::vector<Anope::string> &) @@ -39,7 +41,13 @@ bool Command::AddSubcommand(Command *c) return false; } -bool Command::DelSubcommand(const Anope::string &cname) +bool Command::DelSubcommand(Command *c) { return false; } + +Command *Command::FindSubcommand(const Anope::string &name) +{ + return NULL; +} + diff --git a/src/module.cpp b/src/module.cpp index 97cf717de..aa46a6f63 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -40,81 +40,6 @@ Module::~Module() /* Clear any active callbacks this module has */ ModuleManager::ClearCallBacks(this); - /** - * ok, im going to walk every hash looking for commands we own, now, not exactly elegant or efficiant :) - **/ - if (HostServ) - { - for (CommandMap::iterator it = HostServ->Commands.begin(), it_end = HostServ->Commands.end(); it != it_end; ) - { - Command *c = it->second; - ++it; - - if (c->module == this) - this->DelCommand(HostServ, c); - } - } - - if (BotServ) - { - for (CommandMap::iterator it = BotServ->Commands.begin(), it_end = BotServ->Commands.end(); it != it_end; ) - { - Command *c = it->second; - ++it; - - if (c->module == this) - this->DelCommand(BotServ, c); - } - } - - if (MemoServ) - { - for (CommandMap::iterator it = MemoServ->Commands.begin(), it_end = MemoServ->Commands.end(); it != it_end; ) - { - Command *c = it->second; - ++it; - - if (c->module == this) - this->DelCommand(MemoServ, c); - } - } - - if (NickServ) - { - for (CommandMap::iterator it = NickServ->Commands.begin(), it_end = NickServ->Commands.end(); it != it_end; ) - { - Command *c = it->second; - ++it; - - if (c->module == this) - this->DelCommand(NickServ, c); - } - } - - if (ChanServ) - { - for (CommandMap::iterator it = ChanServ->Commands.begin(), it_end = ChanServ->Commands.end(); it != it_end; ) - { - Command *c = it->second; - ++it; - - if (c->module == this) - this->DelCommand(ChanServ, c); - } - } - - if (OperServ) - { - for (CommandMap::iterator it = OperServ->Commands.begin(), it_end = OperServ->Commands.end(); it != it_end; ) - { - Command *c = it->second; - ++it; - - if (c->module == this) - this->DelCommand(OperServ, c); - } - } - std::list<Module *>::iterator it = std::find(Modules.begin(), Modules.end(), this); if (it != Modules.end()) Modules.erase(it); diff --git a/src/modules.cpp b/src/modules.cpp index 26401351d..5cd9b6b69 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -185,7 +185,6 @@ int Module::AddCommand(BotInfo *bi, Command *c) if (it.second != true) { Alog() << "Error creating command " << c->name << ". Command already exists!"; - delete c; return MOD_ERR_EXISTS; } |