diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:48:48 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:48:48 +0000 |
commit | 24731c63b6320be22f7b3220236271fa7476b975 (patch) | |
tree | 615959bfd36dd30bc5c067c4501dbfb8a2e8cb8b /src/modules | |
parent | 79f9faeec84fbcb704b45811b9851148ab1cb20b (diff) |
Add Module* creator to Command and ModeHandler
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11631 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
94 files changed, 237 insertions, 312 deletions
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 7c5f7ee49..f5133a1dc 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -47,11 +47,9 @@ public: class CommandStartTLS : public Command { - Module* Caller; public: - CommandStartTLS (InspIRCd* Instance, Module* mod) : Command(Instance,"STARTTLS", 0, 0, true), Caller(mod) + CommandStartTLS (InspIRCd* Instance, Module* mod) : Command(Instance, mod, "STARTTLS", 0, 0, true) { - this->source = "m_ssl_gnutls.so"; } CmdResult Handle (const std::vector<std::string> ¶meters, User *user) @@ -69,8 +67,8 @@ class CommandStartTLS : public Command if (!user->GetIOHook()) { user->WriteNumeric(670, "%s :STARTTLS successful, go ahead with TLS handshake", user->nick.c_str()); - user->AddIOHook(Caller); - Caller->OnRawSocketAccept(user->GetFd(), NULL, NULL); + user->AddIOHook(creator); + creator->OnRawSocketAccept(user->GetFd(), NULL, NULL); } else user->WriteNumeric(691, "%s :STARTTLS failure", user->nick.c_str()); diff --git a/src/modules/m_allowinvite.cpp b/src/modules/m_allowinvite.cpp index e177f8ee6..ce4d73098 100644 --- a/src/modules/m_allowinvite.cpp +++ b/src/modules/m_allowinvite.cpp @@ -18,7 +18,7 @@ class AllowInvite : public SimpleChannelModeHandler { public: - AllowInvite(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'A') { } + AllowInvite(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'A') { } }; class ModuleAllowInvite : public Module @@ -26,7 +26,7 @@ class ModuleAllowInvite : public Module AllowInvite ni; public: - ModuleAllowInvite(InspIRCd* Me) : Module(Me), ni(Me) + ModuleAllowInvite(InspIRCd* Me) : Module(Me), ni(Me, this) { if (!ServerInstance->Modes->AddMode(&ni)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_alltime.cpp b/src/modules/m_alltime.cpp index 79a94c2b6..7121ac4c7 100644 --- a/src/modules/m_alltime.cpp +++ b/src/modules/m_alltime.cpp @@ -18,9 +18,8 @@ class CommandAlltime : public Command { public: - CommandAlltime(InspIRCd *Instance) : Command(Instance, "ALLTIME", "o", 0) + CommandAlltime(InspIRCd *Instance, Module* Creator) : Command(Instance, Creator, "ALLTIME", "o", 0) { - this->source = "m_alltime.so"; syntax.clear(); translation.push_back(TR_END); } @@ -53,7 +52,7 @@ class Modulealltime : public Module CommandAlltime mycommand; public: Modulealltime(InspIRCd *Me) - : Module(Me), mycommand(Me) + : Module(Me), mycommand(Me, this) { ServerInstance->AddCommand(&mycommand); } diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp index 8da062593..ae5fba018 100644 --- a/src/modules/m_auditorium.cpp +++ b/src/modules/m_auditorium.cpp @@ -18,7 +18,7 @@ class AuditoriumMode : public ModeHandler { public: - AuditoriumMode(InspIRCd* Instance) : ModeHandler(Instance, 'u', 0, 0, false, MODETYPE_CHANNEL, false, 0, '@') { } + AuditoriumMode(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'u', 0, 0, false, MODETYPE_CHANNEL, false, 0, '@') { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) { @@ -42,7 +42,7 @@ class ModuleAuditorium : public Module bool OperOverride; public: ModuleAuditorium(InspIRCd* Me) - : Module(Me), aum(Me) + : Module(Me), aum(Me, this) { if (!ServerInstance->Modes->AddMode(&aum)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp index 93267e03c..55a5da83f 100644 --- a/src/modules/m_banexception.cpp +++ b/src/modules/m_banexception.cpp @@ -31,7 +31,7 @@ class BanException : public ListModeBase { public: - BanException(InspIRCd* Instance) : ListModeBase(Instance, 'e', "End of Channel Exception List", 348, 349, true) { } + BanException(InspIRCd* Instance, Module* Creator) : ListModeBase(Instance, Creator, 'e', "End of Channel Exception List", 348, 349, true) { } }; @@ -40,7 +40,7 @@ class ModuleBanException : public Module BanException be; public: - ModuleBanException(InspIRCd* Me) : Module(Me), be(Me) + ModuleBanException(InspIRCd* Me) : Module(Me), be(Me, this) { if (!ServerInstance->Modes->AddMode(&be)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index bec69e608..8bbdc1edc 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -38,8 +38,7 @@ typedef std::deque<std::string> StringDeque; class BanRedirect : public ModeWatcher { public: - BanRedirect(InspIRCd* Instance) - : ModeWatcher(Instance, 'b', MODETYPE_CHANNEL) + BanRedirect(InspIRCd* Instance) : ModeWatcher(Instance, 'b', MODETYPE_CHANNEL) { } diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index 8b0c73ce3..6ce1cecc5 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -21,7 +21,7 @@ class BlockCaps : public SimpleChannelModeHandler { public: - BlockCaps(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'B') { } + BlockCaps(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'B') { } }; class ModuleBlockCAPS : public Module @@ -32,7 +32,7 @@ class ModuleBlockCAPS : public Module char capsmap[256]; public: - ModuleBlockCAPS(InspIRCd* Me) : Module(Me), bc(Me) + ModuleBlockCAPS(InspIRCd* Me) : Module(Me), bc(Me, this) { OnRehash(NULL); if (!ServerInstance->Modes->AddMode(&bc)) diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index 020627d01..982d225c3 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -20,7 +20,7 @@ class BlockColor : public SimpleChannelModeHandler { public: - BlockColor(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'c') { } + BlockColor(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'c') { } }; class ModuleBlockColour : public Module @@ -29,7 +29,7 @@ class ModuleBlockColour : public Module BlockColor bc; public: - ModuleBlockColour(InspIRCd* Me) : Module(Me), bc(Me) + ModuleBlockColour(InspIRCd* Me) : Module(Me), bc(Me, this) { if (!ServerInstance->Modes->AddMode(&bc)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp index 01bc46357..9ba154c15 100644 --- a/src/modules/m_botmode.cpp +++ b/src/modules/m_botmode.cpp @@ -20,7 +20,7 @@ class BotMode : public SimpleUserModeHandler { public: - BotMode(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'B') { } + BotMode(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Instance, Creator, 'B') { } }; class ModuleBotMode : public Module @@ -28,7 +28,7 @@ class ModuleBotMode : public Module BotMode bm; public: ModuleBotMode(InspIRCd* Me) - : Module(Me), bm(Me) + : Module(Me), bm(Me, this) { if (!ServerInstance->Modes->AddMode(&bm)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index 29ba7fd60..f275c0a88 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -127,17 +127,15 @@ void RemoveData(User* who) class User_g : public SimpleUserModeHandler { public: - User_g(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'g') { } + User_g(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Instance, Creator, 'g') { } }; class CommandAccept : public Command { -private: - unsigned int& maxaccepts; public: - CommandAccept(InspIRCd* Instance, unsigned int& max) : Command(Instance, "ACCEPT", 0, 1), maxaccepts(max) + unsigned int maxaccepts; + CommandAccept(InspIRCd* Instance, Module* Creator) : Command(Instance, Creator, "ACCEPT", 0, 1) { - source = "m_callerid.so"; syntax = "{[+|-]<nicks>}|*}"; TRANSLATE2(TR_CUSTOM, TR_END); } @@ -311,7 +309,6 @@ private: User_g myumode; // Configuration variables: - unsigned int maxaccepts; // Maximum ACCEPT entries. bool operoverride; // Operators can override callerid. bool tracknick; // Allow ACCEPT entries to update with nick changes. unsigned int notify_cooldown; // Seconds between notifications. @@ -342,7 +339,7 @@ private: } public: - ModuleCallerID(InspIRCd* Me) : Module(Me), mycommand(Me, maxaccepts), myumode(Me) + ModuleCallerID(InspIRCd* Me) : Module(Me), mycommand(Me, this), myumode(Me, this) { OnRehash(NULL); @@ -466,7 +463,7 @@ public: virtual void OnRehash(User* user) { ConfigReader Conf(ServerInstance); - maxaccepts = Conf.ReadInteger("callerid", "maxaccepts", "16", 0, true); + mycommand.maxaccepts = Conf.ReadInteger("callerid", "maxaccepts", "16", 0, true); operoverride = Conf.ReadFlag("callerid", "operoverride", "0", 0); tracknick = Conf.ReadFlag("callerid", "tracknick", "0", 0); notify_cooldown = Conf.ReadInteger("callerid", "cooldown", "60", 0, true); diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index 2e9a24811..2b700a5ae 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -34,11 +34,9 @@ CAP END */ class CommandCAP : public Command { - Module* Creator; public: - CommandCAP (InspIRCd* Instance, Module* mod) : Command(Instance,"CAP", 0, 1, true), Creator(mod) + CommandCAP (InspIRCd* Instance, Module* mod) : Command(Instance, mod, "CAP", 0, 1, true) { - this->source = "m_cap.so"; } CmdResult Handle (const std::vector<std::string> ¶meters, User *user) @@ -51,7 +49,7 @@ class CommandCAP : public Command Data.type = subcommand; Data.user = user; - Data.creator = this->Creator; + Data.creator = this->creator; if (parameters.size() < 2) return CMD_FAILURE; @@ -67,7 +65,7 @@ class CommandCAP : public Command } user->Extend("CAP_REGHOLD"); - Event event((char*) &Data, (Module*)this->Creator, "cap_req"); + Event event((char*) &Data, this->creator, "cap_req"); event.Send(this->ServerInstance); if (Data.ack.size() > 0) @@ -92,10 +90,10 @@ class CommandCAP : public Command Data.type = subcommand; Data.user = user; - Data.creator = this->Creator; + Data.creator = this->creator; user->Extend("CAP_REGHOLD"); - Event event((char*) &Data, (Module*)this->Creator, subcommand == "LS" ? "cap_ls" : "cap_list"); + Event event((char*) &Data, this->creator, subcommand == "LS" ? "cap_ls" : "cap_list"); event.Send(this->ServerInstance); std::string Result; @@ -112,10 +110,10 @@ class CommandCAP : public Command Data.type = subcommand; Data.user = user; - Data.creator = this->Creator; + Data.creator = this->creator; user->Extend("CAP_REGHOLD"); - Event event((char*) &Data, (Module*)this->Creator, "cap_clear"); + Event event((char*) &Data, this->creator, "cap_clear"); event.Send(this->ServerInstance); std::string Result = irc::stringjoiner(" ", Data.ack, 0, Data.ack.size() - 1).GetJoined(); diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index a815cf35f..bf4fa4e6d 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -84,9 +84,8 @@ class CBanFactory : public XLineFactory class CommandCBan : public Command { public: - CommandCBan(InspIRCd* Me) : Command(Me, "CBAN", "o", 1, 3) + CommandCBan(InspIRCd* Me, Module* Creator) : Command(Me, Creator, "CBAN", "o", 1, 3) { - this->source = "m_cban.so"; this->syntax = "<channel> [<duration> :<reason>]"; TRANSLATE4(TR_TEXT,TR_TEXT,TR_TEXT,TR_END); } @@ -162,7 +161,7 @@ class ModuleCBan : public Module CBanFactory f; public: - ModuleCBan(InspIRCd* Me) : Module(Me), mycommand(Me), f(Me) + ModuleCBan(InspIRCd* Me) : Module(Me), mycommand(Me, this), f(Me) { ServerInstance->XLines->RegisterFactory(&f); diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index 9c68be7fd..13527f64a 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -26,7 +26,7 @@ typedef std::map<irc::string,irc::string> censor_t; class CensorUser : public SimpleUserModeHandler { public: - CensorUser(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'G') { } + CensorUser(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Instance, Creator, 'G') { } }; /** Handles channel mode +G @@ -34,7 +34,7 @@ class CensorUser : public SimpleUserModeHandler class CensorChannel : public SimpleChannelModeHandler { public: - CensorChannel(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'G') { } + CensorChannel(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'G') { } }; class ModuleCensor : public Module @@ -45,7 +45,7 @@ class ModuleCensor : public Module public: ModuleCensor(InspIRCd* Me) - : Module(Me), cu(Me), cc(Me) + : Module(Me), cu(Me, this), cc(Me, this) { /* Read the configuration file on startup. */ diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 3e00f498d..a406ad658 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -56,9 +56,9 @@ class CommandWebirc : public Command bool notify; public: CGIHostlist Hosts; - CommandWebirc(InspIRCd* Instance, bool bnotify) : Command(Instance, "WEBIRC", 0, 4, true), notify(bnotify) + CommandWebirc(InspIRCd* Instance, Module* Creator, bool bnotify) + : Command(Instance, Creator, "WEBIRC", 0, 4, true), notify(bnotify) { - this->source = "m_cgiirc.so"; this->syntax = "password client hostname ip"; } CmdResult Handle(const std::vector<std::string> ¶meters, User *user) @@ -138,7 +138,7 @@ class ModuleCgiIRC : public Module CommandWebirc cmd; bool NotifyOpers; public: - ModuleCgiIRC(InspIRCd* Me) : Module(Me), cmd(Me, NotifyOpers) + ModuleCgiIRC(InspIRCd* Me) : Module(Me), cmd(Me, this, NotifyOpers) { OnRehash(NULL); ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index d98086421..977bab4cb 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -25,7 +25,7 @@ class ChanFilter : public ListModeBase { public: - ChanFilter(InspIRCd* Instance) : ListModeBase(Instance, 'g', "End of channel spamfilter list", 941, 940, false, "chanfilter") { } + ChanFilter(InspIRCd* Instance, Module* Creator) : ListModeBase(Instance, Creator, 'g', "End of channel spamfilter list", 941, 940, false, "chanfilter") { } virtual bool ValidateParam(User* user, Channel* chan, std::string &word) { @@ -63,7 +63,7 @@ class ModuleChanFilter : public Module public: ModuleChanFilter(InspIRCd* Me) - : Module(Me), cf(Me) + : Module(Me), cf(Me, this) { if (!ServerInstance->Modes->AddMode(&cf)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index e24e64a3e..6301f56cb 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -156,8 +156,8 @@ class FounderProtectBase class ChanFounder : public ModeHandler, public FounderProtectBase { public: - ChanFounder(InspIRCd* Instance, char my_prefix, bool &depriv_self, bool &depriv_others) - : ModeHandler(Instance, 'q', 1, 1, true, MODETYPE_CHANNEL, false, my_prefix, 0, TR_NICK), + ChanFounder(InspIRCd* Instance, Module* Creator, char my_prefix, bool &depriv_self, bool &depriv_others) + : ModeHandler(Instance, Creator, 'q', 1, 1, true, MODETYPE_CHANNEL, false, my_prefix, 0, TR_NICK), FounderProtectBase(Instance, "cm_founder_", "founder", 386, 387, depriv_self, depriv_others) { } unsigned int GetPrefixRank() @@ -232,8 +232,8 @@ class ChanFounder : public ModeHandler, public FounderProtectBase class ChanProtect : public ModeHandler, public FounderProtectBase { public: - ChanProtect(InspIRCd* Instance, char my_prefix, bool &depriv_self, bool &depriv_others) - : ModeHandler(Instance, 'a', 1, 1, true, MODETYPE_CHANNEL, false, my_prefix, 0, TR_NICK), + ChanProtect(InspIRCd* Instance, Module* Creator, char my_prefix, bool &depriv_self, bool &depriv_others) + : ModeHandler(Instance, Creator, 'a', 1, 1, true, MODETYPE_CHANNEL, false, my_prefix, 0, TR_NICK), FounderProtectBase(Instance,"cm_protect_","protected user", 388, 389, depriv_self, depriv_others) { } unsigned int GetPrefixRank() @@ -328,8 +328,8 @@ class ModuleChanProtect : public Module /* Initialise module variables */ - cp = new ChanProtect(ServerInstance, APrefix, DeprivSelf, DeprivOthers); - cf = new ChanFounder(ServerInstance, QPrefix, DeprivSelf, DeprivOthers); + cp = new ChanProtect(ServerInstance, this, APrefix, DeprivSelf, DeprivOthers); + cf = new ChanFounder(ServerInstance, this, QPrefix, DeprivSelf, DeprivOthers); if (!ServerInstance->Modes->AddMode(cp) || !ServerInstance->Modes->AddMode(cf)) { diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 6ba578194..f8e770337 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -19,12 +19,10 @@ */ class CommandCheck : public Command { - Module* Parent; public: std::set<std::string> meta_seen; - CommandCheck (InspIRCd* Instance, Module* parent) : Command(Instance,"CHECK", "o", 1), Parent(parent) + CommandCheck (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"CHECK", "o", 1) { - this->source = "m_check.so"; syntax = "<nickname>|<ip>|<hostmask>|<channel>"; } @@ -114,7 +112,7 @@ class CommandCheck : public Command ServerInstance->DumpText(user,checkstr + " onchans ", dump); - FOREACH_MOD_I(ServerInstance,I_OnSyncUser,OnSyncUser(targuser,Parent,(void*)user)); + FOREACH_MOD_I(ServerInstance,I_OnSyncUser,OnSyncUser(targuser,creator,(void*)user)); dumpExtra(user, checkstr, targuser); } else if (targchan) @@ -148,7 +146,7 @@ class CommandCheck : public Command user->WriteServ(checkstr + " member " + tmpbuf); } - FOREACH_MOD_I(ServerInstance,I_OnSyncChannel,OnSyncChannel(targchan,Parent,(void*)user)); + FOREACH_MOD_I(ServerInstance,I_OnSyncChannel,OnSyncChannel(targchan,creator,(void*)user)); dumpExtra(user, checkstr, targchan); } else diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index cfd8f6035..a8cad8d43 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -22,9 +22,8 @@ class CommandChghost : public Command private: char* hostmap; public: - CommandChghost (InspIRCd* Instance, char* hmap) : Command(Instance,"CHGHOST","o",2), hostmap(hmap) + CommandChghost (InspIRCd* Instance, Module* Creator, char* hmap) : Command(Instance,Creator,"CHGHOST","o",2), hostmap(hmap) { - this->source = "m_chghost.so"; syntax = "<nick> <newhost>"; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -85,7 +84,7 @@ class ModuleChgHost : public Module char hostmap[256]; public: ModuleChgHost(InspIRCd* Me) - : Module(Me), cmd(Me, hostmap) + : Module(Me), cmd(Me, this, hostmap) { OnRehash(NULL); ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index 9dc8cbd50..58a06cbd8 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -20,9 +20,8 @@ class CommandChgident : public Command { public: - CommandChgident (InspIRCd* Instance) : Command(Instance,"CHGIDENT", "o", 2) + CommandChgident (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"CHGIDENT", "o", 2) { - this->source = "m_chgident.so"; syntax = "<nick> <newident>"; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -71,7 +70,7 @@ class ModuleChgIdent : public Module CommandChgident cmd; public: - ModuleChgIdent(InspIRCd* Me) : Module(Me), cmd(Me) + ModuleChgIdent(InspIRCd* Me) : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp index 704e142bc..23c870294 100644 --- a/src/modules/m_chgname.cpp +++ b/src/modules/m_chgname.cpp @@ -20,9 +20,8 @@ class CommandChgname : public Command { public: - CommandChgname (InspIRCd* Instance) : Command(Instance,"CHGNAME", "o", 2, 2) + CommandChgname (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"CHGNAME", "o", 2, 2) { - this->source = "m_chgname.so"; syntax = "<nick> <newname>"; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -66,7 +65,7 @@ class ModuleChgName : public Module CommandChgname cmd; public: - ModuleChgName(InspIRCd* Me) : Module(Me), cmd(Me) + ModuleChgName(InspIRCd* Me) : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 458d833df..77316a346 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -28,7 +28,6 @@ class CloakUser : public ModeHandler unsigned int key3; unsigned int key4; bool ipalways; - Module* Sender; Module* HashProvider; const char *xtab[4]; @@ -63,7 +62,8 @@ class CloakUser : public ModeHandler return host.substr(splitdot); } - CloakUser(InspIRCd* Instance, Module* source, Module* Hash) : ModeHandler(Instance, 'x', 0, 0, false, MODETYPE_USER, false), Sender(source), HashProvider(Hash) + CloakUser(InspIRCd* Instance, Module* source, Module* Hash) + : ModeHandler(Instance, source, 'x', 0, 0, false, MODETYPE_USER, false), HashProvider(Hash) { } @@ -100,7 +100,7 @@ class CloakUser : public ModeHandler if (!dest->GetExt("cloaked_host", cloak)) { /* Force creation of missing cloak */ - Sender->OnUserConnect(dest); + creator->OnUserConnect(dest); } if (dest->GetExt("cloaked_host", cloak)) { @@ -145,14 +145,14 @@ class CloakUser : public ModeHandler octet[1] = octet[0] + "." + octet[1]; /* Reset the Hash module and send it our IV */ - HashResetRequest(Sender, HashProvider).Send(); - HashKeyRequest(Sender, HashProvider, iv).Send(); + HashResetRequest(creator, HashProvider).Send(); + HashKeyRequest(creator, HashProvider, iv).Send(); /* Send the Hash module a different hex table for each octet group's Hash sum */ for (int k = 0; k < 4; k++) { - HashHexRequest(Sender, HashProvider, xtab[(iv[k]+i[k]) % 4]).Send(); - ra[k] = std::string(HashSumRequest(Sender, HashProvider, octet[k]).Send()).substr(0,6); + HashHexRequest(creator, HashProvider, xtab[(iv[k]+i[k]) % 4]).Send(); + ra[k] = std::string(HashSumRequest(creator, HashProvider, octet[k]).Send()).substr(0,6); } /* Stick them all together */ return std::string().append(ra[0]).append(".").append(ra[1]).append(".").append(ra[2]).append(".").append(ra[3]); @@ -166,8 +166,8 @@ class CloakUser : public ModeHandler int rounds = 0; /* Reset the Hash module and send it our IV */ - HashResetRequest(Sender, HashProvider).Send(); - HashKeyRequest(Sender, HashProvider, iv).Send(); + HashResetRequest(creator, HashProvider).Send(); + HashKeyRequest(creator, HashProvider, iv).Send(); for (const char* input = ip; *input; input++) { @@ -175,8 +175,8 @@ class CloakUser : public ModeHandler if (item.length() > 7) { /* Send the Hash module a different hex table for each octet group's Hash sum */ - HashHexRequest(Sender, HashProvider, xtab[(key1+rounds) % 4]).Send(); - hashies.push_back(std::string(HashSumRequest(Sender, HashProvider, item).Send()).substr(0,8)); + HashHexRequest(creator, HashProvider, xtab[(key1+rounds) % 4]).Send(); + hashies.push_back(std::string(HashSumRequest(creator, HashProvider, item).Send()).substr(0,8)); item.clear(); } rounds++; @@ -184,8 +184,8 @@ class CloakUser : public ModeHandler if (!item.empty()) { /* Send the Hash module a different hex table for each octet group's Hash sum */ - HashHexRequest(Sender, HashProvider, xtab[(key1+rounds) % 4]).Send(); - hashies.push_back(std::string(HashSumRequest(Sender, HashProvider, item).Send()).substr(0,8)); + HashHexRequest(creator, HashProvider, xtab[(key1+rounds) % 4]).Send(); + hashies.push_back(std::string(HashSumRequest(creator, HashProvider, item).Send()).substr(0,8)); item.clear(); } /* Stick them all together */ diff --git a/src/modules/m_clones.cpp b/src/modules/m_clones.cpp index 58ecff17d..8c3429d9b 100644 --- a/src/modules/m_clones.cpp +++ b/src/modules/m_clones.cpp @@ -20,9 +20,8 @@ class CommandClones : public Command { public: - CommandClones (InspIRCd* Instance) : Command(Instance,"CLONES", "o", 1) + CommandClones (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"CLONES", "o", 1) { - this->source = "m_clones.so"; syntax = "<limit>"; } @@ -62,7 +61,7 @@ class ModuleClones : public Module private: CommandClones cmd; public: - ModuleClones(InspIRCd* Me) : Module(Me), cmd(Me) + ModuleClones(InspIRCd* Me) : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_close.cpp b/src/modules/m_close.cpp index 1520c9df4..9514cd809 100644 --- a/src/modules/m_close.cpp +++ b/src/modules/m_close.cpp @@ -29,9 +29,8 @@ class CommandClose : public Command { public: /* Command 'close', needs operator */ - CommandClose (InspIRCd* Instance) : Command(Instance,"CLOSE", "o", 0) + CommandClose (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"CLOSE", "o", 0) { - this->source = "m_close.so"; } CmdResult Handle (const std::vector<std::string> ¶meters, User *user) @@ -68,7 +67,7 @@ class ModuleClose : public Module CommandClose cmd; public: ModuleClose(InspIRCd* Me) - : Module(Me), cmd(Me) + : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_commonchans.cpp b/src/modules/m_commonchans.cpp index 1e8471955..4aa420d1f 100644 --- a/src/modules/m_commonchans.cpp +++ b/src/modules/m_commonchans.cpp @@ -20,7 +20,7 @@ class PrivacyMode : public ModeHandler { public: - PrivacyMode(InspIRCd* Instance) : ModeHandler(Instance, 'c', 0, 0, false, MODETYPE_USER, false) { } + PrivacyMode(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'c', 0, 0, false, MODETYPE_USER, false) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) { @@ -49,7 +49,7 @@ class ModulePrivacyMode : public Module { PrivacyMode pm; public: - ModulePrivacyMode(InspIRCd* Me) : Module(Me), pm(Me) + ModulePrivacyMode(InspIRCd* Me) : Module(Me), pm(Me, this) { if (!ServerInstance->Modes->AddMode(&pm)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index 499886535..806f2194f 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -20,9 +20,8 @@ class CommandTitle : public Command { public: - CommandTitle (InspIRCd* Instance) : Command(Instance,"TITLE",0,2) + CommandTitle (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"TITLE",0,2) { - this->source = "m_customtitle.so"; syntax = "<user> <password>"; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -93,7 +92,7 @@ class ModuleCustomTitle : public Module CommandTitle cmd; public: - ModuleCustomTitle(InspIRCd* Me) : Module(Me), cmd(Me) + ModuleCustomTitle(InspIRCd* Me) : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); Implementation eventlist[] = { I_OnDecodeMetaData, I_OnWhoisLine, I_OnSyncUser, I_OnUserQuit, I_OnCleanup }; diff --git a/src/modules/m_cycle.cpp b/src/modules/m_cycle.cpp index 923783e4b..2ba28d933 100644 --- a/src/modules/m_cycle.cpp +++ b/src/modules/m_cycle.cpp @@ -20,9 +20,8 @@ class CommandCycle : public Command { public: - CommandCycle (InspIRCd* Instance) : Command(Instance,"CYCLE", 0, 1, false, 3) + CommandCycle (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"CYCLE", 0, 1, false, 3) { - this->source = "m_cycle.so"; syntax = "<channel> :[reason]"; TRANSLATE3(TR_TEXT, TR_TEXT, TR_END); } @@ -82,7 +81,7 @@ class ModuleCycle : public Module CommandCycle cmd; public: ModuleCycle(InspIRCd* Me) - : Module(Me), cmd(Me) + : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index ab6789049..df70bba82 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -47,9 +47,8 @@ bannedfilelist bfl; class CommandDccallow : public Command { public: - CommandDccallow(InspIRCd* Me) : Command(Me, "DCCALLOW", 0, 0) + CommandDccallow(InspIRCd* Me, Module* parent) : Command(Me, parent, "DCCALLOW", 0, 0) { - this->source = "m_dccallow.so"; syntax = "{[+|-]<nick> <time>|HELP|LIST}"; /* XXX we need to fix this so it can work with translation stuff (i.e. move +- into a seperate param */ } @@ -248,7 +247,7 @@ class ModuleDCCAllow : public Module public: ModuleDCCAllow(InspIRCd* Me) - : Module(Me), cmd(Me) + : Module(Me), cmd(Me, this) { Conf = new ConfigReader(ServerInstance); ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_deaf.cpp b/src/modules/m_deaf.cpp index 7a810ae31..c3b31c873 100644 --- a/src/modules/m_deaf.cpp +++ b/src/modules/m_deaf.cpp @@ -20,7 +20,7 @@ class User_d : public ModeHandler { public: - User_d(InspIRCd* Instance) : ModeHandler(Instance, 'd', 0, 0, false, MODETYPE_USER, false) { } + User_d(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'd', 0, 0, false, MODETYPE_USER, false) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) { @@ -54,7 +54,7 @@ class ModuleDeaf : public Module public: ModuleDeaf(InspIRCd* Me) - : Module(Me), m1(Me) + : Module(Me), m1(Me, this) { if (!ServerInstance->Modes->AddMode(&m1)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index 8b5e83e88..5f5a95432 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -18,9 +18,8 @@ class DelayJoinMode : public ModeHandler { private: CUList empty; - Module* Creator; public: - DelayJoinMode(InspIRCd* Instance, Module* Parent) : ModeHandler(Instance, 'D', 0, 0, false, MODETYPE_CHANNEL, false, 0, '@'), Creator(Parent) {}; + DelayJoinMode(InspIRCd* Instance, Module* Parent) : ModeHandler(Instance, Parent, 'D', 0, 0, false, MODETYPE_CHANNEL, false, 0, '@') {}; ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool); }; @@ -67,7 +66,7 @@ ModeAction DelayJoinMode::OnModeChange(User* source, User* dest, Channel* channe */ CUList* names = channel->GetUsers(); for (CUListIter n = names->begin(); n != names->end(); ++n) - Creator->OnText(n->first, channel, TYPE_CHANNEL, "", 0, empty); + creator->OnText(n->first, channel, TYPE_CHANNEL, "", 0, empty); } channel->SetMode('D', adding); return MODEACTION_ALLOW; diff --git a/src/modules/m_delaymsg.cpp b/src/modules/m_delaymsg.cpp index b732e4523..54a0f75d4 100644 --- a/src/modules/m_delaymsg.cpp +++ b/src/modules/m_delaymsg.cpp @@ -18,9 +18,8 @@ class DelayMsgMode : public ModeHandler { private: CUList empty; - Module* Creator; public: - DelayMsgMode(InspIRCd* Instance, Module* Parent) : ModeHandler(Instance, 'd', 1, 0, false, MODETYPE_CHANNEL, false, 0, '@'), Creator(Parent) {}; + DelayMsgMode(InspIRCd* Instance, Module* Parent) : ModeHandler(Instance, Parent, 'd', 1, 0, false, MODETYPE_CHANNEL, false, 0, '@') {}; ModePair ModeSet(User*, User*, Channel* channel, const std::string ¶meter) { diff --git a/src/modules/m_devoice.cpp b/src/modules/m_devoice.cpp index 0e6f68480..0d511886c 100644 --- a/src/modules/m_devoice.cpp +++ b/src/modules/m_devoice.cpp @@ -25,9 +25,8 @@ class CommandDevoice : public Command { public: - CommandDevoice (InspIRCd* Instance) : Command(Instance,"DEVOICE", 0, 1) + CommandDevoice (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"DEVOICE", 0, 1) { - this->source = "m_devoice.so"; syntax = "<channel>"; TRANSLATE2(TR_TEXT, TR_END); } @@ -55,7 +54,7 @@ class ModuleDeVoice : public Module { CommandDevoice cmd; public: - ModuleDeVoice(InspIRCd* Me) : Module(Me), cmd(Me) + ModuleDeVoice(InspIRCd* Me) : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 6490e4c86..3288d69fb 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -101,9 +101,9 @@ class CommandFilter : public Command { FilterBase* Base; public: - CommandFilter(FilterBase* f, InspIRCd* Me, const std::string &ssource) : Command(Me, "FILTER", "o", 1, 5), Base(f) + CommandFilter(FilterBase* f, InspIRCd* Me, const std::string &ssource) + : Command(Me, reinterpret_cast<Module*>(f), "FILTER", "o", 1, 5), Base(f) { - this->source = ssource; this->syntax = "<filter-definition> <action> <flags> [<gline-duration>] :<reason>"; } CmdResult Handle(const std::vector<std::string>&, User*); diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp index a3e314846..72c8a14d3 100644 --- a/src/modules/m_globalload.cpp +++ b/src/modules/m_globalload.cpp @@ -20,9 +20,8 @@ class CommandGloadmodule : public Command { public: - CommandGloadmodule (InspIRCd* Instance) : Command(Instance,"GLOADMODULE", "o", 1) + CommandGloadmodule (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"GLOADMODULE", "o", 1) { - this->source = "m_globalload.so"; syntax = "<modulename> [servermask]"; TRANSLATE3(TR_TEXT, TR_TEXT, TR_END); } @@ -55,9 +54,8 @@ class CommandGloadmodule : public Command class CommandGunloadmodule : public Command { public: - CommandGunloadmodule (InspIRCd* Instance) : Command(Instance,"GUNLOADMODULE", "o", 1) + CommandGunloadmodule (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"GUNLOADMODULE", "o", 1) { - this->source = "m_globalload.so"; syntax = "<modulename> [servermask]"; } @@ -89,9 +87,8 @@ class CommandGunloadmodule : public Command class CommandGreloadmodule : public Command { public: - CommandGreloadmodule (InspIRCd* Instance) : Command(Instance, "GRELOADMODULE", "o", 1) + CommandGreloadmodule (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator, "GRELOADMODULE", "o", 1) { - this->source = "m_globalload.so"; syntax = "<modulename> [servermask]"; } @@ -131,7 +128,7 @@ class ModuleGlobalLoad : public Module public: ModuleGlobalLoad(InspIRCd* Me) - : Module(Me), cmd1(Me), cmd2(Me), cmd3(Me) + : Module(Me), cmd1(Me, this), cmd2(Me, this), cmd3(Me, this) { ServerInstance->AddCommand(&cmd1); ServerInstance->AddCommand(&cmd2); diff --git a/src/modules/m_globops.cpp b/src/modules/m_globops.cpp index 934a4ec14..4c8b0e713 100644 --- a/src/modules/m_globops.cpp +++ b/src/modules/m_globops.cpp @@ -22,9 +22,8 @@ class CommandGlobops : public Command { public: - CommandGlobops (InspIRCd* Instance) : Command(Instance,"GLOBOPS","o",1,1) + CommandGlobops (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"GLOBOPS","o",1,1) { - this->source = "m_globops.so"; syntax = "<any-text>"; TRANSLATE2(TR_TEXT, TR_END); } @@ -48,7 +47,7 @@ class ModuleGlobops : public Module CommandGlobops cmd; public: ModuleGlobops(InspIRCd* Me) - : Module(Me), cmd(Me) + : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); ServerInstance->SNO->EnableSnomask('g',"GLOBOPS"); diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index 4800ebac8..1064714a2 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -22,7 +22,7 @@ static std::map<irc::string, std::string> helpop_map; class Helpop : public ModeHandler { public: - Helpop(InspIRCd* Instance) : ModeHandler(Instance, 'h', 0, 0, false, MODETYPE_USER, true) { } + Helpop(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'h', 0, 0, false, MODETYPE_USER, true) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) { @@ -52,9 +52,8 @@ class Helpop : public ModeHandler class CommandHelpop : public Command { public: - CommandHelpop (InspIRCd* Instance) : Command(Instance, "HELPOP", 0, 0) + CommandHelpop (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator, "HELPOP", 0, 0) { - this->source = "m_helpop.so"; syntax = "<any-text>"; } @@ -119,7 +118,7 @@ class ModuleHelpop : public Module public: ModuleHelpop(InspIRCd* Me) - : Module(Me), cmd(Me), ho(Me) + : Module(Me), cmd(Me, this), ho(Me, this) { ReadConfig(); if (!ServerInstance->Modes->AddMode(&ho)) diff --git a/src/modules/m_hidechans.cpp b/src/modules/m_hidechans.cpp index 96f5ef560..137bab92b 100644 --- a/src/modules/m_hidechans.cpp +++ b/src/modules/m_hidechans.cpp @@ -20,7 +20,7 @@ class HideChans : public ModeHandler { public: - HideChans(InspIRCd* Instance) : ModeHandler(Instance, 'I', 0, 0, false, MODETYPE_USER, false) { } + HideChans(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'I', 0, 0, false, MODETYPE_USER, false) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) { @@ -50,7 +50,7 @@ class ModuleHideChans : public Module bool AffectsOpers; HideChans hm; public: - ModuleHideChans(InspIRCd* Me) : Module(Me), hm(Me) + ModuleHideChans(InspIRCd* Me) : Module(Me), hm(Me, this) { if (!ServerInstance->Modes->AddMode(&hm)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp index c204d51e9..51d1259ed 100644 --- a/src/modules/m_hideoper.cpp +++ b/src/modules/m_hideoper.cpp @@ -20,7 +20,7 @@ class HideOper : public ModeHandler { public: - HideOper(InspIRCd* Instance) : ModeHandler(Instance, 'H', 0, 0, false, MODETYPE_USER, true) { } + HideOper(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'H', 0, 0, false, MODETYPE_USER, true) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) { @@ -50,7 +50,7 @@ class ModuleHideOper : public Module HideOper hm; public: ModuleHideOper(InspIRCd* Me) - : Module(Me), hm(Me) + : Module(Me), hm(Me, this) { if (!ServerInstance->Modes->AddMode(&hm)) diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp index d471b44d9..4a3846ce4 100644 --- a/src/modules/m_invisible.cpp +++ b/src/modules/m_invisible.cpp @@ -40,7 +40,7 @@ class InvisibleMode : public ModeHandler { QuietOper* qo; public: - InvisibleMode(InspIRCd* Instance) : ModeHandler(Instance, 'Q', 0, 0, false, MODETYPE_USER, true) + InvisibleMode(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'Q', 0, 0, false, MODETYPE_USER, true) { qo = new QuietOper(); } @@ -134,7 +134,7 @@ class ModuleInvisible : public Module InvisibleDeOper ido; public: ModuleInvisible(InspIRCd* Me) - : Module(Me), qm(Me), ido(Me) + : Module(Me), qm(Me, this), ido(Me) { conf = new ConfigReader(ServerInstance); if (!ServerInstance->Modes->AddMode(&qm)) diff --git a/src/modules/m_inviteexception.cpp b/src/modules/m_inviteexception.cpp index 5acdf4f97..da7f10df1 100644 --- a/src/modules/m_inviteexception.cpp +++ b/src/modules/m_inviteexception.cpp @@ -34,14 +34,14 @@ class InspIRCd* ServerInstance; class InviteException : public ListModeBase { public: - InviteException(InspIRCd* Instance) : ListModeBase(Instance, 'I', "End of Channel Invite Exception List", 346, 347, true) { } + InviteException(InspIRCd* Instance, Module* Creator) : ListModeBase(Instance, Creator, 'I', "End of Channel Invite Exception List", 346, 347, true) { } }; class ModuleInviteException : public Module { InviteException ie; public: - ModuleInviteException(InspIRCd* Me) : Module(Me), ie(Me) + ModuleInviteException(InspIRCd* Me) : Module(Me), ie(Me, this) { if (!ServerInstance->Modes->AddMode(&ie)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index 31d0b4e84..ac194decd 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -86,7 +86,7 @@ class joinfloodsettings : public classbase class JoinFlood : public ModeHandler { public: - JoinFlood(InspIRCd* Instance) : ModeHandler(Instance, 'j', 1, 0, false, MODETYPE_CHANNEL, false) { } + JoinFlood(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'j', 1, 0, false, MODETYPE_CHANNEL, false) { } ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter) { @@ -202,7 +202,7 @@ class ModuleJoinFlood : public Module public: ModuleJoinFlood(InspIRCd* Me) - : Module(Me), jf(Me) + : Module(Me), jf(Me, this) { if (!ServerInstance->Modes->AddMode(&jf)) diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp index f97e64258..5ea4cdf8e 100644 --- a/src/modules/m_jumpserver.cpp +++ b/src/modules/m_jumpserver.cpp @@ -27,9 +27,8 @@ class CommandJumpserver : public Command std::string reason; int port; - CommandJumpserver (InspIRCd* Instance) : Command(Instance, "JUMPSERVER", "o", 0, 4) + CommandJumpserver (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator, "JUMPSERVER", "o", 0, 4) { - this->source = "m_jumpserver.so"; syntax = "[<server> <port> <+/-an> <reason>]"; redirect_to.clear(); reason.clear(); @@ -137,7 +136,7 @@ class ModuleJumpServer : public Module CommandJumpserver js; public: ModuleJumpServer(InspIRCd* Me) - : Module(Me), js(Me) + : Module(Me), js(Me, this) { ServerInstance->AddCommand(&js); Implementation eventlist[] = { I_OnUserRegister }; diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index 835f73443..915480ed9 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -30,7 +30,7 @@ typedef std::map<User*, time_t> delaylist; class KickRejoin : public ModeHandler { public: - KickRejoin(InspIRCd* Instance) : ModeHandler(Instance, 'J', 1, 0, false, MODETYPE_CHANNEL, false) { } + KickRejoin(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'J', 1, 0, false, MODETYPE_CHANNEL, false) { } ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter) { @@ -111,7 +111,7 @@ class ModuleKickNoRejoin : public Module public: ModuleKickNoRejoin(InspIRCd* Me) - : Module(Me), kr(Me) + : Module(Me), kr(Me, this) { if (!ServerInstance->Modes->AddMode(&kr)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index 45b213b40..a13bd6a5c 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -20,9 +20,8 @@ class CommandKnock : public Command { public: - CommandKnock (InspIRCd* Instance) : Command(Instance,"KNOCK", 0, 2) + CommandKnock (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"KNOCK", 0, 2) { - this->source = "m_knock.so"; syntax = "<channel> <reason>"; TRANSLATE3(TR_TEXT, TR_TEXT, TR_END); } @@ -73,7 +72,7 @@ class CommandKnock : public Command class Knock : public SimpleChannelModeHandler { public: - Knock(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'K') { } + Knock(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'K') { } }; class ModuleKnock : public Module @@ -81,7 +80,7 @@ class ModuleKnock : public Module CommandKnock cmd; Knock kn; public: - ModuleKnock(InspIRCd* Me) : Module(Me), cmd(Me), kn(Me) + ModuleKnock(InspIRCd* Me) : Module(Me), cmd(Me, this), kn(Me, this) { if (!ServerInstance->Modes->AddMode(&kn)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp index 77dc5a219..0a19d56df 100644 --- a/src/modules/m_lockserv.cpp +++ b/src/modules/m_lockserv.cpp @@ -23,14 +23,11 @@ class CommandLockserv : public Command { -private: bool& locked; - public: - CommandLockserv (InspIRCd* Instance, bool &lock) - : Command(Instance, "LOCKSERV", "o", 0), locked(lock) + CommandLockserv (InspIRCd* Instance, Module* Creator, bool& lock) + : Command(Instance, Creator, "LOCKSERV", "o", 0), locked(lock) { - this->source = "m_lockserv.so"; syntax.clear(); } @@ -50,10 +47,9 @@ private: bool& locked; public: - CommandUnlockserv (InspIRCd* Instance, bool &lock) - : Command(Instance, "UNLOCKSERV", "o", 0), locked(lock) + CommandUnlockserv (InspIRCd* Instance, Module* Creator, bool &lock) + : Command(Instance, Creator, "UNLOCKSERV", "o", 0), locked(lock) { - this->source = "m_lockserv.so"; syntax.clear(); } @@ -80,7 +76,7 @@ private: } public: - ModuleLockserv(InspIRCd* Me) : Module(Me), lockcommand(Me, locked), unlockcommand(Me, locked) + ModuleLockserv(InspIRCd* Me) : Module(Me), lockcommand(Me, this, locked), unlockcommand(Me, this, locked) { ResetLocked(); ServerInstance->AddCommand(&lockcommand); diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index 087d8e47e..007047e10 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -76,7 +76,7 @@ class floodsettings : public classbase class MsgFlood : public ModeHandler { public: - MsgFlood(InspIRCd* Instance) : ModeHandler(Instance, 'f', 1, 0, false, MODETYPE_CHANNEL, false) { } + MsgFlood(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'f', 1, 0, false, MODETYPE_CHANNEL, false) { } ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter) { @@ -197,7 +197,7 @@ class ModuleMsgFlood : public Module public: ModuleMsgFlood(InspIRCd* Me) - : Module(Me), mf(Me) + : Module(Me), mf(Me, this) { if (!ServerInstance->Modes->AddMode(&mf)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp index edb5aff3e..d0e4eaeb6 100644 --- a/src/modules/m_nickflood.cpp +++ b/src/modules/m_nickflood.cpp @@ -90,7 +90,7 @@ class nickfloodsettings : public classbase class NickFlood : public ModeHandler { public: - NickFlood(InspIRCd* Instance) : ModeHandler(Instance, 'F', 1, 0, false, MODETYPE_CHANNEL, false) { } + NickFlood(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'F', 1, 0, false, MODETYPE_CHANNEL, false) { } ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter) { @@ -205,7 +205,7 @@ class ModuleNickFlood : public Module public: ModuleNickFlood(InspIRCd* Me) - : Module(Me), jf(Me) + : Module(Me), jf(Me, this) { if (!ServerInstance->Modes->AddMode(&jf)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index b0f257cf9..bc5ebe47a 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -21,9 +21,8 @@ class CommandNicklock : public Command { public: - CommandNicklock (InspIRCd* Instance) : Command(Instance,"NICKLOCK", "o", 2) + CommandNicklock (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"NICKLOCK", "o", 2) { - this->source = "m_nicklock.so"; syntax = "<oldnick> <newnick>"; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -92,9 +91,8 @@ class CommandNicklock : public Command class CommandNickunlock : public Command { public: - CommandNickunlock (InspIRCd* Instance) : Command(Instance,"NICKUNLOCK", "o", 1) + CommandNickunlock (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"NICKUNLOCK", "o", 1) { - this->source = "m_nicklock.so"; syntax = "<locked-nick>"; TRANSLATE2(TR_NICK, TR_END); } @@ -148,11 +146,11 @@ class CommandNickunlock : public Command class ModuleNickLock : public Module { - CommandNicklock cmd1; - CommandNickunlock cmd2; + CommandNicklock cmd1; + CommandNickunlock cmd2; public: ModuleNickLock(InspIRCd* Me) - : Module(Me), cmd1(Me), cmd2(Me) + : Module(Me), cmd1(Me, this), cmd2(Me, this) { ServerInstance->AddCommand(&cmd1); ServerInstance->AddCommand(&cmd2); diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index b7d9295a1..6f9ddf8ed 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -18,7 +18,7 @@ class NoCTCP : public ModeHandler { public: - NoCTCP(InspIRCd* Instance) : ModeHandler(Instance, 'C', 0, 0, false, MODETYPE_CHANNEL, false) { } + NoCTCP(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'C', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) { @@ -51,7 +51,7 @@ class ModuleNoCTCP : public Module public: ModuleNoCTCP(InspIRCd* Me) - : Module(Me), nc(Me) + : Module(Me), nc(Me, this) { if (!ServerInstance->Modes->AddMode(&nc)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp index ce43e576f..911b181ab 100644 --- a/src/modules/m_nokicks.cpp +++ b/src/modules/m_nokicks.cpp @@ -18,7 +18,7 @@ class NoKicks : public SimpleChannelModeHandler { public: - NoKicks(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'Q') { } + NoKicks(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'Q') { } }; class ModuleNoKicks : public Module @@ -27,7 +27,7 @@ class ModuleNoKicks : public Module public: ModuleNoKicks(InspIRCd* Me) - : Module(Me), nk(Me) + : Module(Me), nk(Me, this) { if (!ServerInstance->Modes->AddMode(&nk)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index b3b739807..1a8e83795 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -18,7 +18,7 @@ class NoNicks : public ModeHandler { public: - NoNicks(InspIRCd* Instance) : ModeHandler(Instance, 'N', 0, 0, false, MODETYPE_CHANNEL, false) { } + NoNicks(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'N', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) { @@ -47,7 +47,7 @@ class ModuleNoNickChange : public Module { NoNicks nn; public: - ModuleNoNickChange(InspIRCd* Me) : Module(Me), nn(Me) + ModuleNoNickChange(InspIRCd* Me) : Module(Me), nn(Me, this) { ServerInstance->Modes->AddMode(&nn); Implementation eventlist[] = { I_OnUserPreNick, I_On005Numeric }; diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp index 854de2901..6d17bc85d 100644 --- a/src/modules/m_nonotice.cpp +++ b/src/modules/m_nonotice.cpp @@ -18,7 +18,7 @@ class NoNotice : public SimpleChannelModeHandler { public: - NoNotice(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'T') { } + NoNotice(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'T') { } }; class ModuleNoNotice : public Module @@ -27,7 +27,7 @@ class ModuleNoNotice : public Module public: ModuleNoNotice(InspIRCd* Me) - : Module(Me), nt(Me) + : Module(Me), nt(Me, this) { if (!ServerInstance->Modes->AddMode(&nt)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp index 8723f6ca0..da8f2c140 100644 --- a/src/modules/m_operchans.cpp +++ b/src/modules/m_operchans.cpp @@ -19,7 +19,7 @@ class OperChans : public ModeHandler { public: /* This is an oper-only mode */ - OperChans(InspIRCd* Instance) : ModeHandler(Instance, 'O', 0, 0, false, MODETYPE_CHANNEL, true) { } + OperChans(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'O', 0, 0, false, MODETYPE_CHANNEL, true) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) { @@ -50,7 +50,7 @@ class ModuleOperChans : public Module OperChans oc; public: ModuleOperChans(InspIRCd* Me) - : Module(Me), oc(Me) + : Module(Me), oc(Me, this) { if (!ServerInstance->Modes->AddMode(&oc)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index 9caa73d91..e3dafeff3 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -43,9 +43,8 @@ CmdResult ShowOperMOTD(User* user) class CommandOpermotd : public Command { public: - CommandOpermotd (InspIRCd* Instance) : Command(Instance,"OPERMOTD", "o", 0) + CommandOpermotd (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"OPERMOTD", "o", 0) { - this->source = "m_opermotd.so"; syntax = "[<servername>]"; } @@ -78,7 +77,7 @@ class ModuleOpermotd : public Module } ModuleOpermotd(InspIRCd* Me) - : Module(Me), cmd(Me) + : Module(Me), cmd(Me, this) { opermotd = NULL; ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp index 640f2c5d8..d416d5699 100644 --- a/src/modules/m_operprefix.cpp +++ b/src/modules/m_operprefix.cpp @@ -51,7 +51,7 @@ void AddPrefixChan(User* user, Channel* channel) class OperPrefixMode : public ModeHandler { public: - OperPrefixMode(InspIRCd* Instance, char pfx) : ModeHandler(Instance, 'y', 1, 1, true, MODETYPE_CHANNEL, false, pfx, pfx, TR_NICK) { } + OperPrefixMode(InspIRCd* Instance, Module* Creator, char pfx) : ModeHandler(Instance, Creator, 'y', 1, 1, true, MODETYPE_CHANNEL, false, pfx, pfx, TR_NICK) { } unsigned int GetPrefixRank() { @@ -113,7 +113,7 @@ class ModuleOperPrefixMode : public Module ConfigReader Conf(ServerInstance); std::string pfx = Conf.ReadValue("operprefix", "prefix", "!", 0, false); - opm = new OperPrefixMode(ServerInstance, pfx[0]); + opm = new OperPrefixMode(ServerInstance, this, pfx[0]); if ((!ServerInstance->Modes->AddMode(opm))) throw ModuleException("Could not add a new mode!"); diff --git a/src/modules/m_password_hash.cpp b/src/modules/m_password_hash.cpp index e91bedd70..761f52bc4 100644 --- a/src/modules/m_password_hash.cpp +++ b/src/modules/m_password_hash.cpp @@ -23,14 +23,12 @@ typedef std::map<irc::string, Module*> hashymodules; */ class CommandMkpasswd : public Command { - Module* Sender; hashymodules &hashers; std::deque<std::string> &names; public: - CommandMkpasswd (InspIRCd* Instance, Module* S, hashymodules &h, std::deque<std::string> &n) - : Command(Instance,"MKPASSWD", 0, 2), Sender(S), hashers(h), names(n) + CommandMkpasswd (InspIRCd* Instance, Module* Creator, hashymodules &h, std::deque<std::string> &n) + : Command(Instance, Creator, "MKPASSWD", 0, 2), hashers(h), names(n) { - this->source = "m_password_hash.so"; syntax = "<hashtype> <any-text>"; } @@ -41,9 +39,9 @@ class CommandMkpasswd : public Command if (x != hashers.end()) { /* Yup, reset it first (Always ALWAYS do this) */ - HashResetRequest(Sender, x->second).Send(); + HashResetRequest(creator, x->second).Send(); /* Now attempt to generate a hash */ - user->WriteServ("NOTICE %s :%s hashed password for %s is %s",user->nick.c_str(), algo, stuff, HashSumRequest(Sender, x->second, stuff).Send() ); + user->WriteServ("NOTICE %s :%s hashed password for %s is %s",user->nick.c_str(), algo, stuff, HashSumRequest(creator, x->second, stuff).Send() ); } else if (names.empty()) { diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index 67e941d54..100afea9a 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -21,7 +21,7 @@ class PermChannel : public ModeHandler { public: - PermChannel(InspIRCd* Instance) : ModeHandler(Instance, 'P', 0, 0, false, MODETYPE_CHANNEL, false) { } + PermChannel(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'P', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool sm) { @@ -80,7 +80,7 @@ class ModulePermanentChannels : public Module PermChannel p; public: - ModulePermanentChannels(InspIRCd* Me) : Module(Me), p(Me) + ModulePermanentChannels(InspIRCd* Me) : Module(Me), p(Me, this) { if (!ServerInstance->Modes->AddMode(&p)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp index 21cb2257d..a3c0e8d13 100644 --- a/src/modules/m_randquote.cpp +++ b/src/modules/m_randquote.cpp @@ -26,9 +26,8 @@ std::string suffix; class CommandRandquote : public Command { public: - CommandRandquote (InspIRCd* Instance) : Command(Instance,"RANDQUOTE", 0, 0) + CommandRandquote (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"RANDQUOTE", 0, 0) { - this->source = "m_randquote.so"; } CmdResult Handle (const std::vector<std::string>& parameters, User *user) @@ -59,7 +58,7 @@ class ModuleRandQuote : public Module ConfigReader *conf; public: ModuleRandQuote(InspIRCd* Me) - : Module(Me), cmd(Me) + : Module(Me), cmd(Me, this) { conf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp index 1a5a48b00..fc743402e 100644 --- a/src/modules/m_redirect.cpp +++ b/src/modules/m_redirect.cpp @@ -20,7 +20,7 @@ class Redirect : public ModeHandler { public: - Redirect(InspIRCd* Instance) : ModeHandler(Instance, 'L', 1, 0, false, MODETYPE_CHANNEL, false) { } + Redirect(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'L', 1, 0, false, MODETYPE_CHANNEL, false) { } ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter) { @@ -90,7 +90,7 @@ class ModuleRedirect : public Module public: ModuleRedirect(InspIRCd* Me) - : Module(Me), re(Me) + : Module(Me), re(Me, this) { if (!ServerInstance->Modes->AddMode(&re)) diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index c86565b5f..49c74d9ce 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -206,9 +206,9 @@ class RemoveBase class CommandRemove : public Command, public RemoveBase { public: - CommandRemove(InspIRCd* Instance, bool& snk) : Command(Instance, "REMOVE", 0, 2, 2, false, 0), RemoveBase(Instance, snk) + CommandRemove(InspIRCd* Instance, Module* Creator, bool& snk) + : Command(Instance, Creator, "REMOVE", 0, 2, 2, false, 0), RemoveBase(Instance, snk) { - this->source = "m_remove.so"; syntax = "<nick> <channel> [<reason>]"; TRANSLATE4(TR_NICK, TR_TEXT, TR_TEXT, TR_END); } @@ -224,9 +224,9 @@ class CommandRemove : public Command, public RemoveBase class CommandFpart : public Command, public RemoveBase { public: - CommandFpart(InspIRCd* Instance, bool& snk) : Command(Instance, "FPART", 0, 2), RemoveBase(Instance, snk) + CommandFpart(InspIRCd* Instance, Module* Creator, bool& snk) + : Command(Instance, Creator, "FPART", 0, 2), RemoveBase(Instance, snk) { - this->source = "m_remove.so"; syntax = "<channel> <nick> [<reason>]"; } @@ -245,7 +245,7 @@ class ModuleRemove : public Module public: ModuleRemove(InspIRCd* Me) - : Module(Me), cmd1(Me, supportnokicks), cmd2(Me, supportnokicks) + : Module(Me), cmd1(Me, this, supportnokicks), cmd2(Me, this, supportnokicks) { ServerInstance->AddCommand(&cmd1); ServerInstance->AddCommand(&cmd2); diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index 26c6f0ab8..843470f39 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -121,9 +121,8 @@ class CommandRLine : public Command std::string rxengine; public: - CommandRLine (InspIRCd* Instance) : Command(Instance,"RLINE", "o", 1, 3) + CommandRLine (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"RLINE", "o", 1, 3) { - this->source = "m_rline.so"; this->syntax = "<regex> [<rline-duration>] :<reason>"; } @@ -194,7 +193,7 @@ class ModuleRLine : public Module std::string RegexEngine; public: - ModuleRLine(InspIRCd* Me) : Module(Me), r(Me), f(Me) + ModuleRLine(InspIRCd* Me) : Module(Me), r(Me, this), f(Me) { mymodule = this; OnRehash(NULL); diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index 8fad7bc42..f40451dfa 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -20,9 +20,8 @@ class CommandSajoin : public Command { public: - CommandSajoin (InspIRCd* Instance) : Command(Instance,"SAJOIN", "o", 2, false, 0) + CommandSajoin (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SAJOIN", "o", 2, false, 0) { - this->source = "m_sajoin.so"; syntax = "<nick> <channel>"; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -91,7 +90,7 @@ class ModuleSajoin : public Module CommandSajoin cmd; public: ModuleSajoin(InspIRCd* Me) - : Module(Me), cmd(Me) + : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_sakick.cpp b/src/modules/m_sakick.cpp index feceeee99..860f18132 100644 --- a/src/modules/m_sakick.cpp +++ b/src/modules/m_sakick.cpp @@ -20,9 +20,8 @@ class CommandSakick : public Command { public: - CommandSakick (InspIRCd* Instance) : Command(Instance,"SAKICK", "o", 2, 3, false, 0) + CommandSakick (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SAKICK", "o", 2, 3, false, 0) { - this->source = "m_sakick.so"; syntax = "<channel> <nick> [reason]"; TRANSLATE4(TR_TEXT, TR_NICK, TR_TEXT, TR_END); } @@ -91,7 +90,7 @@ class ModuleSakick : public Module CommandSakick cmd; public: ModuleSakick(InspIRCd* Me) - : Module(Me), cmd(Me) + : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index 0011e7076..ccd40a3e7 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -20,9 +20,8 @@ class CommandSamode : public Command { public: - CommandSamode (InspIRCd* Instance) : Command(Instance,"SAMODE", "o", 2, false, 0) + CommandSamode (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SAMODE", "o", 2, false, 0) { - this->source = "m_samode.so"; syntax = "<target> <modes> {<mode-parameters>}"; } @@ -57,7 +56,7 @@ class ModuleSaMode : public Module CommandSamode cmd; public: ModuleSaMode(InspIRCd* Me) - : Module(Me), cmd(Me) + : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp index 180e4ba81..087f04948 100644 --- a/src/modules/m_sanick.cpp +++ b/src/modules/m_sanick.cpp @@ -20,9 +20,8 @@ class CommandSanick : public Command { public: - CommandSanick (InspIRCd* Instance) : Command(Instance,"SANICK", "o", 2, false, 0) + CommandSanick (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SANICK", "o", 2, false, 0) { - this->source = "m_sanick.so"; syntax = "<nick> <new-nick>"; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -83,7 +82,7 @@ class ModuleSanick : public Module CommandSanick cmd; public: ModuleSanick(InspIRCd* Me) - : Module(Me), cmd(Me) + : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index ba5387901..a44131129 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -20,9 +20,8 @@ class CommandSapart : public Command { public: - CommandSapart (InspIRCd* Instance) : Command(Instance,"SAPART", "o", 2, 3, false, 0) + CommandSapart (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SAPART", "o", 2, 3, false, 0) { - this->source = "m_sapart.so"; syntax = "<nick> <channel> [reason]"; TRANSLATE4(TR_NICK, TR_TEXT, TR_TEXT, TR_END); } @@ -91,7 +90,7 @@ class ModuleSapart : public Module CommandSapart cmd; public: ModuleSapart(InspIRCd* Me) - : Module(Me), cmd(Me) + : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index 8bd1664c6..6f0a20f9a 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -20,9 +20,8 @@ class CommandSaquit : public Command { public: - CommandSaquit (InspIRCd* Instance) : Command(Instance, "SAQUIT", "o", 2, 2, false, 0) + CommandSaquit (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator, "SAQUIT", "o", 2, 2, false, 0) { - this->source = "m_saquit.so"; syntax = "<nick> <reason>"; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -61,7 +60,7 @@ class ModuleSaquit : public Module CommandSaquit cmd; public: ModuleSaquit(InspIRCd* Me) - : Module(Me), cmd(Me) + : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index 08f136374..45984b230 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -27,7 +27,6 @@ class SaslAuthenticator : public classbase { private: InspIRCd *ServerInstance; - Module *Creator; std::string agent; User *user; SaslState state; @@ -36,7 +35,7 @@ class SaslAuthenticator : public classbase public: SaslAuthenticator(User *user_, std::string method, InspIRCd *instance, Module *ctor) - : ServerInstance(instance), Creator(ctor), user(user_), state(SASL_INIT), state_announced(false) + : ServerInstance(instance), user(user_), state(SASL_INIT), state_announced(false) { this->user->Extend("sasl_authenticator", this); @@ -158,11 +157,9 @@ class SaslAuthenticator : public classbase class CommandAuthenticate : public Command { - Module* Creator; public: - CommandAuthenticate (InspIRCd* Instance, Module* creator) : Command(Instance,"AUTHENTICATE", 0, 1, true), Creator(creator) + CommandAuthenticate (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator, "AUTHENTICATE", 0, 1, true) { - this->source = "m_sasl.so"; } CmdResult Handle (const std::vector<std::string>& parameters, User *user) @@ -175,7 +172,7 @@ class CommandAuthenticate : public Command SaslAuthenticator *sasl; if (!(user->GetExt("sasl_authenticator", sasl))) - sasl = new SaslAuthenticator(user, parameters[0], ServerInstance, Creator); + sasl = new SaslAuthenticator(user, parameters[0], ServerInstance, creator); else if (sasl->SendClientMessage(parameters) == false) // IAL abort extension --nenolod delete sasl; } @@ -185,11 +182,9 @@ class CommandAuthenticate : public Command class CommandSASL : public Command { - Module* Creator; public: - CommandSASL(InspIRCd* Instance, Module* creator) : Command(Instance, "SASL", 0, 2), Creator(creator) + CommandSASL(InspIRCd* Instance, Module* Creator) : Command(Instance, Creator, "SASL", 0, 2) { - this->source = "m_sasl.so"; this->disabled = true; // should not be called by users } diff --git a/src/modules/m_satopic.cpp b/src/modules/m_satopic.cpp index 7414058df..dfe145051 100644 --- a/src/modules/m_satopic.cpp +++ b/src/modules/m_satopic.cpp @@ -20,10 +20,9 @@ class CommandSATopic : public Command { public: - CommandSATopic (InspIRCd* Instance) - : Command(Instance,"SATOPIC", "o", 2, 2, false, 0) + CommandSATopic (InspIRCd* Instance, Module* Creator) + : Command(Instance,Creator,"SATOPIC", "o", 2, 2, false, 0) { - this->source = "m_satopic.so"; syntax = "<target> <topic>"; } @@ -58,7 +57,7 @@ class ModuleSATopic : public Module CommandSATopic cmd; public: ModuleSATopic(InspIRCd* Me) - : Module(Me), cmd(Me) + : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index 30baccadf..e32973bd0 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -22,7 +22,7 @@ class Channel_r : public ModeHandler { public: - Channel_r(InspIRCd* Instance) : ModeHandler(Instance, 'r', 0, 0, false, MODETYPE_CHANNEL, false) { } + Channel_r(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'r', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) { @@ -52,7 +52,7 @@ class User_r : public ModeHandler { public: - User_r(InspIRCd* Instance) : ModeHandler(Instance, 'r', 0, 0, false, MODETYPE_USER, false) { } + User_r(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'r', 0, 0, false, MODETYPE_USER, false) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool servermode) { @@ -78,7 +78,7 @@ class User_r : public ModeHandler class AChannel_R : public SimpleChannelModeHandler { public: - AChannel_R(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'R') { } + AChannel_R(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'R') { } }; /** User mode +R - unidentified users cannot message @@ -86,7 +86,7 @@ class AChannel_R : public SimpleChannelModeHandler class AUser_R : public SimpleUserModeHandler { public: - AUser_R(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'R') { } + AUser_R(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Instance, Creator, 'R') { } }; /** Channel mode +M - unidentified users cannot message channel @@ -94,7 +94,7 @@ class AUser_R : public SimpleUserModeHandler class AChannel_M : public SimpleChannelModeHandler { public: - AChannel_M(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'M') { } + AChannel_M(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'M') { } }; class ModuleServicesAccount : public Module @@ -106,7 +106,7 @@ class ModuleServicesAccount : public Module User_r m5; public: ModuleServicesAccount(InspIRCd* Me) : Module(Me), - m1(Me), m2(Me), m3(Me), m4(Me), m5(Me) + m1(Me, this), m2(Me, this), m3(Me, this), m4(Me, this), m5(Me, this) { if (!ServerInstance->Modes->AddMode(&m1) || !ServerInstance->Modes->AddMode(&m2) || diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp index 22aad400e..9a1da8465 100644 --- a/src/modules/m_servprotect.cpp +++ b/src/modules/m_servprotect.cpp @@ -20,7 +20,7 @@ class ServProtectMode : public ModeHandler { public: - ServProtectMode(InspIRCd* Instance) : ModeHandler(Instance, 'k', 0, 0, false, MODETYPE_USER, true) { } + ServProtectMode(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'k', 0, 0, false, MODETYPE_USER, true) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) { @@ -44,7 +44,7 @@ class ModuleServProtectMode : public Module ServProtectMode bm; public: ModuleServProtectMode(InspIRCd* Me) - : Module(Me), bm(Me) + : Module(Me), bm(Me, this) { if (!ServerInstance->Modes->AddMode(&bm)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index a925e75c3..8442167cf 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -22,9 +22,8 @@ class CommandSethost : public Command private: char* hostmap; public: - CommandSethost (InspIRCd* Instance, char* hmap) : Command(Instance,"SETHOST","o",1), hostmap(hmap) + CommandSethost (InspIRCd* Instance, Module* Creator, char* hmap) : Command(Instance,Creator,"SETHOST","o",1), hostmap(hmap) { - this->source = "m_sethost.so"; syntax = "<new-hostname>"; TRANSLATE2(TR_TEXT, TR_END); } @@ -68,7 +67,7 @@ class ModuleSetHost : public Module char hostmap[256]; public: ModuleSetHost(InspIRCd* Me) - : Module(Me), cmd(Me, hostmap) + : Module(Me), cmd(Me, this, hostmap) { OnRehash(NULL); ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp index 7823b041b..93099fc74 100644 --- a/src/modules/m_setident.cpp +++ b/src/modules/m_setident.cpp @@ -20,9 +20,8 @@ class CommandSetident : public Command { public: - CommandSetident (InspIRCd* Instance) : Command(Instance,"SETIDENT", "o", 1) + CommandSetident (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SETIDENT", "o", 1) { - this->source = "m_setident.so"; syntax = "<new-ident>"; TRANSLATE2(TR_TEXT, TR_END); } @@ -60,7 +59,7 @@ class ModuleSetIdent : public Module CommandSetident cmd; public: - ModuleSetIdent(InspIRCd* Me) : Module(Me), cmd(Me) + ModuleSetIdent(InspIRCd* Me) : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp index 468102675..4954e14dd 100644 --- a/src/modules/m_setidle.cpp +++ b/src/modules/m_setidle.cpp @@ -20,9 +20,8 @@ class CommandSetidle : public Command { public: - CommandSetidle (InspIRCd* Instance) : Command(Instance,"SETIDLE", "o", 1) + CommandSetidle (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SETIDLE", "o", 1) { - this->source = "m_setidle.so"; syntax = "<duration>"; TRANSLATE2(TR_TEXT, TR_END); } @@ -52,7 +51,7 @@ class ModuleSetIdle : public Module CommandSetidle cmd; public: ModuleSetIdle(InspIRCd* Me) - : Module(Me), cmd(Me) + : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp index 00c76c848..6cd94c982 100644 --- a/src/modules/m_setname.cpp +++ b/src/modules/m_setname.cpp @@ -20,9 +20,8 @@ class CommandSetname : public Command { public: - CommandSetname (InspIRCd* Instance) : Command(Instance,"SETNAME", 0, 1, 1) + CommandSetname (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SETNAME", 0, 1, 1) { - this->source = "m_setname.so"; syntax = "<new-gecos>"; TRANSLATE2(TR_TEXT, TR_END); } @@ -57,7 +56,7 @@ class ModuleSetName : public Module CommandSetname cmd; public: ModuleSetName(InspIRCd* Me) - : Module(Me), cmd(Me) + : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp index 7464a0d21..bbc89a2b4 100644 --- a/src/modules/m_showwhois.cpp +++ b/src/modules/m_showwhois.cpp @@ -20,7 +20,7 @@ class SeeWhois : public ModeHandler { public: - SeeWhois(InspIRCd* Instance, bool IsOpersOnly) : ModeHandler(Instance, 'W', 0, 0, false, MODETYPE_USER, IsOpersOnly) { } + SeeWhois(InspIRCd* Instance, Module* Creator, bool IsOpersOnly) : ModeHandler(Instance, Creator, 'W', 0, 0, false, MODETYPE_USER, IsOpersOnly) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) { @@ -48,9 +48,8 @@ class SeeWhois : public ModeHandler class WhoisNoticeCmd : public Command { public: - WhoisNoticeCmd(InspIRCd* Instance) : Command(Instance,"WHOISNOTICE", 0, 1) + WhoisNoticeCmd(InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"WHOISNOTICE", 0, 1) { - this->source = "m_showwhois.cpp"; } void HandleFast(User* dest, User* src) @@ -79,13 +78,13 @@ class ModuleShowwhois : public Module public: - ModuleShowwhois(InspIRCd* Me) : Module(Me), cmd(Me) + ModuleShowwhois(InspIRCd* Me) : Module(Me), cmd(Me, this) { ConfigReader conf(ServerInstance); bool OpersOnly = conf.ReadFlag("showwhois", "opersonly", "yes", 0); ShowWhoisFromOpers = conf.ReadFlag("showwhois", "showfromopers", "yes", 0); - sw = new SeeWhois(ServerInstance, OpersOnly); + sw = new SeeWhois(ServerInstance, this, OpersOnly); if (!ServerInstance->Modes->AddMode(sw)) throw ModuleException("Could not add new modes!"); ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index 8a0ca2aa3..9e3a03583 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -87,9 +87,8 @@ class ShunFactory : public XLineFactory class CommandShun : public Command { public: - CommandShun(InspIRCd* Me) : Command(Me, "SHUN", "o", 1, 3) + CommandShun(InspIRCd* Me, Module* Creator) : Command(Me, Creator, "SHUN", "o", 1, 3) { - this->source = "m_shun.so"; this->syntax = "<nick!user@hostmask> [<shun-duration>] :<reason>"; } @@ -183,7 +182,7 @@ class ModuleShun : public Module bool affectopers; public: - ModuleShun(InspIRCd* Me) : Module(Me), cmd(Me), f(Me) + ModuleShun(InspIRCd* Me) : Module(Me), cmd(Me, this), f(Me) { ServerInstance->XLines->RegisterFactory(&f); ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 0786c4da4..0f851f15c 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -53,9 +53,8 @@ static int SILENCE_EXCLUDE = 0x0040; /* x exclude this pattern */ class CommandSVSSilence : public Command { public: - CommandSVSSilence(InspIRCd* Instance) : Command(Instance,"SVSSILENCE", 0, 2) + CommandSVSSilence(InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SVSSILENCE", 0, 2) { - this->source = "m_silence.so"; syntax = "<target> {[+|-]<mask> <p|c|i|n|t|a|x>}"; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); /* we watch for a nick. not a UID. */ } @@ -89,9 +88,8 @@ class CommandSilence : public Command { unsigned int& maxsilence; public: - CommandSilence (InspIRCd* Instance, unsigned int &max) : Command(Instance,"SILENCE", 0, 0), maxsilence(max) + CommandSilence (InspIRCd* Instance, Module* Creator, unsigned int &max) : Command(Instance, Creator, "SILENCE", 0, 0), maxsilence(max) { - this->source = "m_silence.so"; syntax = "{[+|-]<mask> <p|c|i|n|t|a|x>}"; TRANSLATE3(TR_TEXT, TR_TEXT, TR_END); } @@ -272,7 +270,7 @@ class ModuleSilence : public Module public: ModuleSilence(InspIRCd* Me) - : Module(Me), maxsilence(32), cmdsilence(Me, maxsilence), cmdsvssilence(Me) + : Module(Me), maxsilence(32), cmdsilence(Me, this, maxsilence), cmdsvssilence(Me, this) { OnRehash(NULL); ServerInstance->AddCommand(&cmdsilence); diff --git a/src/modules/m_spanningtree/postcommand.cpp b/src/modules/m_spanningtree/postcommand.cpp index 545ad3bfb..0988fe099 100644 --- a/src/modules/m_spanningtree/postcommand.cpp +++ b/src/modules/m_spanningtree/postcommand.cpp @@ -60,11 +60,11 @@ void ModuleSpanningTree::OnPostCommand(const std::string &command, const std::ve } else { - Module* srcmodule = ServerInstance->Modules->Find(thiscmd->source); + Module* srcmodule = thiscmd->creator; if (srcmodule && !(srcmodule->GetVersion().Flags & VF_COMMON)) { ServerInstance->Logs->Log("m_spanningtree",ERROR,"Routed command %s from non-VF_COMMON module %s", - command.c_str(), thiscmd->source.c_str()); + command.c_str(), srcmodule->ModuleSourceFile.c_str()); return; } } diff --git a/src/modules/m_spanningtree/rconnect.cpp b/src/modules/m_spanningtree/rconnect.cpp index 3275d057e..3e084dc19 100644 --- a/src/modules/m_spanningtree/rconnect.cpp +++ b/src/modules/m_spanningtree/rconnect.cpp @@ -28,9 +28,9 @@ /* $ModDep: m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/rconnect.h */ -CommandRConnect::CommandRConnect (InspIRCd* Instance, Module* Callback, SpanningTreeUtilities* Util) : Command(Instance, "RCONNECT", "o", 2), Creator(Callback), Utils(Util) +CommandRConnect::CommandRConnect (InspIRCd* Instance, Module* Creator, SpanningTreeUtilities* Util) + : Command(Instance, Creator, "RCONNECT", "o", 2), Utils(Util) { - this->source = "m_spanningtree.so"; syntax = "<remote-server-mask> <target-server-mask>"; } @@ -55,7 +55,7 @@ CmdResult CommandRConnect::Handle (const std::vector<std::string>& parameters, U para.push_back(parameters[1]); std::string cmd("CONNECT"); std::string original_command = cmd + " " + parameters[1]; - Creator->OnPreCommand(cmd, para, user, true, original_command); + creator->OnPreCommand(cmd, para, user, true, original_command); } return CMD_SUCCESS; } diff --git a/src/modules/m_spanningtree/rconnect.h b/src/modules/m_spanningtree/rconnect.h index a9958c554..f038f5c22 100644 --- a/src/modules/m_spanningtree/rconnect.h +++ b/src/modules/m_spanningtree/rconnect.h @@ -18,7 +18,6 @@ */ class CommandRConnect : public Command { - Module* Creator; /* Creator */ SpanningTreeUtilities* Utils; /* Utility class */ public: CommandRConnect (InspIRCd* Instance, Module* Callback, SpanningTreeUtilities* Util); diff --git a/src/modules/m_spanningtree/rsquit.cpp b/src/modules/m_spanningtree/rsquit.cpp index a5dd31752..e9c69a1d4 100644 --- a/src/modules/m_spanningtree/rsquit.cpp +++ b/src/modules/m_spanningtree/rsquit.cpp @@ -26,9 +26,9 @@ /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h m_spanningtree/rsquit.h */ -CommandRSQuit::CommandRSQuit (InspIRCd* Instance, Module* Callback, SpanningTreeUtilities* Util) : Command(Instance, "RSQUIT", "o", 1), Creator(Callback), Utils(Util) +CommandRSQuit::CommandRSQuit (InspIRCd* Instance, Module* Creator, SpanningTreeUtilities* Util) + : Command(Instance, Creator, "RSQUIT", "o", 1), Utils(Util) { - this->source = "m_spanningtree.so"; syntax = "<target-server-mask> [reason]"; } diff --git a/src/modules/m_spanningtree/rsquit.h b/src/modules/m_spanningtree/rsquit.h index 96af64108..92f6eb159 100644 --- a/src/modules/m_spanningtree/rsquit.h +++ b/src/modules/m_spanningtree/rsquit.h @@ -18,7 +18,6 @@ */ class CommandRSQuit : public Command { - Module* Creator; /* Creator */ SpanningTreeUtilities* Utils; /* Utility class */ public: CommandRSQuit (InspIRCd* Instance, Module* Callback, SpanningTreeUtilities* Util); diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index 185df5375..93f2a71db 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -21,9 +21,8 @@ class CommandSSLInfo : public Command { public: - CommandSSLInfo (InspIRCd* Instance) : Command(Instance,"SSLINFO", 0, 1) + CommandSSLInfo(InspIRCd* Instance, Module* Creator) : Command(Instance, Creator, "SSLINFO", 0, 1) { - this->source = "m_sslinfo.so"; this->syntax = "<nick>"; } @@ -66,7 +65,7 @@ class ModuleSSLInfo : public Module CommandSSLInfo cmd; public: ModuleSSLInfo(InspIRCd* Me) - : Module(Me), cmd(Me) + : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp index ccedd5aa2..641d68544 100644 --- a/src/modules/m_sslmodes.cpp +++ b/src/modules/m_sslmodes.cpp @@ -22,7 +22,7 @@ static char* dummy; class SSLMode : public ModeHandler { public: - SSLMode(InspIRCd* Instance) : ModeHandler(Instance, 'z', 0, 0, false, MODETYPE_CHANNEL, false) { } + SSLMode(InspIRCd* Instance, Module* Creator) : ModeHandler(Instance, Creator, 'z', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool) { @@ -70,7 +70,7 @@ class ModuleSSLModes : public Module public: ModuleSSLModes(InspIRCd* Me) - : Module(Me), sslm(Me) + : Module(Me), sslm(Me, this) { if (!ServerInstance->Modes->AddMode(&sslm)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp index 4c5e7c028..ce98103e1 100644 --- a/src/modules/m_stripcolor.cpp +++ b/src/modules/m_stripcolor.cpp @@ -20,7 +20,7 @@ class ChannelStripColor : public SimpleChannelModeHandler { public: - ChannelStripColor(InspIRCd* Instance) : SimpleChannelModeHandler(Instance, 'S') { } + ChannelStripColor(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'S') { } }; /** Handles user mode +S @@ -28,7 +28,7 @@ class ChannelStripColor : public SimpleChannelModeHandler class UserStripColor : public SimpleUserModeHandler { public: - UserStripColor(InspIRCd* Instance) : SimpleUserModeHandler(Instance, 'S') { } + UserStripColor(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Instance, Creator, 'S') { } }; @@ -39,7 +39,7 @@ class ModuleStripColor : public Module UserStripColor usc; public: - ModuleStripColor(InspIRCd* Me) : Module(Me), csc(Me), usc(Me) + ModuleStripColor(InspIRCd* Me) : Module(Me), csc(Me, this), usc(Me, this) { if (!ServerInstance->Modes->AddMode(&usc) || !ServerInstance->Modes->AddMode(&csc)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp index eae168d6b..e0bf5a54c 100644 --- a/src/modules/m_svshold.cpp +++ b/src/modules/m_svshold.cpp @@ -79,9 +79,8 @@ class SVSHoldFactory : public XLineFactory class CommandSvshold : public Command { public: - CommandSvshold(InspIRCd* Me) : Command(Me, "SVSHOLD", "o", 1) + CommandSvshold(InspIRCd* Me, Module* Creator) : Command(Me, Creator, "SVSHOLD", "o", 1) { - this->source = "m_svshold.so"; this->syntax = "<nickname> [<duration> :<reason>]"; TRANSLATE4(TR_NICK, TR_TEXT, TR_TEXT, TR_END); } @@ -149,7 +148,7 @@ class ModuleSVSHold : public Module public: - ModuleSVSHold(InspIRCd* Me) : Module(Me), cmd(Me), s(Me) + ModuleSVSHold(InspIRCd* Me) : Module(Me), cmd(Me, this), s(Me) { ServerInstance->XLines->RegisterFactory(&s); ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index 9939a83a2..75a0a4cdd 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -21,9 +21,8 @@ class CommandSwhois : public Command { public: - CommandSwhois (InspIRCd* Instance) : Command(Instance,"SWHOIS","o",2, 2) + CommandSwhois (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SWHOIS","o",2, 2) { - this->source = "m_swhois.so"; syntax = "<nick> :<swhois>"; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -85,7 +84,7 @@ class ModuleSWhois : public Module ConfigReader* Conf; public: - ModuleSWhois(InspIRCd* Me) : Module(Me), cmd(Me) + ModuleSWhois(InspIRCd* Me) : Module(Me), cmd(Me, this) { Conf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_taxonomy.cpp b/src/modules/m_taxonomy.cpp index 83ee05749..7be719bd3 100644 --- a/src/modules/m_taxonomy.cpp +++ b/src/modules/m_taxonomy.cpp @@ -19,12 +19,10 @@ */ class CommandTaxonomy : public Command { - Module* Creator; public: /* Command 'taxonomy', takes no parameters and needs no special modes */ - CommandTaxonomy (InspIRCd* Instance, Module* maker) : Command(Instance,"TAXONOMY", "o", 1), Creator(maker) + CommandTaxonomy (InspIRCd* Instance, Module* maker) : Command(Instance,maker,"TAXONOMY", "o", 1) { - this->source = "m_taxonomy.so"; syntax = "<nickname>"; } @@ -36,7 +34,7 @@ class CommandTaxonomy : public Command std::deque<std::string> list; dest->GetExtList(list); user->WriteNumeric(304, "" + std::string(user->nick) + ":TAXONOMY ITEMS " + std::string(dest->nick) + " " +ConvToStr(list.size())); - FOREACH_MOD(I_OnSyncUser, OnSyncUser(dest, Creator, user)); + FOREACH_MOD(I_OnSyncUser, OnSyncUser(dest, creator, user)); user->WriteNumeric(304, "" + std::string(user->nick) + ":TAXONOMY END"); } return CMD_LOCALONLY; diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 31896bfcb..c27acbd38 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -33,9 +33,8 @@ timedbans TimedBanList; class CommandTban : public Command { public: - CommandTban (InspIRCd* Instance) : Command(Instance,"TBAN", 0, 3) + CommandTban (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"TBAN", 0, 3) { - this->source = "m_timedbans.so"; syntax = "<channel> <duration> <banmask>"; TRANSLATE4(TR_TEXT, TR_TEXT, TR_TEXT, TR_END); } @@ -115,7 +114,7 @@ class ModuleTimedBans : public Module CommandTban cmd; public: ModuleTimedBans(InspIRCd* Me) - : Module(Me), cmd(Me) + : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); TimedBanList.clear(); diff --git a/src/modules/m_tline.cpp b/src/modules/m_tline.cpp index 2ce4692bb..0efd496c6 100644 --- a/src/modules/m_tline.cpp +++ b/src/modules/m_tline.cpp @@ -20,9 +20,8 @@ class CommandTline : public Command { public: - CommandTline (InspIRCd* Instance) : Command(Instance,"TLINE", "o", 1) + CommandTline (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"TLINE", "o", 1) { - this->source = "m_tline.so"; this->syntax = "<mask>"; } @@ -65,7 +64,7 @@ class ModuleTLine : public Module CommandTline cmd; public: ModuleTLine(InspIRCd* Me) - : Module(Me), cmd(Me) + : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp index 2cadc8524..733295029 100644 --- a/src/modules/m_uninvite.cpp +++ b/src/modules/m_uninvite.cpp @@ -20,9 +20,8 @@ class CommandUninvite : public Command { public: - CommandUninvite (InspIRCd* Instance) : Command(Instance,"UNINVITE", 0, 2) + CommandUninvite (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"UNINVITE", 0, 2) { - this->source = "m_uninvite.so"; syntax = "<nick> <channel>"; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -83,7 +82,7 @@ class ModuleUninvite : public Module public: - ModuleUninvite(InspIRCd* Me) : Module(Me), cmd(Me) + ModuleUninvite(InspIRCd* Me) : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index 8600546bc..75981b5cc 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -20,9 +20,8 @@ class CommandUserip : public Command { public: - CommandUserip (InspIRCd* Instance) : Command(Instance,"USERIP", "o", 1) + CommandUserip (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"USERIP", "o", 1) { - this->source = "m_userip.so"; syntax = "<nick>{,<nick>}"; } @@ -59,7 +58,7 @@ class ModuleUserIP : public Module CommandUserip cmd; public: ModuleUserIP(InspIRCd* Me) - : Module(Me), cmd(Me) + : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); Implementation eventlist[] = { I_On005Numeric }; diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp index 005177cdb..419b51c9b 100644 --- a/src/modules/m_vhost.cpp +++ b/src/modules/m_vhost.cpp @@ -20,9 +20,8 @@ class CommandVhost : public Command { public: - CommandVhost (InspIRCd* Instance) : Command(Instance,"VHOST", 0, 2) + CommandVhost (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"VHOST", 0, 2) { - this->source = "m_vhost.so"; syntax = "<username> <password>"; } @@ -61,7 +60,7 @@ class ModuleVHost : public Module CommandVhost cmd; public: - ModuleVHost(InspIRCd* Me) : Module(Me), cmd(Me) + ModuleVHost(InspIRCd* Me) : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index 9b98ca83b..6d719d13d 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -103,9 +103,8 @@ watchentries* whos_watching_me; class CommandSVSWatch : public Command { public: - CommandSVSWatch (InspIRCd* Instance) : Command(Instance,"SVSWATCH", 0, 2) + CommandSVSWatch (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SVSWATCH", 0, 2) { - this->source = "m_watch.so"; syntax = "<target> [C|L|S]|[+|-<nick>]"; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); /* we watch for a nick. not a UID. */ } @@ -251,9 +250,8 @@ class CommandWatch : public Command return CMD_LOCALONLY; } - CommandWatch (InspIRCd* Instance, unsigned int &maxwatch) : Command(Instance,"WATCH",0,0), MAX_WATCH(maxwatch) + CommandWatch (InspIRCd* Instance, Module* parent, unsigned int &maxwatch) : Command(Instance,parent,"WATCH",0,0), MAX_WATCH(maxwatch) { - this->source = "m_watch.so"; syntax = "[C|L|S]|[+|-<nick>]"; TRANSLATE2(TR_TEXT, TR_END); /* we watch for a nick. not a UID. */ } @@ -373,7 +371,7 @@ class Modulewatch : public Module public: Modulewatch(InspIRCd* Me) - : Module(Me), maxwatch(32), cmdw(Me, maxwatch), sw(Me) + : Module(Me), maxwatch(32), cmdw(Me, this, maxwatch), sw(Me,this) { OnRehash(NULL); whos_watching_me = new watchentries(); |