From 24731c63b6320be22f7b3220236271fa7476b975 Mon Sep 17 00:00:00 2001 From: danieldg Date: Wed, 2 Sep 2009 00:48:48 +0000 Subject: Add Module* creator to Command and ModeHandler git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11631 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/extra/m_ssl_gnutls.cpp | 8 +++----- src/modules/m_allowinvite.cpp | 4 ++-- src/modules/m_alltime.cpp | 5 ++--- src/modules/m_auditorium.cpp | 4 ++-- src/modules/m_banexception.cpp | 4 ++-- src/modules/m_banredirect.cpp | 3 +-- src/modules/m_blockcaps.cpp | 4 ++-- src/modules/m_blockcolor.cpp | 4 ++-- src/modules/m_botmode.cpp | 4 ++-- src/modules/m_callerid.cpp | 13 +++++-------- src/modules/m_cap.cpp | 16 +++++++--------- src/modules/m_cban.cpp | 5 ++--- src/modules/m_censor.cpp | 6 +++--- src/modules/m_cgiirc.cpp | 6 +++--- src/modules/m_chanfilter.cpp | 4 ++-- src/modules/m_chanprotect.cpp | 12 ++++++------ src/modules/m_check.cpp | 8 +++----- src/modules/m_chghost.cpp | 5 ++--- src/modules/m_chgident.cpp | 5 ++--- src/modules/m_chgname.cpp | 5 ++--- src/modules/m_cloaking.cpp | 26 +++++++++++++------------- src/modules/m_clones.cpp | 5 ++--- src/modules/m_close.cpp | 5 ++--- src/modules/m_commonchans.cpp | 4 ++-- src/modules/m_customtitle.cpp | 5 ++--- src/modules/m_cycle.cpp | 5 ++--- src/modules/m_dccallow.cpp | 5 ++--- src/modules/m_deaf.cpp | 4 ++-- src/modules/m_delayjoin.cpp | 5 ++--- src/modules/m_delaymsg.cpp | 3 +-- src/modules/m_devoice.cpp | 5 ++--- src/modules/m_filter.cpp | 4 ++-- src/modules/m_globalload.cpp | 11 ++++------- src/modules/m_globops.cpp | 5 ++--- src/modules/m_helpop.cpp | 7 +++---- src/modules/m_hidechans.cpp | 4 ++-- src/modules/m_hideoper.cpp | 4 ++-- src/modules/m_invisible.cpp | 4 ++-- src/modules/m_inviteexception.cpp | 4 ++-- src/modules/m_joinflood.cpp | 4 ++-- src/modules/m_jumpserver.cpp | 5 ++--- src/modules/m_kicknorejoin.cpp | 4 ++-- src/modules/m_knock.cpp | 7 +++---- src/modules/m_lockserv.cpp | 14 +++++--------- src/modules/m_messageflood.cpp | 4 ++-- src/modules/m_nickflood.cpp | 4 ++-- src/modules/m_nicklock.cpp | 12 +++++------- src/modules/m_noctcp.cpp | 4 ++-- src/modules/m_nokicks.cpp | 4 ++-- src/modules/m_nonicks.cpp | 4 ++-- src/modules/m_nonotice.cpp | 4 ++-- src/modules/m_operchans.cpp | 4 ++-- src/modules/m_opermotd.cpp | 5 ++--- src/modules/m_operprefix.cpp | 4 ++-- src/modules/m_password_hash.cpp | 10 ++++------ src/modules/m_permchannels.cpp | 4 ++-- src/modules/m_randquote.cpp | 5 ++--- src/modules/m_redirect.cpp | 4 ++-- src/modules/m_remove.cpp | 10 +++++----- src/modules/m_rline.cpp | 5 ++--- src/modules/m_sajoin.cpp | 5 ++--- src/modules/m_sakick.cpp | 5 ++--- src/modules/m_samode.cpp | 5 ++--- src/modules/m_sanick.cpp | 5 ++--- src/modules/m_sapart.cpp | 5 ++--- src/modules/m_saquit.cpp | 5 ++--- src/modules/m_sasl.cpp | 13 ++++--------- src/modules/m_satopic.cpp | 7 +++---- src/modules/m_services_account.cpp | 12 ++++++------ src/modules/m_servprotect.cpp | 4 ++-- src/modules/m_sethost.cpp | 5 ++--- src/modules/m_setident.cpp | 5 ++--- src/modules/m_setidle.cpp | 5 ++--- src/modules/m_setname.cpp | 5 ++--- src/modules/m_showwhois.cpp | 9 ++++----- src/modules/m_shun.cpp | 5 ++--- src/modules/m_silence.cpp | 8 +++----- src/modules/m_spanningtree/postcommand.cpp | 4 ++-- src/modules/m_spanningtree/rconnect.cpp | 6 +++--- src/modules/m_spanningtree/rconnect.h | 1 - src/modules/m_spanningtree/rsquit.cpp | 4 ++-- src/modules/m_spanningtree/rsquit.h | 1 - src/modules/m_sslinfo.cpp | 5 ++--- src/modules/m_sslmodes.cpp | 4 ++-- src/modules/m_stripcolor.cpp | 6 +++--- src/modules/m_svshold.cpp | 5 ++--- src/modules/m_swhois.cpp | 5 ++--- src/modules/m_taxonomy.cpp | 6 ++---- src/modules/m_timedbans.cpp | 5 ++--- src/modules/m_tline.cpp | 5 ++--- src/modules/m_uninvite.cpp | 5 ++--- src/modules/m_userip.cpp | 5 ++--- src/modules/m_vhost.cpp | 5 ++--- src/modules/m_watch.cpp | 8 +++----- 94 files changed, 237 insertions(+), 312 deletions(-) (limited to 'src/modules') 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 ¶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 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 = "{[+|-]}|*}"; 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 ¶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 = " [ :]"; 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 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 ¶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 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 = "|||"; } @@ -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 = " "; 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 = " "; 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 = " "; 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 = ""; } @@ -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 ¶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 = " "; 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 = " :[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 = "{[+|-]