diff options
99 files changed, 347 insertions, 354 deletions
diff --git a/include/modules.h b/include/modules.h index 6e326e00b..b67462515 100644 --- a/include/modules.h +++ b/include/modules.h @@ -356,14 +356,16 @@ enum Implementation { I_OnUserConnect, I_OnUserQuit, I_OnUserDisconnect, I_OnUse */ class Module : public Extensible { + protected: + InspIRCd* ServerInstance; public: /** Default constructor * Creates a module class. - * @param Me An instance of the Server class which can be saved for future use + * @param Me An instance of the InspIRCd class which will be saved into ServerInstance for your use * \exception ModuleException Throwing this class, or any class derived from ModuleException, causes loading of the module to abort. */ - Module(Server* Me); + Module(InspIRCd* Me); /** Default destructor * destroys a module class @@ -1628,7 +1630,7 @@ class ModuleFactory : public classbase * Your inherited class of ModuleFactory must return a pointer to your Module class * using this method. */ - virtual Module * CreateModule(Server* Me) = 0; + virtual Module * CreateModule(InspIRCd* Me) = 0; }; diff --git a/include/u_listmode.h b/include/u_listmode.h index 8e1b9e335..bd5bde74c 100644 --- a/include/u_listmode.h +++ b/include/u_listmode.h @@ -9,6 +9,7 @@ #include "channels.h" #include "modules.h" #include "helperfuncs.h" +#include "wildcard.h" #include "inspircd.h" /* $ModDesc: Provides support for easily creating listmodes, stores the time set, the user, and a parameter. */ @@ -48,7 +49,6 @@ typedef std::vector<ListLimit> limitlist; class ListModeBase : public ModeHandler { protected: - Server* Srv; std::string infokey; std::string listnumeric; std::string endoflistnumeric; @@ -58,8 +58,8 @@ class ListModeBase : public ModeHandler limitlist chanlimits; public: - ListModeBase(InspIRCd* Instance, Server* serv, char modechar, const std::string &eolstr, const std::string &lnum, const std::string &eolnum, bool autotidy, const std::string &ctag = "banlist") - : ModeHandler(Instance, modechar, 1, 1, true, MODETYPE_CHANNEL, false), Srv(serv), listnumeric(lnum), endoflistnumeric(eolnum), endofliststring(eolstr), tidy(autotidy), configtag(ctag) + ListModeBase(InspIRCd* Instance, char modechar, const std::string &eolstr, const std::string &lnum, const std::string &eolnum, bool autotidy, const std::string &ctag = "banlist") + : ModeHandler(Instance, modechar, 1, 1, true, MODETYPE_CHANNEL, false), listnumeric(lnum), endoflistnumeric(eolnum), endofliststring(eolstr), tidy(autotidy), configtag(ctag) { this->DoRehash(); infokey = "exceptionbase_mode_" + std::string(1, mode) + "_list"; @@ -173,7 +173,7 @@ class ListModeBase : public ModeHandler for (limitlist::iterator it = chanlimits.begin(); it != chanlimits.end(); it++) { - if (Srv->MatchText(channel->name, it->mask)) + if (match(channel->name, it->mask.c_str())) { // We have a pattern matching the channel... maxsize = el->size(); diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 439c4a305..83689b33c 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -582,7 +582,7 @@ bool InspIRCd::LoadModule(const char* filename) } if ((long)factory[this->ModCount+1]->factory != -1) { - Module* m = factory[this->ModCount+1]->factory->CreateModule(MyServer); + Module* m = factory[this->ModCount+1]->factory->CreateModule(this); modules[this->ModCount+1] = m; /* save the module and the module's classfactory, if * this isnt done, random crashes can occur :/ */ diff --git a/src/modules.cpp b/src/modules.cpp index 9321047a8..6e1b99c9a 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -130,7 +130,7 @@ std::string Event::GetEventID() // These declarations define the behavours of the base class Module (which does nothing at all) - Module::Module(Server* Me) { } + Module::Module(InspIRCd* Me) : ServerInstance(Me) { } Module::~Module() { } void Module::OnUserConnect(userrec* user) { } void Module::OnUserQuit(userrec* user, const std::string& message) { } diff --git a/src/modules/extra/m_filter_pcre.cpp b/src/modules/extra/m_filter_pcre.cpp index 0f52c6aa4..a885046bb 100644 --- a/src/modules/extra/m_filter_pcre.cpp +++ b/src/modules/extra/m_filter_pcre.cpp @@ -54,7 +54,7 @@ class ModuleFilterPCRE : public Module int erroffset; public: - ModuleFilterPCRE(Server* Me) + ModuleFilterPCRE(InspIRCd* Me) : Module::Module(Me) { // read the configuration file on startup. @@ -62,7 +62,7 @@ class ModuleFilterPCRE : public Module // main config file, then append your <keyword> tags to the bottom // of the main config... but rather messy. That's why the capability // of using a seperate config file is provided. - Srv = Me; + Conf = new ConfigReader; std::string filterfile = Conf->ReadValue("filter","file",0); MyConf = new ConfigReader(filterfile); @@ -214,7 +214,7 @@ class ModuleFilterPCREFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleFilterPCRE(Me); } diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 5eaa0e8d3..f7738d5cf 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -789,10 +789,10 @@ class ModuleSQL : public Module return NULL; } - ModuleSQL(Server* Me) + ModuleSQL(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + Conf = new ConfigReader(); currid = 0; SQLModule = this; @@ -922,7 +922,7 @@ class ModuleSQLFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleSQL(Me); } diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index 988700d41..41582fefb 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -519,8 +519,8 @@ private: char* sqlsuccess; public: - ModulePgSQL(Server* Me) - : Module::Module(Me), Srv(Me), currid(0) + ModulePgSQL(InspIRCd* Me) + : Module::Module(Me), currid(0) { log(DEBUG, "%s 'SQL' feature", ServerInstance->PublishFeature("SQL", this) ? "Published" : "Couldn't publish"); @@ -1216,7 +1216,7 @@ class ModulePgSQLFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModulePgSQL(Me); } diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp index 960a3c540..17d4f69ac 100644 --- a/src/modules/extra/m_sqlauth.cpp +++ b/src/modules/extra/m_sqlauth.cpp @@ -45,8 +45,8 @@ class ModuleSQLAuth : public Module bool verbose; public: - ModuleSQLAuth(Server* Me) - : Module::Module(Me), Srv(Me) + ModuleSQLAuth(InspIRCd* Me) + : Module::Module(Me) { SQLutils = ServerInstance->FindFeature("SQLutils"); @@ -233,7 +233,7 @@ class ModuleSQLAuthFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleSQLAuth(Me); } diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index b2ddf1c5d..4220724a6 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -285,9 +285,9 @@ class ModuleSQLLog : public Module return (SQLModule); } - ModuleSQLLog(Server* Me) : Module::Module(Me) + ModuleSQLLog(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + ReadConfig(); MyMod = this; active_queries.clear(); @@ -422,7 +422,7 @@ class ModuleSQLLogFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleSQLLog(Me); } diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index cd4ef7102..9a2422aa8 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -37,8 +37,8 @@ class ModuleSQLOper : public Module std::string databaseid; public: - ModuleSQLOper(Server* Me) - : Module::Module(Me), Srv(Me) + ModuleSQLOper(InspIRCd* Me) + : Module::Module(Me) { SQLutils = ServerInstance->FindFeature("SQLutils"); @@ -264,7 +264,7 @@ class ModuleSQLOperFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleSQLOper(Me); } diff --git a/src/modules/extra/m_sqlutils.cpp b/src/modules/extra/m_sqlutils.cpp index f2085cbcd..6ce57db45 100644 --- a/src/modules/extra/m_sqlutils.cpp +++ b/src/modules/extra/m_sqlutils.cpp @@ -46,8 +46,8 @@ private: IdChanMap idchan; public: - ModuleSQLutils(Server* Me) - : Module::Module(Me), Srv(Me) + ModuleSQLutils(InspIRCd* Me) + : Module::Module(Me) { log(DEBUG, "%s 'SQLutils' feature", ServerInstance->PublishFeature("SQLutils", this) ? "Published" : "Couldn't publish"); } @@ -287,7 +287,7 @@ class ModuleSQLutilsFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleSQLutils(Me); } diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index a5cdaf3e0..0ebd6f982 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -66,10 +66,10 @@ class ModuleSSLGnuTLS : public Module public: - ModuleSSLGnuTLS(Server* Me) + ModuleSSLGnuTLS(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + culllist = new CullList(ServerInstance); @@ -605,7 +605,7 @@ class ModuleSSLGnuTLSFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleSSLGnuTLS(Me); } diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 7d10b78be..3819d835c 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -81,10 +81,10 @@ class ModuleSSLOpenSSL : public Module public: - ModuleSSLOpenSSL(Server* Me) + ModuleSSLOpenSSL(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + culllist = new CullList(ServerInstance); @@ -670,7 +670,7 @@ class ModuleSSLOpenSSLFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleSSLOpenSSL(Me); } diff --git a/src/modules/extra/m_testclient.cpp b/src/modules/extra/m_testclient.cpp index a5744f240..5a140500a 100644 --- a/src/modules/extra/m_testclient.cpp +++ b/src/modules/extra/m_testclient.cpp @@ -16,8 +16,8 @@ private: Server* Srv; public: - ModuleTestClient(Server* Me) - : Module::Module(Me), Srv(Me) + ModuleTestClient(InspIRCd* Me) + : Module::Module(Me) { } @@ -109,7 +109,7 @@ class ModuleTestClientFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleTestClient(Me); } diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 9d48b1034..85791b070 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -67,10 +67,10 @@ class ModuleAlias : public Module public: - ModuleAlias(Server* Me) + ModuleAlias(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + MyConf = new ConfigReader; ReadAliases(); } @@ -172,7 +172,7 @@ class ModuleAliasFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleAlias(Me); } diff --git a/src/modules/m_antibear.cpp b/src/modules/m_antibear.cpp index d43db5292..f322b0b9a 100644 --- a/src/modules/m_antibear.cpp +++ b/src/modules/m_antibear.cpp @@ -29,9 +29,9 @@ class ModuleAntiBear : public Module Server *Srv; public: - ModuleAntiBear(Server* Me) : Module::Module(Me) + ModuleAntiBear(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + } virtual ~ModuleAntiBear() @@ -66,7 +66,7 @@ class ModuleAntiBearFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleAntiBear(Me); } diff --git a/src/modules/m_antibottler.cpp b/src/modules/m_antibottler.cpp index 58ee0b5d6..a8d492f90 100644 --- a/src/modules/m_antibottler.cpp +++ b/src/modules/m_antibottler.cpp @@ -27,10 +27,10 @@ class ModuleAntiBottler : public Module Server *Srv; public: - ModuleAntiBottler(Server* Me) + ModuleAntiBottler(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + } void Implements(char* List) @@ -110,7 +110,7 @@ class ModuleAntiBottlerFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleAntiBottler(Me); } diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp index 0c56edd7e..2c9bdee79 100644 --- a/src/modules/m_banexception.cpp +++ b/src/modules/m_banexception.cpp @@ -23,7 +23,7 @@ extern InspIRCd* ServerInstance; class BanException : public ListModeBase { public: - BanException(InspIRCd* Instance, Server* serv) : ListModeBase(Instance, serv, 'e', "End of Channel Exception List", "348", "349", true) { } + BanException(InspIRCd* Instance) : ListModeBase(Instance, 'e', "End of Channel Exception List", "348", "349", true) { } }; @@ -33,11 +33,10 @@ class ModuleBanException : public Module Server* Srv; public: - ModuleBanException(Server* serv) - : Module::Module(serv) + ModuleBanException(InspIRCd* Me) + : Module::Module(Me) { - be = new BanException(ServerInstance, serv); - Srv = serv; + be = new BanException(ServerInstance); Srv->AddMode(be, 'e'); } @@ -115,11 +114,10 @@ class ModuleBanExceptionFactory : public ModuleFactory { } - virtual Module* CreateModule(Server* serv) + virtual Module* CreateModule(InspIRCd* Me) { - return new ModuleBanException(serv); + return new ModuleBanException(Me); } - }; diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index b22b5b327..62d744f9a 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -52,9 +52,9 @@ class ModuleBlockAmsg : public Module int ForgetDelay; BlockAction action; public: - ModuleBlockAmsg(Server* Me) : Module::Module(Me) + ModuleBlockAmsg(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + this->OnRehash(""); } @@ -194,7 +194,7 @@ class ModuleBlockAmsgFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleBlockAmsg(Me); } diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index 76d535380..c23fbe741 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -60,9 +60,9 @@ class ModuleBlockCAPS : public Module BlockCaps* bc; public: - ModuleBlockCAPS(Server* Me) : Module::Module(Me) + ModuleBlockCAPS(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + bc = new BlockCaps(ServerInstance); Srv->AddMode(bc, 'P'); } @@ -129,7 +129,7 @@ class ModuleBlockCAPSFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleBlockCAPS(Me); } diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index 4ededb4a3..f872abcb8 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -62,9 +62,9 @@ class ModuleBlockColour : public Module BlockColor *bc; public: - ModuleBlockColour(Server* Me) : Module::Module(Me) + ModuleBlockColour(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + bc = new BlockColor(ServerInstance); Srv->AddMode(bc, 'c'); } @@ -136,7 +136,7 @@ class ModuleBlockColourFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleBlockColour(Me); } diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp index b33e63e19..57ece4759 100644 --- a/src/modules/m_botmode.cpp +++ b/src/modules/m_botmode.cpp @@ -66,10 +66,10 @@ class ModuleBotMode : public Module Server *Srv; BotMode* bm; public: - ModuleBotMode(Server* Me) + ModuleBotMode(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + bm = new BotMode(ServerInstance); Srv->AddMode(bm, 'B'); } @@ -112,7 +112,7 @@ class ModuleBotModeFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleBotMode(Me); } diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index 539932be4..6e4d83fcf 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -24,6 +24,7 @@ #include "modules.h" #include "helperfuncs.h" #include "hashcomp.h" +#include "commands.h" #include "configreader.h" #include "inspircd.h" @@ -63,13 +64,13 @@ cbanlist cbans; class cmd_cban : public command_t { private: - Server *Srv; + InspIRCd* ServerInstance; public: - cmd_cban(Server* Me) : command_t("CBAN", 'o', 1) + cmd_cban(InspIRCd* Me) : command_t("CBAN", 'o', 1), ServerInstance(Me) { this->source = "m_cban.so"; - this->Srv = Me; + this-> syntax = "<channel> [<duration> :<reason>]"; } @@ -102,7 +103,7 @@ class cmd_cban : public command_t // parameters[0] = #channel // parameters[1] = 1h3m2s // parameters[2] = Tortoise abuser - long length = Srv->CalcDuration(parameters[1]); + long length = duration(parameters[1]); std::string reason = (pcnt > 2) ? parameters[2] : "No reason supplied"; cbans.push_back(CBan(parameters[0], user->nick, TIME, length, reason)); @@ -134,10 +135,10 @@ class ModuleCBan : public Module Server* Srv; public: - ModuleCBan(Server* Me) : Module::Module(Me) + ModuleCBan(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; - mycommand = new cmd_cban(Srv); + + mycommand = new cmd_cban(Me); Srv->AddCommand(mycommand); } @@ -271,7 +272,7 @@ class ModuleCBanFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleCBan(Me); } diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index 4bc5b43e5..8ed3d47f3 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -108,7 +108,7 @@ class ModuleCensor : public Module CensorChannel *cc; public: - ModuleCensor(Server* Me) + ModuleCensor(InspIRCd* Me) : Module::Module(Me) { /* @@ -123,7 +123,7 @@ class ModuleCensor : public Module * * XXX - These module pre-date the include directive which exists since beta 5 -- Brain */ - Srv = Me; + OnRehash(""); cu = new CensorUser(ServerInstance); cc = new CensorChannel(ServerInstance); @@ -244,7 +244,7 @@ class ModuleCensorFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleCensor(Me); } diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 7bb46b753..01a04d28f 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -91,9 +91,9 @@ class ModuleCgiIRC : public Module bool NotifyOpers; CGIHostlist Hosts; public: - ModuleCgiIRC(Server* Me) : Module::Module(Me) + ModuleCgiIRC(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + OnRehash(""); } @@ -429,7 +429,7 @@ class ModuleCgiIRCFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleCgiIRC(Me); } diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index 6756fd8ec..277167e90 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -34,7 +34,7 @@ extern InspIRCd* ServerInstance; class ChanFilter : public ListModeBase { public: - ChanFilter(InspIRCd* Instance, Server* serv) : ListModeBase(Instance, serv, 'g', "End of channel spamfilter list", "941", "940", false, "chanfilter") { } + ChanFilter(InspIRCd* Instance) : ListModeBase(Instance, 'g', "End of channel spamfilter list", "941", "940", false, "chanfilter") { } virtual bool ValidateParam(userrec* user, chanrec* chan, std::string &word) { @@ -71,10 +71,10 @@ class ModuleChanFilter : public Module public: - ModuleChanFilter(Server* Me) - : Module::Module(Me), Srv(Me) + ModuleChanFilter(InspIRCd* Me) + : Module::Module(Me) { - cf = new ChanFilter(ServerInstance, Srv); + cf = new ChanFilter(ServerInstance); Srv->AddMode(cf, 'g'); } @@ -168,7 +168,7 @@ class ModuleChanFilterFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleChanFilter(Me); } diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index 920c34a17..fcb401868 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -19,6 +19,7 @@ #include "modules.h" #include "helperfuncs.h" #include "inspircd.h" +#include "commands.h" /* $ModDesc: Provides channel modes +a and +q */ @@ -28,11 +29,9 @@ const char* fakevalue = "on"; class ChanFounder : public ModeHandler { - Server* Srv; char* dummyptr; - public: - ChanFounder(InspIRCd* Instance, Server* s) : ModeHandler(Instance, 'q', 1, 1, true, MODETYPE_CHANNEL, false), Srv(s) { } + ChanFounder(InspIRCd* Instance) : ModeHandler(Instance, 'q', 1, 1, true, MODETYPE_CHANNEL, false) { } ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) { @@ -86,7 +85,7 @@ class ChanFounder : public ModeHandler std::string founder = "cm_founder_"+std::string(channel->name); // source is a server, or ulined, we'll let them +-q the user. - if ((Srv->IsUlined(source->nick)) || (Srv->IsUlined(source->server)) || (!*source->server) || (!IS_LOCAL(source))) + if ((is_uline(source->nick)) || (is_uline(source->server)) || (!*source->server) || (!IS_LOCAL(source))) { log(DEBUG,"Allowing remote mode change in ChanFounder"); if (adding) @@ -144,10 +143,9 @@ class ChanFounder : public ModeHandler class ChanProtect : public ModeHandler { - Server* Srv; char* dummyptr; public: - ChanProtect(InspIRCd* Instance, Server* s) : ModeHandler(Instance, 'a', 1, 1, true, MODETYPE_CHANNEL, false), Srv(s) { } + ChanProtect(InspIRCd* Instance) : ModeHandler(Instance, 'a', 1, 1, true, MODETYPE_CHANNEL, false) { } ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) { @@ -196,7 +194,7 @@ class ChanProtect : public ModeHandler std::string founder = "cm_founder_"+std::string(channel->name); // source has +q, is a server, or ulined, we'll let them +-a the user. - if ((Srv->IsUlined(source->nick)) || (Srv->IsUlined(source->server)) || (!*source->server) || (source->GetExt(founder,dummyptr)) || (!IS_LOCAL(source))) + if ((is_uline(source->nick)) || (is_uline(source->server)) || (!*source->server) || (source->GetExt(founder,dummyptr)) || (!IS_LOCAL(source))) { if (adding) { @@ -254,13 +252,13 @@ class ModuleChanProtect : public Module public: - ModuleChanProtect(Server* Me) : Module::Module(Me), Srv(Me) + ModuleChanProtect(InspIRCd* Me) : Module::Module(Me) { /* Initialise module variables */ - cp = new ChanProtect(ServerInstance, Me); - cf = new ChanFounder(ServerInstance, Me); - + cp = new ChanProtect(ServerInstance); + cf = new ChanFounder(ServerInstance); + Srv->AddMode(cp, 'a'); Srv->AddMode(cf, 'q'); @@ -470,7 +468,7 @@ class ModuleChanProtectFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleChanProtect(Me); } diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 180a989c9..251faf58a 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -188,9 +188,9 @@ class ModuleCheck : public Module private: cmd_check *mycommand; public: - ModuleCheck(Server* Me) : Module::Module(Me) + ModuleCheck(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mycommand = new cmd_check(); Srv->AddCommand(mycommand); } @@ -224,7 +224,7 @@ class ModuleCheckFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleCheck(Me); } diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index fc5507822..be5730e11 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -75,10 +75,10 @@ class ModuleChgHost : public Module { cmd_chghost* mycommand; public: - ModuleChgHost(Server* Me) + ModuleChgHost(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mycommand = new cmd_chghost(); Srv->AddCommand(mycommand); } @@ -111,7 +111,7 @@ class ModuleChgHostFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleChgHost(Me); } diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index 7efe2e755..83e3c70d5 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -10,12 +10,10 @@ extern InspIRCd* ServerInstance; class cmd_chgident : public command_t { - Server* Srv; public: - cmd_chgident(Server* serv) : command_t("CHGIDENT", 'o', 2) + cmd_chgident() : command_t("CHGIDENT", 'o', 2) { this->source = "m_chgident.so"; - Srv = serv; syntax = "<nick> <newident>"; } @@ -45,12 +43,13 @@ class cmd_chgident : public command_t class ModuleChgIdent : public Module { cmd_chgident* mycommand; + Server* Srv; public: - ModuleChgIdent(Server* Me) : Module::Module(Me) + ModuleChgIdent(InspIRCd* Me) : Module::Module(Me) { - mycommand = new cmd_chgident(Me); - Me->AddCommand(mycommand); + mycommand = new cmd_chgident(); + Srv->AddCommand(mycommand); } virtual ~ModuleChgIdent() @@ -77,7 +76,7 @@ class ModuleChgIdentFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleChgIdent(Me); } diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index f3b5bcb7e..692b55b65 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -285,7 +285,7 @@ class CloakUser : public ModeHandler } public: - CloakUser(InspIRCd* Instance, Server* Me) : ModeHandler(Instance, 'x', 0, 0, false, MODETYPE_USER, false), Srv(Me) { } + CloakUser(InspIRCd* Instance) : ModeHandler(Instance, 'x', 0, 0, false, MODETYPE_USER, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { @@ -402,11 +402,11 @@ class ModuleCloaking : public Module CloakUser* cu; public: - ModuleCloaking(Server* Me) - : Module::Module(Me), Srv(Me) + ModuleCloaking(InspIRCd* Me) + : Module::Module(Me) { /* Create new mode handler object */ - cu = new CloakUser(ServerInstance, Srv); + cu = new CloakUser(ServerInstance); /* Register it with the core */ Srv->AddMode(cu, 'x'); @@ -465,7 +465,7 @@ class ModuleCloakingFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleCloaking(Me); } diff --git a/src/modules/m_conn_lusers.cpp b/src/modules/m_conn_lusers.cpp index f988c76c0..c0be6123b 100644 --- a/src/modules/m_conn_lusers.cpp +++ b/src/modules/m_conn_lusers.cpp @@ -35,10 +35,10 @@ class ModuleConnLUSERS : public Module Server *Srv; public: - ModuleConnLUSERS(Server* Me) + ModuleConnLUSERS(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + } virtual ~ModuleConnLUSERS() @@ -92,7 +92,7 @@ class ModuleConnLUSERSFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleConnLUSERS(Me); } diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp index 558e98696..5686f6810 100644 --- a/src/modules/m_conn_waitpong.cpp +++ b/src/modules/m_conn_waitpong.cpp @@ -38,10 +38,10 @@ class ModuleWaitPong : public Module bool killonbadreply; public: - ModuleWaitPong(Server* Me) + ModuleWaitPong(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + OnRehash(""); } @@ -162,7 +162,7 @@ class ModuleWaitPongFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleWaitPong(Me); } diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp index 85ea0a84d..d6a23344e 100644 --- a/src/modules/m_connflood.cpp +++ b/src/modules/m_connflood.cpp @@ -41,9 +41,9 @@ private: Server *Srv; public: - ModuleConnFlood(Server* Me) : Module::Module(Me) + ModuleConnFlood(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + InitConf(); } @@ -138,7 +138,7 @@ public: { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleConnFlood(Me); } diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp index 254cfdcc1..7a05c0513 100644 --- a/src/modules/m_denychans.cpp +++ b/src/modules/m_denychans.cpp @@ -31,9 +31,9 @@ class ModuleDenyChannels : public Module ConfigReader *Conf; public: - ModuleDenyChannels(Server* Me) : Module::Module(Me) + ModuleDenyChannels(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + Conf = new ConfigReader; } @@ -95,7 +95,7 @@ class ModuleDenyChannelsFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleDenyChannels(Me); } diff --git a/src/modules/m_devoice.cpp b/src/modules/m_devoice.cpp index 54a08ab98..b2c411e74 100644 --- a/src/modules/m_devoice.cpp +++ b/src/modules/m_devoice.cpp @@ -60,9 +60,9 @@ class ModuleDeVoice : public Module { cmd_devoice *mycommand; public: - ModuleDeVoice(Server* Me) : Module::Module(Me) + ModuleDeVoice(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mycommand = new cmd_devoice(); Srv->AddCommand(mycommand); } @@ -89,7 +89,7 @@ class ModuleDeVoiceFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleDeVoice(Me); } diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 6b0efe5cc..a20cf6bf2 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -56,7 +56,7 @@ class ModuleFilter : public Module filter_t filters; public: - ModuleFilter(Server* Me) + ModuleFilter(InspIRCd* Me) : Module::Module(Me) { // read the configuration file on startup. @@ -64,7 +64,7 @@ class ModuleFilter : public Module // main config file, then append your <keyword> tags to the bottom // of the main config... but rather messy. That's why the capability // of using a seperate config file is provided. - Srv = Me; + OnRehash(""); } @@ -179,7 +179,7 @@ class ModuleFilterFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleFilter(Me); } diff --git a/src/modules/m_foobar.cpp b/src/modules/m_foobar.cpp index 93b1848fe..cca4a6cbc 100644 --- a/src/modules/m_foobar.cpp +++ b/src/modules/m_foobar.cpp @@ -38,12 +38,12 @@ class ModuleFoobar : public Module Server *Srv; public: - ModuleFoobar(Server* Me) + ModuleFoobar(InspIRCd* Me) : Module::Module(Me) { // The constructor just makes a copy of the server class - Srv = Me; + } virtual ~ModuleFoobar() @@ -116,7 +116,7 @@ class ModuleFoobarFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleFoobar(Me); } diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp index 8e68d48a6..ef3c1cb5d 100644 --- a/src/modules/m_globalload.cpp +++ b/src/modules/m_globalload.cpp @@ -79,9 +79,9 @@ class ModuleGlobalLoad : public Module cmd_gunloadmodule *mycommand2; Server *Srv; public: - ModuleGlobalLoad(Server* Me) : Module::Module(Me) + ModuleGlobalLoad(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mycommand = new cmd_gloadmodule(); mycommand2 = new cmd_gunloadmodule(); Srv->AddCommand(mycommand); @@ -110,7 +110,7 @@ class ModuleGlobalLoadFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleGlobalLoad(Me); } diff --git a/src/modules/m_globops.cpp b/src/modules/m_globops.cpp index 289522d7f..f744895ec 100644 --- a/src/modules/m_globops.cpp +++ b/src/modules/m_globops.cpp @@ -84,10 +84,10 @@ class ModuleGlobops : public Module cmd_globops* mycommand; ModeGlobops* mg; public: - ModuleGlobops(Server* Me) + ModuleGlobops(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mg = new ModeGlobops(ServerInstance); Srv->AddMode(mg, 'g'); mycommand = new cmd_globops(); @@ -121,7 +121,7 @@ class ModuleGlobopsFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleGlobops(Me); } diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index d0ec1a0aa..accec7a2d 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -201,11 +201,9 @@ class ModuleHelpop : public Module Helpop* ho; public: - ModuleHelpop(Server* Me) + ModuleHelpop(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; - ReadConfig(); ho = new Helpop(ServerInstance); Srv->AddMode(ho, 'h'); @@ -281,7 +279,7 @@ class ModuleHelpopFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleHelpop(Me); } diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index d4da6d1ff..512af06cd 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -45,10 +45,10 @@ class ModuleHostChange : public Module std::string MySuffix; public: - ModuleHostChange(Server* Me) + ModuleHostChange(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + Conf = new ConfigReader; OnRehash(""); } @@ -158,7 +158,7 @@ class ModuleHostChangeFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleHostChange(Me); } diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index fb9ea954c..ae3611024 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -285,9 +285,9 @@ class ModuleHttp : public Module } } - ModuleHttp(Server* Me) : Module::Module(Me) + ModuleHttp(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + ReadConfig(); CreateListener(); } @@ -334,7 +334,7 @@ class ModuleHttpFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { HttpModule = new ModuleHttp(Me); return HttpModule; diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index a813660c9..95b8b73ed 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -53,9 +53,9 @@ class ModuleHttpStats : public Module this->stylesheet = c.ReadValue("httpstats", "stylesheet", 0); } - ModuleHttpStats(Server* Me) : Module::Module(Me) + ModuleHttpStats(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + ReadConfig(); this->changed = false; } @@ -263,7 +263,7 @@ class ModuleHttpStatsFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleHttpStats(Me); } diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 32e87272a..781661c48 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -188,10 +188,10 @@ class ModuleIdent : public Module DELETE(Conf); } - ModuleIdent(Server* Me) + ModuleIdent(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + ReadSettings(); } @@ -296,7 +296,7 @@ class ModuleIdentFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleIdent(Me); } diff --git a/src/modules/m_inviteexception.cpp b/src/modules/m_inviteexception.cpp index f3e278e98..51a489de0 100644 --- a/src/modules/m_inviteexception.cpp +++ b/src/modules/m_inviteexception.cpp @@ -24,7 +24,7 @@ class InspIRCd* ServerInstance; class InviteException : public ListModeBase { public: - InviteException(InspIRCd* Instance, Server* serv) : ListModeBase(Instance, serv, 'I', "End of Channel Invite Exception List", "346", "347", true) { } + InviteException(InspIRCd* Instance) : ListModeBase(Instance, 'I', "End of Channel Invite Exception List", "346", "347", true) { } }; class ModuleInviteException : public Module @@ -33,10 +33,9 @@ class ModuleInviteException : public Module Server* Srv; public: - ModuleInviteException(Server* serv) : Module(serv) + ModuleInviteException(InspIRCd* Me) : Module(Me) { - ie = new InviteException(ServerInstance, serv); - Srv = serv; + ie = new InviteException(ServerInstance); Srv->AddMode(ie, 'I'); } @@ -62,7 +61,7 @@ public: { for (modelist::iterator it = list->begin(); it != list->end(); it++) { - if(Srv->MatchText(user->GetFullRealHost(), it->mask) || Srv->MatchText(user->GetFullHost(), it->mask)) + if(match(user->GetFullRealHost(), it->mask.c_str()) || match(user->GetFullHost(), it->mask.c_str())) { // They match an entry on the list, so let them in. return 1; @@ -113,9 +112,9 @@ class ModuleInviteExceptionFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* serv) + virtual Module * CreateModule(InspIRCd* Me) { - return new ModuleInviteException(serv); + return new ModuleInviteException(Me); } }; diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index 3adbb5332..7603e36d5 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -193,10 +193,10 @@ class ModuleJoinFlood : public Module public: - ModuleJoinFlood(Server* Me) + ModuleJoinFlood(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + jf = new JoinFlood(ServerInstance); Srv->AddMode(jf, 'j'); } @@ -276,7 +276,7 @@ class ModuleJoinFloodFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleJoinFlood(Me); } diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index 811a51725..a9dc54a3e 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -75,10 +75,10 @@ class ModuleKickNoRejoin : public Module public: - ModuleKickNoRejoin(Server* Me) + ModuleKickNoRejoin(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + kr = new KickRejoin(ServerInstance); Srv->AddMode(kr, 'J'); } @@ -194,7 +194,7 @@ class ModuleKickNoRejoinFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleKickNoRejoin(Me); } diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index 1272f2be8..7d0f8ea4c 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -110,9 +110,9 @@ class ModuleKnock : public Module cmd_knock* mycommand; Knock* kn; public: - ModuleKnock(Server* Me) : Module::Module(Me) + ModuleKnock(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + kn = new Knock(ServerInstance); Srv->AddMode(kn, 'K'); mycommand = new cmd_knock(); @@ -153,7 +153,7 @@ class ModuleKnockFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleKnock(Me); } diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index 9049eca8c..79ab10eef 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -191,10 +191,10 @@ class ModuleMsgFlood : public Module public: - ModuleMsgFlood(Server* Me) + ModuleMsgFlood(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mf = new MsgFlood(ServerInstance); Srv->AddMode(mf, 'f'); } @@ -296,7 +296,7 @@ class ModuleMsgFloodFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleMsgFlood(Me); } diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index f6f88993a..8710a2e6d 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -96,10 +96,10 @@ class ModuleNickLock : public Module cmd_nickunlock* cmd2; char* n; public: - ModuleNickLock(Server* Me) + ModuleNickLock(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + cmd1 = new cmd_nicklock(); cmd2 = new cmd_nickunlock(); Srv->AddCommand(cmd1); @@ -158,7 +158,7 @@ class ModuleNickLockFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleNickLock(Me); } diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index fc7ede256..0c3e3649a 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -62,10 +62,10 @@ class ModuleNoCTCP : public Module public: - ModuleNoCTCP(Server* Me) + ModuleNoCTCP(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + nc = new NoCTCP(ServerInstance); Srv->AddMode(nc, 'C'); } @@ -128,7 +128,7 @@ class ModuleNoCTCPFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleNoCTCP(Me); } diff --git a/src/modules/m_noinvite.cpp b/src/modules/m_noinvite.cpp index 1481f5f03..ea4b246d7 100644 --- a/src/modules/m_noinvite.cpp +++ b/src/modules/m_noinvite.cpp @@ -62,9 +62,9 @@ class ModuleNoInvite : public Module public: - ModuleNoInvite(Server* Me) : Module::Module(Me) + ModuleNoInvite(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + ni = new NoInvite(ServerInstance); Srv->AddMode(ni, 'V'); } @@ -113,7 +113,7 @@ class ModuleNoInviteFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleNoInvite(Me); } diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp index be06cd79c..e58366fbf 100644 --- a/src/modules/m_nokicks.cpp +++ b/src/modules/m_nokicks.cpp @@ -62,10 +62,10 @@ class ModuleNoKicks : public Module public: - ModuleNoKicks(Server* Me) + ModuleNoKicks(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + nk = new NoKicks(ServerInstance); Srv->AddMode(nk, 'Q'); } @@ -125,7 +125,7 @@ class ModuleNoKicksFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleNoKicks(Me); } diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index 1e8b7ccf9..daaf25ece 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -64,10 +64,10 @@ class ModuleNoNickChange : public Module NoNicks* nn; public: - ModuleNoNickChange(Server* Me) + ModuleNoNickChange(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + nn = new NoNicks(ServerInstance); Srv->AddMode(nn, 'N'); } @@ -130,7 +130,7 @@ class ModuleNoNickChangeFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleNoNickChange(Me); } diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp index 34c59db88..7ce1967fe 100644 --- a/src/modules/m_nonotice.cpp +++ b/src/modules/m_nonotice.cpp @@ -61,10 +61,10 @@ class ModuleNoNotice : public Module NoNotice* nt; public: - ModuleNoNotice(Server* Me) + ModuleNoNotice(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + nt = new NoNotice(ServerInstance); Srv->AddMode(nt, 'T'); } @@ -124,7 +124,7 @@ class ModuleNoNoticeFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleNoNotice(Me); } diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp index f78bb5e36..cf05419c1 100644 --- a/src/modules/m_operchans.cpp +++ b/src/modules/m_operchans.cpp @@ -61,10 +61,10 @@ class ModuleOperChans : public Module Server* Srv; OperChans* oc; public: - ModuleOperChans(Server* Me) + ModuleOperChans(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + oc = new OperChans(ServerInstance); Srv->AddMode(oc, 'O'); } @@ -118,7 +118,7 @@ class ModuleOperChansFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleOperChans(Me); } diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp index 750f98c96..fd3b3407e 100644 --- a/src/modules/m_operjoin.cpp +++ b/src/modules/m_operjoin.cpp @@ -39,10 +39,10 @@ class ModuleOperjoin : public Module } public: - ModuleOperjoin(Server* Me) + ModuleOperjoin(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + conf = new ConfigReader; operChan = conf->ReadValue("operjoin", "channel", 0); } @@ -93,7 +93,7 @@ class ModuleOperjoinFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleOperjoin(Me); } diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp index 0c97765b9..e6c64dcd0 100644 --- a/src/modules/m_operlevels.cpp +++ b/src/modules/m_operlevels.cpp @@ -21,11 +21,11 @@ class ModuleOperLevels : public Module public: - ModuleOperLevels(Server* Me) + ModuleOperLevels(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + conf = new ConfigReader; } @@ -98,7 +98,7 @@ class ModuleOperLevelsFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { log(DEBUG,"CreateModule"); return new ModuleOperLevels(Me); diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp index 4881eefa0..2bbd55de8 100644 --- a/src/modules/m_operlog.cpp +++ b/src/modules/m_operlog.cpp @@ -30,9 +30,9 @@ class ModuleOperLog : public Module private: Server *Srv; public: - ModuleOperLog(Server* Me) : Module::Module(Me) + ModuleOperLog(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + } virtual ~ModuleOperLog() @@ -90,7 +90,7 @@ class ModuleOperLogFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleOperLog(Me); } diff --git a/src/modules/m_opermd5.cpp b/src/modules/m_opermd5.cpp index d9519223d..52692f772 100644 --- a/src/modules/m_opermd5.cpp +++ b/src/modules/m_opermd5.cpp @@ -292,10 +292,10 @@ class ModuleOperMD5 : public Module cmd_mkpasswd* mycommand; public: - ModuleOperMD5(Server* Me) + ModuleOperMD5(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mycommand = new cmd_mkpasswd(); Srv->AddCommand(mycommand); } @@ -342,7 +342,7 @@ class ModuleOperMD5Factory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleOperMD5(Me); } diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp index 1181a32c3..f03d68813 100644 --- a/src/modules/m_opermodes.cpp +++ b/src/modules/m_opermodes.cpp @@ -32,10 +32,10 @@ class ModuleModesOnOper : public Module ConfigReader *Conf; public: - ModuleModesOnOper(Server* Me) + ModuleModesOnOper(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + Conf = new ConfigReader; } @@ -100,7 +100,7 @@ class ModuleModesOnOperFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleModesOnOper(Me); } diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index 6b964a8b2..d9be627e5 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -63,10 +63,10 @@ class ModuleOpermotd : public Module { cmd_opermotd* mycommand; public: - ModuleOpermotd(Server* Me) + ModuleOpermotd(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mycommand = new cmd_opermotd(); Srv->AddCommand(mycommand); opermotd = new FileReader(); @@ -110,7 +110,7 @@ class ModuleOpermotdFactory : public ModuleFactory { } - virtual Module* CreateModule(Server* Me) + virtual Module* CreateModule(InspIRCd* Me) { return new ModuleOpermotd(Me); } diff --git a/src/modules/m_opersha256.cpp b/src/modules/m_opersha256.cpp index 285d58d8b..74dad8315 100644 --- a/src/modules/m_opersha256.cpp +++ b/src/modules/m_opersha256.cpp @@ -247,9 +247,9 @@ class ModuleOperSHA256 : public Module cmd_mksha256 *mksha256cmd; public: - ModuleOperSHA256(Server *Me) : Module::Module(Me) + ModuleOperSHA256(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mksha256cmd = new cmd_mksha256(); Srv->AddCommand(mksha256cmd); } @@ -295,7 +295,7 @@ public: { } - virtual Module *CreateModule(Server* Me) + virtual Module *CreateModule(InspIRCd* Me) { return new ModuleOperSHA256(Me); } diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index a81dfd87e..c21b7f413 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -34,14 +34,14 @@ class ModuleOverride : public Module bool NoisyOverride; public: - ModuleOverride(Server* Me) + ModuleOverride(InspIRCd* Me) : Module::Module(Me) { // here we initialise our module. Use new to create new instances of the required // classes. - Srv = Me; + // read our config options (main config file) OnRehash(""); @@ -268,7 +268,7 @@ class ModuleOverrideFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleOverride(Me); } diff --git a/src/modules/m_park.cpp b/src/modules/m_park.cpp index 3629e9b48..f6e2b69ac 100644 --- a/src/modules/m_park.cpp +++ b/src/modules/m_park.cpp @@ -226,10 +226,10 @@ class ModulePark : public Module DELETE(Conf); } - ModulePark(Server* Me) + ModulePark(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + pinfo.clear(); this->ReadSettings(); cmd1 = new cmd_park(); @@ -374,7 +374,7 @@ class ModuleParkFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModulePark(Me); } diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp index 5f4fcc8f3..953a378eb 100644 --- a/src/modules/m_randquote.cpp +++ b/src/modules/m_randquote.cpp @@ -79,10 +79,10 @@ class ModuleRandQuote : public Module cmd_randquote* mycommand; ConfigReader *conf; public: - ModuleRandQuote(Server* Me) + ModuleRandQuote(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + conf = new ConfigReader; // Sort the Randomizer thingie.. srand(time(NULL)); @@ -148,7 +148,7 @@ class ModuleRandQuoteFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleRandQuote(Me); } diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp index 8e7cefb93..331b29f40 100644 --- a/src/modules/m_redirect.cpp +++ b/src/modules/m_redirect.cpp @@ -29,9 +29,8 @@ extern InspIRCd* ServerInstance; class Redirect : public ModeHandler { - Server* Srv; public: - Redirect(InspIRCd* Instance, Server* s) : ModeHandler(Instance, 'L', 1, 0, false, MODETYPE_CHANNEL, false), Srv(s) { } + Redirect(InspIRCd* Instance) : ModeHandler(Instance, 'L', 1, 0, false, MODETYPE_CHANNEL, false) { } ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter) { @@ -111,11 +110,11 @@ class ModuleRedirect : public Module public: - ModuleRedirect(Server* Me) + ModuleRedirect(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; - re = new Redirect(ServerInstance, Me); + + re = new Redirect(ServerInstance); Srv->AddMode(re, 'L'); } @@ -170,7 +169,7 @@ class ModuleRedirectFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleRedirect(Me); } diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index 5fa614312..9b7d1817c 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -8,6 +8,7 @@ #include "modules.h" #include "helperfuncs.h" #include "configreader.h" +#include "commands.h" #include "inspircd.h" /* $ModDesc: Provides a /remove command, this is mostly an alternative to /kick, except makes users appear to have parted the channel */ @@ -23,12 +24,10 @@ extern InspIRCd* ServerInstance; class RemoveBase { private: - Server* Srv; bool& supportnokicks; protected: - RemoveBase(Server* Me, bool& snk) - : Srv(Me), supportnokicks(snk) + RemoveBase(bool& snk) : supportnokicks(snk) { } @@ -111,7 +110,7 @@ class RemoveBase protectkey = "cm_protect_" + std::string(channel->name); founderkey = "cm_founder_" + std::string(channel->name); - if (Srv->IsUlined(user->server) || Srv->IsUlined(user->nick)) + if (is_uline(user->server) || is_uline(user->nick)) { log(DEBUG, "Setting ulevel to U"); ulevel = chartolevel("U"); @@ -133,7 +132,7 @@ class RemoveBase } /* Now it's the same idea, except for the target. If they're ulined make sure they get a higher level than the sender can */ - if (Srv->IsUlined(target->server) || Srv->IsUlined(target->nick)) + if (is_uline(target->server) || is_uline(target->nick)) { log(DEBUG, "Setting tlevel to U"); tlevel = chartolevel("U"); @@ -208,7 +207,7 @@ class RemoveBase class cmd_remove : public command_t, public RemoveBase { public: - cmd_remove(Server* Srv, bool& snk) : command_t("REMOVE", 0, 2), RemoveBase(Srv, snk) + cmd_remove(bool& snk) : command_t("REMOVE", 0, 2), RemoveBase(snk) { this->source = "m_remove.so"; syntax = "<nick> <channel> [<reason>]"; @@ -223,7 +222,7 @@ class cmd_remove : public command_t, public RemoveBase class cmd_fpart : public command_t, public RemoveBase { public: - cmd_fpart(Server* Srv, bool snk) : command_t("FPART", 0, 2), RemoveBase(Srv, snk) + cmd_fpart(bool& snk) : command_t("FPART", 0, 2), RemoveBase(snk) { this->source = "m_remove.so"; syntax = "<channel> <nick> [<reason>]"; @@ -232,7 +231,7 @@ class cmd_fpart : public command_t, public RemoveBase void Handle (const char** parameters, int pcnt, userrec *user) { RemoveBase::Handle(parameters, pcnt, user, true); - } + } }; class ModuleRemove : public Module @@ -240,15 +239,16 @@ class ModuleRemove : public Module cmd_remove* mycommand; cmd_fpart* mycommand2; bool supportnokicks; + Server* Srv; public: - ModuleRemove(Server* Me) + ModuleRemove(InspIRCd* Me) : Module::Module(Me) { - mycommand = new cmd_remove(Me, supportnokicks); - mycommand2 = new cmd_fpart(Me, supportnokicks); - Me->AddCommand(mycommand); - Me->AddCommand(mycommand2); + mycommand = new cmd_remove(supportnokicks); + mycommand2 = new cmd_fpart(supportnokicks); + Srv->AddCommand(mycommand); + Srv->AddCommand(mycommand2); OnRehash(""); } @@ -295,7 +295,7 @@ class ModuleRemoveFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleRemove(Me); } diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index d5a5baba1..8889823c4 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -47,10 +47,10 @@ class ModuleRestrictChans : public Module } public: - ModuleRestrictChans(Server* Me) + ModuleRestrictChans(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + ReadConfig(); } @@ -102,7 +102,7 @@ class ModuleRestrictChansFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleRestrictChans(Me); } diff --git a/src/modules/m_restrictmsg.cpp b/src/modules/m_restrictmsg.cpp index 75ffc46fd..d8c54d30a 100644 --- a/src/modules/m_restrictmsg.cpp +++ b/src/modules/m_restrictmsg.cpp @@ -33,10 +33,10 @@ class ModuleRestrictMsg : public Module Server *Srv; public: - ModuleRestrictMsg(Server* Me) + ModuleRestrictMsg(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + } void Implements(char* List) @@ -92,7 +92,7 @@ class ModuleRestrictMsgFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleRestrictMsg(Me); } diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp index 543966112..4b8adc0cb 100644 --- a/src/modules/m_safelist.cpp +++ b/src/modules/m_safelist.cpp @@ -53,13 +53,13 @@ class ListTimer : public InspTimer { private: - Server* Srv; char buffer[MAXBUF]; chanrec *chan; + Server* Srv; public: - ListTimer(long interval, Server* Me) : InspTimer(interval,TIME), Srv(Me) + ListTimer(long interval) : InspTimer(interval,TIME) { } @@ -133,7 +133,7 @@ class ListTimer : public InspTimer } } - ListTimer* MyTimer = new ListTimer(1,Srv); + ListTimer* MyTimer = new ListTimer(1); ServerInstance->Timers->AddTimer(MyTimer); } }; @@ -144,11 +144,9 @@ class ModuleSafeList : public Module Server *Srv; ListTimer* MyTimer; public: - ModuleSafeList(Server* Me) : Module::Module(Me) + ModuleSafeList(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; - - MyTimer = new ListTimer(1,Srv); + MyTimer = new ListTimer(1); ServerInstance->Timers->AddTimer(MyTimer); } @@ -285,7 +283,7 @@ class ModuleSafeListFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleSafeList(Me); } diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index 8851a54ef..a170bc2bb 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -65,10 +65,10 @@ class ModuleSajoin : public Module { cmd_sajoin* mycommand; public: - ModuleSajoin(Server* Me) + ModuleSajoin(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mycommand = new cmd_sajoin(); Srv->AddCommand(mycommand); } @@ -97,7 +97,7 @@ class ModuleSajoinFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleSajoin(Me); } diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index 0a60862af..63e2a1f36 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -76,10 +76,10 @@ class ModuleSaMode : public Module { cmd_samode* mycommand; public: - ModuleSaMode(Server* Me) + ModuleSaMode(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mycommand = new cmd_samode(); Srv->AddCommand(mycommand); } @@ -106,7 +106,7 @@ class ModuleSaModeFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleSaMode(Me); } diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp index 42d54731c..65c9bcff9 100644 --- a/src/modules/m_sanick.cpp +++ b/src/modules/m_sanick.cpp @@ -68,10 +68,10 @@ class ModuleSanick : public Module { cmd_sanick* mycommand; public: - ModuleSanick(Server* Me) + ModuleSanick(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mycommand = new cmd_sanick(); Srv->AddCommand(mycommand); } @@ -100,7 +100,7 @@ class ModuleSanickFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleSanick(Me); } diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index fb4117b42..04286f6fc 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -61,10 +61,10 @@ class ModuleSapart : public Module { cmd_sapart* mycommand; public: - ModuleSapart(Server* Me) + ModuleSapart(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mycommand = new cmd_sapart(); Srv->AddCommand(mycommand); } @@ -93,7 +93,7 @@ class ModuleSapartFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleSapart(Me); } diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index 4900a3db8..8ef0a70ab 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -74,10 +74,10 @@ class ModuleSaquit : public Module { cmd_saquit* mycommand; public: - ModuleSaquit(Server* Me) + ModuleSaquit(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mycommand = new cmd_saquit(); Srv->AddCommand(mycommand); } @@ -106,7 +106,7 @@ class ModuleSaquitFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleSaquit(Me); } diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp index fcb2a4e94..c58b4c005 100644 --- a/src/modules/m_securelist.cpp +++ b/src/modules/m_securelist.cpp @@ -34,9 +34,9 @@ class ModuleSecureList : public Module private: Server *Srv; public: - ModuleSecureList(Server* Me) : Module::Module(Me) + ModuleSecureList(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + } virtual ~ModuleSecureList() @@ -103,7 +103,7 @@ class ModuleSecureListFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleSecureList(Me); } diff --git a/src/modules/m_services.cpp b/src/modules/m_services.cpp index 0fc9f1e9d..ff80b8f1b 100644 --- a/src/modules/m_services.cpp +++ b/src/modules/m_services.cpp @@ -22,6 +22,7 @@ using namespace std; #include "modules.h" #include <string> #include "helperfuncs.h" +#include "commands.h" #include "hashcomp.h" #include "inspircd.h" @@ -35,12 +36,12 @@ class Channel_r : public ModeHandler { Server* Srv; public: - Channel_r(InspIRCd* Instance, Server* srv) : ModeHandler(Instance, 'r', 0, 0, false, MODETYPE_CHANNEL, false), Srv(srv) { } + Channel_r(InspIRCd* Instance) : ModeHandler(Instance, 'r', 0, 0, false, MODETYPE_CHANNEL, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { // only a u-lined server may add or remove the +r mode. - if ((Srv->IsUlined(source->nick)) || (Srv->IsUlined(source->server)) || (!*source->server || (strchr(source->nick,'.')))) + if ((is_uline(source->nick)) || (is_uline(source->server)) || (!*source->server || (strchr(source->nick,'.')))) { log(DEBUG,"Allowing cmode +r, server and nick are: '%s','%s'",source->nick,source->server); channel->SetMode('r',adding); @@ -59,11 +60,11 @@ class User_r : public ModeHandler { Server* Srv; public: - User_r(InspIRCd* Instance, Server* srv) : ModeHandler(Instance, 'r', 0, 0, false, MODETYPE_USER, false), Srv(srv) { } + User_r(InspIRCd* Instance) : ModeHandler(Instance, 'r', 0, 0, false, MODETYPE_USER, false) { } ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding) { - if ((kludgeme) || (Srv->IsUlined(source->nick)) || (Srv->IsUlined(source->server)) || (!*source->server || (strchr(source->nick,'.')))) + if ((kludgeme) || (is_uline(source->nick)) || (is_uline(source->server)) || (!*source->server || (strchr(source->nick,'.')))) { log(DEBUG,"Allowing umode +r, server and nick are: '%s','%s'",source->nick,source->server); dest->SetMode('r',adding); @@ -171,14 +172,14 @@ class ModuleServices : public Module User_r* m4; User_R* m5; public: - ModuleServices(Server* Me) + ModuleServices(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; - m1 = new Channel_r(ServerInstance, Me); + + m1 = new Channel_r(ServerInstance); m2 = new Channel_R(ServerInstance); m3 = new Channel_M(ServerInstance); - m4 = new User_r(ServerInstance, Me); + m4 = new User_r(ServerInstance); m5 = new User_R(ServerInstance); Srv->AddMode(m1, 'r'); Srv->AddMode(m2, 'R'); @@ -229,7 +230,7 @@ class ModuleServices : public Module chanrec* c = (chanrec*)dest; if ((c->IsModeSet('M')) && (!user->IsModeSet('r'))) { - if ((Srv->IsUlined(user->nick)) || (Srv->IsUlined(user->server)) || (!strcmp(user->server,""))) + if ((is_uline(user->nick)) || (is_uline(user->server)) || (!strcmp(user->server,""))) { // user is ulined, can speak regardless return 0; @@ -244,7 +245,7 @@ class ModuleServices : public Module userrec* u = (userrec*)dest; if ((u->IsModeSet('R')) && (user->IsModeSet('r'))) { - if ((Srv->IsUlined(user->nick)) || (Srv->IsUlined(user->server))) + if ((is_uline(user->nick)) || (is_uline(user->server))) { // user is ulined, can speak regardless return 0; @@ -270,7 +271,7 @@ class ModuleServices : public Module { if (user->IsModeSet('r')) { - if ((Srv->IsUlined(user->nick)) || (Srv->IsUlined(user->server))) + if ((is_uline(user->nick)) || (is_uline(user->server))) { // user is ulined, won't be stopped from joining return 0; @@ -311,7 +312,7 @@ class ModuleServicesFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleServices(Me); } diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index 19e010b69..648191e3d 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -120,9 +120,9 @@ class ModuleServicesAccount : public Module AChannel_M* m2; AUser_R* m3; public: - ModuleServicesAccount(Server* Me) : Module::Module(Me) + ModuleServicesAccount(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + m1 = new AChannel_R(ServerInstance); m2 = new AChannel_M(ServerInstance); m3 = new AUser_R(ServerInstance); @@ -338,7 +338,7 @@ class ModuleServicesAccountFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleServicesAccount(Me); } diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index 697ba1dfd..7daccb293 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -66,10 +66,10 @@ class ModuleSetHost : public Module { cmd_sethost* mycommand; public: - ModuleSetHost(Server* Me) + ModuleSetHost(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mycommand = new cmd_sethost(); Srv->AddCommand(mycommand); } @@ -98,7 +98,7 @@ class ModuleSetHostFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleSetHost(Me); } diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp index b3bcef53b..ad14c786f 100644 --- a/src/modules/m_setident.cpp +++ b/src/modules/m_setident.cpp @@ -39,9 +39,9 @@ class ModuleSetIdent : public Module cmd_setident* mycommand; public: - ModuleSetIdent(Server* Me) : Module::Module(Me) + ModuleSetIdent(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mycommand = new cmd_setident(); Srv->AddCommand(mycommand); } @@ -70,7 +70,7 @@ class ModuleSetIdentFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleSetIdent(Me); } diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp index c83c7e7e0..2c09422df 100644 --- a/src/modules/m_setidle.cpp +++ b/src/modules/m_setidle.cpp @@ -59,10 +59,10 @@ class ModuleSetIdle : public Module { cmd_setidle* mycommand; public: - ModuleSetIdle(Server* Me) + ModuleSetIdle(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mycommand = new cmd_setidle(); Srv->AddCommand(mycommand); } @@ -91,7 +91,7 @@ class ModuleSetIdleFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleSetIdle(Me); } diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp index 30eab34df..163f30f73 100644 --- a/src/modules/m_setname.cpp +++ b/src/modules/m_setname.cpp @@ -53,10 +53,10 @@ class ModuleSetName : public Module { cmd_setname* mycommand; public: - ModuleSetName(Server* Me) + ModuleSetName(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mycommand = new cmd_setname(); Srv->AddCommand(mycommand); } @@ -85,7 +85,7 @@ class ModuleSetNameFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleSetName(Me); } diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp index 33f59e756..c94d58ec1 100644 --- a/src/modules/m_showwhois.cpp +++ b/src/modules/m_showwhois.cpp @@ -52,9 +52,9 @@ class ModuleShowwhois : public Module public: - ModuleShowwhois(Server* Me) : Module::Module(Me) + ModuleShowwhois(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + sw = new SeeWhois(ServerInstance); Srv->AddMode(sw, 'W'); } @@ -95,7 +95,7 @@ class ModuleShowwhoisFactory : public ModuleFactory { } - virtual Module* CreateModule(Server* Me) + virtual Module* CreateModule(InspIRCd* Me) { return new ModuleShowwhois(Me); } diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 923c24981..e912f0c13 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -138,10 +138,10 @@ class ModuleSilence : public Module cmd_silence* mycommand; public: - ModuleSilence(Server* Me) + ModuleSilence(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mycommand = new cmd_silence(); Srv->AddCommand(mycommand); } @@ -224,7 +224,7 @@ class ModuleSilenceFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleSilence(Me); } diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index d9e18ef80..ccd1714b3 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -3420,10 +3420,10 @@ class ModuleSpanningTree : public Module public: - ModuleSpanningTree(Server* Me) + ModuleSpanningTree(InspIRCd* Me) : Module::Module(Me), max_local(0), max_global(0) { - Srv = Me; + Bindings.clear(); // Create the root of the tree @@ -4519,7 +4519,7 @@ class ModuleSpanningTreeFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { TreeProtocolModule = new ModuleSpanningTree(Me); return TreeProtocolModule; diff --git a/src/modules/m_spy.cpp b/src/modules/m_spy.cpp index 4ded5374f..55a1c6751 100644 --- a/src/modules/m_spy.cpp +++ b/src/modules/m_spy.cpp @@ -145,9 +145,9 @@ class ModuleSpy : public Module cmd_spylist *mycommand; cmd_spynames *mycommand2; public: - ModuleSpy(Server* Me) : Module::Module(Me) + ModuleSpy(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mycommand = new cmd_spylist(); mycommand2 = new cmd_spynames(); Srv->AddCommand(mycommand); @@ -176,7 +176,7 @@ class ModuleSpyFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleSpy(Me); } diff --git a/src/modules/m_ssl_dummy.cpp b/src/modules/m_ssl_dummy.cpp index 1b022c14b..5456be6f1 100644 --- a/src/modules/m_ssl_dummy.cpp +++ b/src/modules/m_ssl_dummy.cpp @@ -27,9 +27,9 @@ class ModuleSSLDummy : public Module char* dummy; public: - ModuleSSLDummy(Server* Me) : Module::Module(Me) + ModuleSSLDummy(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + } virtual ~ModuleSSLDummy() @@ -96,7 +96,7 @@ class ModuleSSLDummyFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleSSLDummy(Me); } diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp index bc4679fd7..7638d42ca 100644 --- a/src/modules/m_sslmodes.cpp +++ b/src/modules/m_sslmodes.cpp @@ -60,10 +60,10 @@ class ModuleSSLModes : public Module SSLMode* sslm; public: - ModuleSSLModes(Server* Me) + ModuleSSLModes(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + sslm = new SSLMode(ServerInstance); Srv->AddMode(sslm, 'z'); @@ -122,7 +122,7 @@ class ModuleSSLModesFactory : public ModuleFactory { } - virtual Module* CreateModule(Server* Me) + virtual Module* CreateModule(InspIRCd* Me) { return new ModuleSSLModes(Me); } diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp index d6b04dd58..935e3fe1b 100644 --- a/src/modules/m_stripcolor.cpp +++ b/src/modules/m_stripcolor.cpp @@ -101,10 +101,10 @@ class ModuleStripColor : public Module UserStripColor *usc; public: - ModuleStripColor(Server* Me) + ModuleStripColor(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + usc = new UserStripColor(ServerInstance); csc = new ChannelStripColor(ServerInstance); @@ -230,7 +230,7 @@ class ModuleStripColorFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleStripColor(Me); } diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index 35ffd6d8f..b14cdcfc2 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -82,9 +82,9 @@ class ModuleSWhois : public Module ConfigReader* Conf; public: - ModuleSWhois(Server* Me) : Module::Module(Me) + ModuleSWhois(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + Conf = new ConfigReader(); mycommand = new cmd_swhois(Srv); Srv->AddCommand(mycommand); @@ -236,7 +236,7 @@ class ModuleSWhoisFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleSWhois(Me); } diff --git a/src/modules/m_testcommand.cpp b/src/modules/m_testcommand.cpp index 8daabe889..ffa79f2cd 100644 --- a/src/modules/m_testcommand.cpp +++ b/src/modules/m_testcommand.cpp @@ -81,10 +81,10 @@ class ModuleTestCommand : public Module { cmd_woot* newcommand; public: - ModuleTestCommand(Server* Me) + ModuleTestCommand(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + // Create a new command: // command will be called /WOOT, and will // call handle_woot when triggered, the @@ -126,7 +126,7 @@ class ModuleTestCommandFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleTestCommand(Me); } diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 5db5753bd..a0b5fe95f 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -116,10 +116,10 @@ class ModuleTimedBans : public Module { cmd_tban* mycommand; public: - ModuleTimedBans(Server* Me) + ModuleTimedBans(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mycommand = new cmd_tban(); Srv->AddCommand(mycommand); TimedBanList.clear(); @@ -217,7 +217,7 @@ class ModuleTimedBansFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleTimedBans(Me); } diff --git a/src/modules/m_tline.cpp b/src/modules/m_tline.cpp index 47f82200e..b35ad6d10 100644 --- a/src/modules/m_tline.cpp +++ b/src/modules/m_tline.cpp @@ -77,10 +77,10 @@ class ModuleTLine : public Module { cmd_tline* newcommand; public: - ModuleTLine(Server* Me) + ModuleTLine(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + newcommand = new cmd_tline(); Srv->AddCommand(newcommand); } @@ -111,7 +111,7 @@ class ModuleTLineFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleTLine(Me); } diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp index 5159f218f..c7750a1e9 100644 --- a/src/modules/m_uninvite.cpp +++ b/src/modules/m_uninvite.cpp @@ -92,9 +92,9 @@ class ModuleUninvite : public Module public: - ModuleUninvite(Server* Me) : Module::Module(Me) + ModuleUninvite(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mycommand = new cmd_uninvite(); Srv->AddCommand(mycommand); } @@ -122,7 +122,7 @@ class ModuleUninviteFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleUninvite(Me); } diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index 80ab67be1..861d5a0e5 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -59,10 +59,10 @@ class ModuleUserIP : public Module { cmd_userip* mycommand; public: - ModuleUserIP(Server* Me) + ModuleUserIP(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mycommand = new cmd_userip(); Srv->AddCommand(mycommand); } @@ -101,7 +101,7 @@ class ModuleUserIPFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleUserIP(Me); } diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp index 80d3f8f6b..cea5877b1 100644 --- a/src/modules/m_vhost.cpp +++ b/src/modules/m_vhost.cpp @@ -64,9 +64,9 @@ class ModuleVHost : public Module cmd_vhost* mycommand; public: - ModuleVHost(Server* Me) : Module::Module(Me) + ModuleVHost(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + Conf = new ConfigReader; mycommand = new cmd_vhost(); Srv->AddCommand(mycommand); @@ -110,7 +110,7 @@ class ModuleVHostFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new ModuleVHost(Me); } diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index 8e6b2c50c..b352162a6 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -202,10 +202,10 @@ class Modulewatch : public Module cmd_watch* mycommand; public: - Modulewatch(Server* Me) + Modulewatch(InspIRCd* Me) : Module::Module(Me) { - Srv = Me; + mycommand = new cmd_watch(); Srv->AddCommand(mycommand); } @@ -315,7 +315,7 @@ class ModulewatchFactory : public ModuleFactory { } - virtual Module * CreateModule(Server* Me) + virtual Module * CreateModule(InspIRCd* Me) { return new Modulewatch(Me); } |