From c770c47e18121e93bcdd06b1ab5f161440ffcfe2 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 31 Jul 2010 21:37:45 -0400 Subject: 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. --- modules/core/bs_act.cpp | 4 +++- modules/core/bs_assign.cpp | 4 +++- modules/core/bs_badwords.cpp | 4 +++- modules/core/bs_bot.cpp | 4 +++- modules/core/bs_botlist.cpp | 4 +++- modules/core/bs_help.cpp | 4 +++- modules/core/bs_info.cpp | 4 +++- modules/core/bs_kick.cpp | 4 +++- modules/core/bs_say.cpp | 4 +++- modules/core/bs_set.cpp | 4 +++- modules/core/bs_unassign.cpp | 4 +++- modules/core/cs_access.cpp | 7 ++++-- modules/core/cs_akick.cpp | 4 +++- modules/core/cs_ban.cpp | 8 ++++--- modules/core/cs_clear.cpp | 4 +++- modules/core/cs_drop.cpp | 4 +++- modules/core/cs_forbid.cpp | 4 +++- modules/core/cs_getkey.cpp | 4 +++- modules/core/cs_help.cpp | 4 +++- modules/core/cs_info.cpp | 4 +++- modules/core/cs_invite.cpp | 5 +++- modules/core/cs_kick.cpp | 8 ++++--- modules/core/cs_list.cpp | 6 +++-- modules/core/cs_modes.cpp | 43 ++++++++++++++++++++++------------- modules/core/cs_register.cpp | 4 +++- modules/core/cs_saset.cpp | 12 +++++----- modules/core/cs_saset_noexpire.cpp | 8 ++++--- modules/core/cs_set.cpp | 12 +++++----- modules/core/cs_set_bantype.cpp | 15 +++++++----- modules/core/cs_set_description.cpp | 15 +++++++----- modules/core/cs_set_entrymsg.cpp | 15 +++++++----- modules/core/cs_set_founder.cpp | 15 +++++++----- modules/core/cs_set_keeptopic.cpp | 15 +++++++----- modules/core/cs_set_mlock.cpp | 15 +++++++----- modules/core/cs_set_opnotice.cpp | 15 +++++++----- modules/core/cs_set_peace.cpp | 15 +++++++----- modules/core/cs_set_persist.cpp | 15 +++++++----- modules/core/cs_set_private.cpp | 15 +++++++----- modules/core/cs_set_restricted.cpp | 15 +++++++----- modules/core/cs_set_secure.cpp | 15 +++++++----- modules/core/cs_set_securefounder.cpp | 15 +++++++----- modules/core/cs_set_secureops.cpp | 15 +++++++----- modules/core/cs_set_signkick.cpp | 15 +++++++----- modules/core/cs_set_successor.cpp | 15 +++++++----- modules/core/cs_set_topiclock.cpp | 15 +++++++----- modules/core/cs_set_xop.cpp | 15 +++++++----- modules/core/cs_status.cpp | 4 +++- modules/core/cs_suspend.cpp | 7 ++++-- modules/core/cs_topic.cpp | 4 +++- modules/core/cs_unban.cpp | 4 +++- modules/core/cs_xop.cpp | 20 ++++++++++------ modules/core/hs_del.cpp | 4 +++- modules/core/hs_delall.cpp | 4 +++- modules/core/hs_group.cpp | 4 +++- modules/core/hs_help.cpp | 4 +++- modules/core/hs_list.cpp | 4 +++- modules/core/hs_off.cpp | 4 +++- modules/core/hs_on.cpp | 4 +++- modules/core/hs_set.cpp | 4 +++- modules/core/hs_setall.cpp | 4 +++- modules/core/ms_cancel.cpp | 4 +++- modules/core/ms_check.cpp | 4 +++- modules/core/ms_del.cpp | 4 +++- modules/core/ms_help.cpp | 4 +++- modules/core/ms_info.cpp | 4 +++- modules/core/ms_list.cpp | 4 +++- modules/core/ms_read.cpp | 4 +++- modules/core/ms_rsend.cpp | 4 +++- modules/core/ms_send.cpp | 4 +++- modules/core/ms_sendall.cpp | 4 +++- modules/core/ms_set.cpp | 4 +++- modules/core/ms_staff.cpp | 4 +++- modules/core/ns_access.cpp | 4 +++- modules/core/ns_alist.cpp | 4 +++- modules/core/ns_drop.cpp | 4 +++- modules/core/ns_forbid.cpp | 4 +++- modules/core/ns_getemail.cpp | 3 ++- modules/core/ns_getpass.cpp | 4 +++- modules/core/ns_ghost.cpp | 4 +++- modules/core/ns_group.cpp | 10 +++++--- modules/core/ns_help.cpp | 4 +++- modules/core/ns_identify.cpp | 8 ++++--- modules/core/ns_info.cpp | 4 +++- modules/core/ns_list.cpp | 4 +++- modules/core/ns_logout.cpp | 4 +++- modules/core/ns_recover.cpp | 5 ++-- modules/core/ns_register.cpp | 12 ++++++---- modules/core/ns_release.cpp | 4 +++- modules/core/ns_resetpass.cpp | 4 +++- modules/core/ns_saset.cpp | 26 +++++++++++---------- modules/core/ns_saset_noexpire.cpp | 8 ++++--- modules/core/ns_sendpass.cpp | 4 +++- modules/core/ns_set.cpp | 20 ++++++++-------- modules/core/ns_set_autoop.cpp | 15 +++++++----- modules/core/ns_set_email.cpp | 15 +++++++----- modules/core/ns_set_greet.cpp | 15 +++++++----- modules/core/ns_set_hide.cpp | 15 +++++++----- modules/core/ns_set_kill.cpp | 15 +++++++----- modules/core/ns_set_language.cpp | 15 +++++++----- modules/core/ns_set_message.cpp | 15 +++++++----- modules/core/ns_set_private.cpp | 15 +++++++----- modules/core/ns_set_secure.cpp | 15 +++++++----- modules/core/ns_status.cpp | 4 +++- modules/core/ns_suspend.cpp | 7 ++++-- modules/core/ns_update.cpp | 4 +++- modules/core/os_akill.cpp | 4 +++- modules/core/os_chankill.cpp | 4 +++- modules/core/os_chanlist.cpp | 4 +++- modules/core/os_clearmodes.cpp | 4 +++- modules/core/os_defcon.cpp | 14 +++++++----- modules/core/os_global.cpp | 4 +++- modules/core/os_help.cpp | 4 +++- modules/core/os_ignore.cpp | 4 +++- modules/core/os_jupe.cpp | 4 +++- modules/core/os_kick.cpp | 4 +++- modules/core/os_mode.cpp | 4 +++- modules/core/os_modinfo.cpp | 4 +++- modules/core/os_modlist.cpp | 4 +++- modules/core/os_modload.cpp | 4 +++- modules/core/os_modunload.cpp | 4 +++- modules/core/os_news.cpp | 10 +++++--- modules/core/os_noop.cpp | 4 +++- modules/core/os_oline.cpp | 4 +++- modules/core/os_quit.cpp | 4 +++- modules/core/os_reload.cpp | 4 +++- modules/core/os_restart.cpp | 4 +++- modules/core/os_session.cpp | 7 ++++-- modules/core/os_set.cpp | 4 +++- modules/core/os_shutdown.cpp | 4 +++- modules/core/os_snline.cpp | 4 +++- modules/core/os_sqline.cpp | 4 +++- modules/core/os_staff.cpp | 4 +++- modules/core/os_stats.cpp | 4 +++- modules/core/os_svsnick.cpp | 4 +++- modules/core/os_szline.cpp | 4 +++- modules/core/os_umode.cpp | 4 +++- modules/core/os_update.cpp | 4 +++- modules/core/os_userlist.cpp | 4 +++- modules/core/ss_main.cpp | 4 +++- modules/extra/cs_appendtopic.cpp | 4 +++- modules/extra/cs_enforce.cpp | 4 +++- modules/extra/cs_set_misc.cpp | 20 +++++++++++++--- modules/extra/cs_tban.cpp | 4 +++- modules/extra/hs_request.cpp | 13 +++++++---- modules/extra/ns_set_misc.cpp | 19 +++++++++++++--- 145 files changed, 726 insertions(+), 365 deletions(-) (limited to 'modules') 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