diff options
35 files changed, 75 insertions, 66 deletions
diff --git a/include/commands.h b/include/commands.h index b7c1e28f5..6c7ef7494 100644 --- a/include/commands.h +++ b/include/commands.h @@ -124,9 +124,10 @@ class CoreExport Command : public Flags<CommandFlag> void SetPermission(const Anope::string &reststr); /** Add a subcommand to this command + * @param creator The creator of the subcommand * @param c The command */ - virtual bool AddSubcommand(Command *c); + virtual bool AddSubcommand(Module *creator, Command *c); /** Delete a subcommand from this command * @param c The command diff --git a/modules/core/cs_saset.cpp b/modules/core/cs_saset.cpp index a8ffdce11..e47b2f512 100644 --- a/modules/core/cs_saset.cpp +++ b/modules/core/cs_saset.cpp @@ -96,8 +96,10 @@ class CommandCSSASet : public Command source.Reply(CHAN_HELP_CMD_SASET); } - bool AddSubcommand(Command *c) + bool AddSubcommand(Module *creator, Command *c) { + c->module = creator; + c->service = this->service; return this->subcommands.insert(std::make_pair(c->name, c)).second; } diff --git a/modules/core/cs_saset_noexpire.cpp b/modules/core/cs_saset_noexpire.cpp index 448137c8d..a98e80c95 100644 --- a/modules/core/cs_saset_noexpire.cpp +++ b/modules/core/cs_saset_noexpire.cpp @@ -71,7 +71,7 @@ class CSSetNoexpire : public Module Command *c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(&commandcssasetnoexpire); + c->AddSubcommand(this, &commandcssasetnoexpire); } ~CSSetNoexpire() diff --git a/modules/core/cs_set.cpp b/modules/core/cs_set.cpp index 7fa2895b3..fdc9210d1 100644 --- a/modules/core/cs_set.cpp +++ b/modules/core/cs_set.cpp @@ -100,8 +100,10 @@ class CommandCSSet : public Command source.Reply(CHAN_HELP_CMD_SET); } - bool AddSubcommand(Command *c) + bool AddSubcommand(Module *creator, Command *c) { + c->module = creator; + c->service = this->service; return this->subcommands.insert(std::make_pair(c->name, c)).second; } diff --git a/modules/core/cs_set_bantype.cpp b/modules/core/cs_set_bantype.cpp index 2e7c14052..a5e79be1d 100644 --- a/modules/core/cs_set_bantype.cpp +++ b/modules/core/cs_set_bantype.cpp @@ -92,11 +92,11 @@ class CSSetBanType : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(&commandcssetbantype); + c->AddSubcommand(this, &commandcssetbantype); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(&commandcssasetbantype); + c->AddSubcommand(this, &commandcssasetbantype); } ~CSSetBanType() diff --git a/modules/core/cs_set_description.cpp b/modules/core/cs_set_description.cpp index 4dff9283f..1b22f79e0 100644 --- a/modules/core/cs_set_description.cpp +++ b/modules/core/cs_set_description.cpp @@ -84,11 +84,11 @@ class CSSetDescription : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(&commandcssetdescription); + c->AddSubcommand(this, &commandcssetdescription); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(&commandcssasetdescription); + c->AddSubcommand(this, &commandcssasetdescription); } ~CSSetDescription() diff --git a/modules/core/cs_set_founder.cpp b/modules/core/cs_set_founder.cpp index 4e347b8bb..55cc5d32c 100644 --- a/modules/core/cs_set_founder.cpp +++ b/modules/core/cs_set_founder.cpp @@ -120,11 +120,11 @@ class CSSetFounder : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(&commandcssetfounder); + c->AddSubcommand(this, &commandcssetfounder); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(&commandcssasetfounder); + c->AddSubcommand(this, &commandcssasetfounder); } ~CSSetFounder() diff --git a/modules/core/cs_set_keeptopic.cpp b/modules/core/cs_set_keeptopic.cpp index 81749e60a..4d1f46596 100644 --- a/modules/core/cs_set_keeptopic.cpp +++ b/modules/core/cs_set_keeptopic.cpp @@ -91,11 +91,11 @@ class CSSetKeepTopic : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(&commandcssetkeeptopic); + c->AddSubcommand(this, &commandcssetkeeptopic); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(&commandcssasetkeeptopic); + c->AddSubcommand(this, &commandcssasetkeeptopic); } ~CSSetKeepTopic() diff --git a/modules/core/cs_set_opnotice.cpp b/modules/core/cs_set_opnotice.cpp index 9a323cb17..609fd1a2a 100644 --- a/modules/core/cs_set_opnotice.cpp +++ b/modules/core/cs_set_opnotice.cpp @@ -91,11 +91,11 @@ class CSSetOpNotice : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(&commandcssetopnotice); + c->AddSubcommand(this, &commandcssetopnotice); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(&commandcssasetopnotice); + c->AddSubcommand(this, &commandcssasetopnotice); } ~CSSetOpNotice() diff --git a/modules/core/cs_set_peace.cpp b/modules/core/cs_set_peace.cpp index f083faabb..6948f0fa5 100644 --- a/modules/core/cs_set_peace.cpp +++ b/modules/core/cs_set_peace.cpp @@ -91,11 +91,11 @@ class CSSetPeace : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(&commandcssetpeace); + c->AddSubcommand(this, &commandcssetpeace); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(&commandcssasetpeace); + c->AddSubcommand(this, &commandcssasetpeace); } ~CSSetPeace() diff --git a/modules/core/cs_set_persist.cpp b/modules/core/cs_set_persist.cpp index a1df366ec..bed6969dc 100644 --- a/modules/core/cs_set_persist.cpp +++ b/modules/core/cs_set_persist.cpp @@ -149,11 +149,11 @@ class CSSetPersist : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(&commandcssetpeace); + c->AddSubcommand(this, &commandcssetpeace); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(&commandcssasetpeace); + c->AddSubcommand(this, &commandcssasetpeace); } ~CSSetPersist() diff --git a/modules/core/cs_set_private.cpp b/modules/core/cs_set_private.cpp index f3a6e69d8..71db3c76c 100644 --- a/modules/core/cs_set_private.cpp +++ b/modules/core/cs_set_private.cpp @@ -91,11 +91,11 @@ class CSSetPrivate : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(&commandcssetprivate); + c->AddSubcommand(this, &commandcssetprivate); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(&commandcssasetprivate); + c->AddSubcommand(this, &commandcssasetprivate); } ~CSSetPrivate() diff --git a/modules/core/cs_set_restricted.cpp b/modules/core/cs_set_restricted.cpp index 6aaa203ae..9bd4dfaeb 100644 --- a/modules/core/cs_set_restricted.cpp +++ b/modules/core/cs_set_restricted.cpp @@ -94,11 +94,11 @@ class CSSetRestricted : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(&commandcssetrestricted); + c->AddSubcommand(this, &commandcssetrestricted); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(&commandcssasetrestricted); + c->AddSubcommand(this, &commandcssasetrestricted); } ~CSSetRestricted() diff --git a/modules/core/cs_set_secure.cpp b/modules/core/cs_set_secure.cpp index ac8aea3d1..4f6dd7271 100644 --- a/modules/core/cs_set_secure.cpp +++ b/modules/core/cs_set_secure.cpp @@ -91,11 +91,11 @@ class CSSetSecure : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(&commandcssetsecure); + c->AddSubcommand(this, &commandcssetsecure); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(&commandcssasetsecure); + c->AddSubcommand(this, &commandcssasetsecure); } ~CSSetSecure() diff --git a/modules/core/cs_set_securefounder.cpp b/modules/core/cs_set_securefounder.cpp index a4efa2041..8d8386bc7 100644 --- a/modules/core/cs_set_securefounder.cpp +++ b/modules/core/cs_set_securefounder.cpp @@ -98,11 +98,11 @@ class CSSetSecureFounder : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(&commandcssetsecurefounder); + c->AddSubcommand(this, &commandcssetsecurefounder); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(&commandcssasetsecurefounder); + c->AddSubcommand(this, &commandcssasetsecurefounder); } ~CSSetSecureFounder() diff --git a/modules/core/cs_set_secureops.cpp b/modules/core/cs_set_secureops.cpp index 3253d5b75..7b6217c22 100644 --- a/modules/core/cs_set_secureops.cpp +++ b/modules/core/cs_set_secureops.cpp @@ -91,11 +91,11 @@ class CSSetSecureOps : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(&commandcssetsecureops); + c->AddSubcommand(this, &commandcssetsecureops); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(&commandcssasetsecureops); + c->AddSubcommand(this, &commandcssasetsecureops); } ~CSSetSecureOps() diff --git a/modules/core/cs_set_signkick.cpp b/modules/core/cs_set_signkick.cpp index 853b220e5..6f6ce8ab5 100644 --- a/modules/core/cs_set_signkick.cpp +++ b/modules/core/cs_set_signkick.cpp @@ -99,11 +99,11 @@ class CSSetSignKick : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(&commandcssetsignkick); + c->AddSubcommand(this, &commandcssetsignkick); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(&commandcssasetsignkick); + c->AddSubcommand(this, &commandcssasetsignkick); } ~CSSetSignKick() diff --git a/modules/core/cs_set_successor.cpp b/modules/core/cs_set_successor.cpp index 529c0549c..37fb126a4 100644 --- a/modules/core/cs_set_successor.cpp +++ b/modules/core/cs_set_successor.cpp @@ -122,11 +122,11 @@ class CSSetSuccessor : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(&commandcssetsuccessor); + c->AddSubcommand(this, &commandcssetsuccessor); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(&commandcssasetsuccessor); + c->AddSubcommand(this, &commandcssasetsuccessor); } ~CSSetSuccessor() diff --git a/modules/core/cs_set_topiclock.cpp b/modules/core/cs_set_topiclock.cpp index ec96bda1a..48b11b0b4 100644 --- a/modules/core/cs_set_topiclock.cpp +++ b/modules/core/cs_set_topiclock.cpp @@ -91,11 +91,11 @@ class CSSetTopicLock : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(&commandcssettopiclock); + c->AddSubcommand(this, &commandcssettopiclock); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(&commandcssasettopiclock); + c->AddSubcommand(this, &commandcssasettopiclock); } ~CSSetTopicLock() diff --git a/modules/core/cs_set_xop.cpp b/modules/core/cs_set_xop.cpp index 294c8363c..bf6e7c302 100644 --- a/modules/core/cs_set_xop.cpp +++ b/modules/core/cs_set_xop.cpp @@ -131,11 +131,11 @@ class CSSetXOP : public Module Command *c = FindCommand(ChanServ, "SET"); if (c) - c->AddSubcommand(&commandcssetxop); + c->AddSubcommand(this, &commandcssetxop); c = FindCommand(ChanServ, "SASET"); if (c) - c->AddSubcommand(&commandcssasetxop); + c->AddSubcommand(this, &commandcssasetxop); } ~CSSetXOP() diff --git a/modules/core/ns_saset.cpp b/modules/core/ns_saset.cpp index 42541f99b..366c35862 100644 --- a/modules/core/ns_saset.cpp +++ b/modules/core/ns_saset.cpp @@ -101,8 +101,10 @@ class CommandNSSASet : public Command source.Reply(NICK_HELP_CMD_SASET); } - bool AddSubcommand(Command *c) + bool AddSubcommand(Module *creator, Command *c) { + c->module = creator; + c->service = this->service; return this->subcommands.insert(std::make_pair(c->name, c)).second; } @@ -249,8 +251,8 @@ class NSSASet : public Module this->AddCommand(NickServ, &commandnssaset); - commandnssaset.AddSubcommand(&commandnssasetdisplay); - commandnssaset.AddSubcommand(&commandnssasetpassword); + commandnssaset.AddSubcommand(this, &commandnssasetdisplay); + commandnssaset.AddSubcommand(this, &commandnssasetpassword); } }; diff --git a/modules/core/ns_saset_noexpire.cpp b/modules/core/ns_saset_noexpire.cpp index 889cd7d1e..85e8421f6 100644 --- a/modules/core/ns_saset_noexpire.cpp +++ b/modules/core/ns_saset_noexpire.cpp @@ -73,7 +73,7 @@ class NSSASetNoexpire : public Module Command *c = FindCommand(NickServ, "SASET"); if (c) - c->AddSubcommand(&commandnssasetnoexpire); + c->AddSubcommand(this, &commandnssasetnoexpire); } ~NSSASetNoexpire() diff --git a/modules/core/ns_set.cpp b/modules/core/ns_set.cpp index d5619a684..c4928785a 100644 --- a/modules/core/ns_set.cpp +++ b/modules/core/ns_set.cpp @@ -95,8 +95,10 @@ class CommandNSSet : public Command source.Reply(NICK_HELP_CMD_SET); } - bool AddSubcommand(Command *c) + bool AddSubcommand(Module *creator, Command *c) { + c->module = creator; + c->service = this->service; return this->subcommands.insert(std::make_pair(c->name, c)).second; } @@ -230,8 +232,8 @@ class NSSet : public Module this->AddCommand(NickServ, &commandnsset); - commandnsset.AddSubcommand(&commandnssetdisplay); - commandnsset.AddSubcommand(&commandnssetpassword); + commandnsset.AddSubcommand(this, &commandnssetdisplay); + commandnsset.AddSubcommand(this, &commandnssetpassword); } }; diff --git a/modules/core/ns_set_autoop.cpp b/modules/core/ns_set_autoop.cpp index 9ba6fb5a3..75be41508 100644 --- a/modules/core/ns_set_autoop.cpp +++ b/modules/core/ns_set_autoop.cpp @@ -99,11 +99,11 @@ class NSSetAutoOp : public Module Command *c = FindCommand(NickServ, "SET"); if (c) - c->AddSubcommand(&commandnssetautoop); + c->AddSubcommand(this, &commandnssetautoop); c = FindCommand(NickServ, "SASET"); if (c) - c->AddSubcommand(&commandnssasetautoop); + c->AddSubcommand(this, &commandnssasetautoop); } ~NSSetAutoOp() diff --git a/modules/core/ns_set_email.cpp b/modules/core/ns_set_email.cpp index 06d56a063..1decb73d2 100644 --- a/modules/core/ns_set_email.cpp +++ b/modules/core/ns_set_email.cpp @@ -104,11 +104,11 @@ class NSSetEmail : public Module Command *c = FindCommand(NickServ, "SET"); if (c) - c->AddSubcommand(&commandnssetemail); + c->AddSubcommand(this, &commandnssetemail); c = FindCommand(NickServ, "SASET"); if (c) - c->AddSubcommand(&commandnssasetemail); + c->AddSubcommand(this, &commandnssasetemail); } ~NSSetEmail() diff --git a/modules/core/ns_set_greet.cpp b/modules/core/ns_set_greet.cpp index e1d762c6e..071622316 100644 --- a/modules/core/ns_set_greet.cpp +++ b/modules/core/ns_set_greet.cpp @@ -87,11 +87,11 @@ class NSSetGreet : public Module Command *c = FindCommand(NickServ, "SET"); if (c) - c->AddSubcommand(&commandnssetgreet); + c->AddSubcommand(this, &commandnssetgreet); c = FindCommand(NickServ, "SASET"); if (c) - c->AddSubcommand(&commandnssasetgreet); + c->AddSubcommand(this, &commandnssasetgreet); } ~NSSetGreet() diff --git a/modules/core/ns_set_hide.cpp b/modules/core/ns_set_hide.cpp index 6971eb4ab..ca4eaa7cb 100644 --- a/modules/core/ns_set_hide.cpp +++ b/modules/core/ns_set_hide.cpp @@ -133,11 +133,11 @@ class NSSetHide : public Module Command *c = FindCommand(NickServ, "SET"); if (c) - c->AddSubcommand(&commandnssethide); + c->AddSubcommand(this, &commandnssethide); c = FindCommand(NickServ, "SASET"); if (c) - c->AddSubcommand(&commandnssasethide); + c->AddSubcommand(this, &commandnssasethide); } ~NSSetHide() diff --git a/modules/core/ns_set_kill.cpp b/modules/core/ns_set_kill.cpp index 20755f72e..90015d680 100644 --- a/modules/core/ns_set_kill.cpp +++ b/modules/core/ns_set_kill.cpp @@ -123,11 +123,11 @@ class NSSetKill : public Module Command *c = FindCommand(NickServ, "SET"); if (c) - c->AddSubcommand(&commandnssetkill); + c->AddSubcommand(this, &commandnssetkill); c = FindCommand(NickServ, "SASET"); if (c) - c->AddSubcommand(&commandnssasetkill); + c->AddSubcommand(this, &commandnssasetkill); } ~NSSetKill() diff --git a/modules/core/ns_set_language.cpp b/modules/core/ns_set_language.cpp index 6231315b8..029d737da 100644 --- a/modules/core/ns_set_language.cpp +++ b/modules/core/ns_set_language.cpp @@ -109,11 +109,11 @@ class NSSetLanguage : public Module Command *c = FindCommand(NickServ, "SET"); if (c) - c->AddSubcommand(&commandnssetlanguage); + c->AddSubcommand(this, &commandnssetlanguage); c = FindCommand(NickServ, "SASET"); if (c) - c->AddSubcommand(&commandnssasetlanguage); + c->AddSubcommand(this, &commandnssasetlanguage); } ~NSSetLanguage() diff --git a/modules/core/ns_set_message.cpp b/modules/core/ns_set_message.cpp index 5031f98dc..43a275d4d 100644 --- a/modules/core/ns_set_message.cpp +++ b/modules/core/ns_set_message.cpp @@ -105,11 +105,11 @@ class NSSetMessage : public Module Command *c = FindCommand(NickServ, "SET"); if (c) - c->AddSubcommand(&commandnssetmessage); + c->AddSubcommand(this, &commandnssetmessage); c = FindCommand(NickServ, "SASET"); if (c) - c->AddSubcommand(&commandnssasetmessage); + c->AddSubcommand(this, &commandnssasetmessage); } ~NSSetMessage() diff --git a/modules/core/ns_set_private.cpp b/modules/core/ns_set_private.cpp index 32764dcbf..a9a5be0ab 100644 --- a/modules/core/ns_set_private.cpp +++ b/modules/core/ns_set_private.cpp @@ -99,11 +99,11 @@ class NSSetPrivate : public Module Command *c = FindCommand(NickServ, "SET"); if (c) - c->AddSubcommand(&commandnssetprivate); + c->AddSubcommand(this, &commandnssetprivate); c = FindCommand(NickServ, "SASET"); if (c) - c->AddSubcommand(&commandnssasetprivate); + c->AddSubcommand(this, &commandnssasetprivate); } ~NSSetPrivate() diff --git a/modules/core/ns_set_secure.cpp b/modules/core/ns_set_secure.cpp index 1a47aa342..a5c99fe2b 100644 --- a/modules/core/ns_set_secure.cpp +++ b/modules/core/ns_set_secure.cpp @@ -99,11 +99,11 @@ class NSSetSecure : public Module Command *c = FindCommand(NickServ, "SET"); if (c) - c->AddSubcommand(&commandnssetsecure); + c->AddSubcommand(this, &commandnssetsecure); c = FindCommand(NickServ, "SASET"); if (c) - c->AddSubcommand(&commandnssasetsecure); + c->AddSubcommand(this, &commandnssasetsecure); } ~NSSetSecure() diff --git a/modules/extra/cs_set_misc.cpp b/modules/extra/cs_set_misc.cpp index bdac568e5..9f4ade29c 100644 --- a/modules/extra/cs_set_misc.cpp +++ b/modules/extra/cs_set_misc.cpp @@ -158,9 +158,9 @@ class CSSetMisc : public Module } if (set) - set->AddSubcommand(new CommandCSSetMisc(cname, desc)); + set->AddSubcommand(this, new CommandCSSetMisc(cname, desc)); if (saset) - saset->AddSubcommand(new CommandCSSASetMisc(cname, desc)); + saset->AddSubcommand(this, new CommandCSSASetMisc(cname, desc)); } } diff --git a/modules/extra/ns_set_misc.cpp b/modules/extra/ns_set_misc.cpp index 87263fd64..65dfadc2d 100644 --- a/modules/extra/ns_set_misc.cpp +++ b/modules/extra/ns_set_misc.cpp @@ -161,9 +161,9 @@ class NSSetMisc : public Module } if (set) - set->AddSubcommand(new CommandNSSetMisc(cname, desc)); + set->AddSubcommand(this, new CommandNSSetMisc(cname, desc)); if (saset) - saset->AddSubcommand(new CommandNSSASetMisc(cname, desc)); + saset->AddSubcommand(this, new CommandNSSASetMisc(cname, desc)); } } diff --git a/src/command.cpp b/src/command.cpp index 7c0a503fb..f7edbfaa2 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -89,7 +89,7 @@ void Command::SetPermission(const Anope::string &reststr) this->permission = reststr; } -bool Command::AddSubcommand(Command *c) +bool Command::AddSubcommand(Module *creator, Command *c) { return false; } |