diff options
Diffstat (limited to 'src/modules')
29 files changed, 109 insertions, 107 deletions
diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 3e09aef2f..f3e2ed3f8 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -71,7 +71,7 @@ class ModuleAlias : public Module : Module::Module(Me) { - MyConf = new ConfigReader; + MyConf = new ConfigReader(ServerInstance); ReadAliases(); } @@ -149,7 +149,7 @@ class ModuleAlias : public Module virtual void OnRehash(const std::string ¶meter) { DELETE(MyConf); - MyConf = new ConfigReader; + MyConf = new ConfigReader(ServerInstance); ReadAliases(); } diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index 856b4bd88..38fed16d6 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -74,7 +74,7 @@ public: virtual void OnRehash(const std::string ¶meter) { - ConfigReader* Conf = new ConfigReader; + ConfigReader* Conf = new ConfigReader(ServerInstance); ForgetDelay = Conf->ReadInteger("blockamsg", "delay", 0, false); if(Conf->GetError() == CONF_VALUE_NOT_FOUND) diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index 796224890..d227a2347 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -203,10 +203,10 @@ class ModuleCensor : public Module * reload our config file on rehash - we must destroy and re-allocate the classes * to call the constructor again and re-read our data. */ - ConfigReader* Conf = new ConfigReader; + ConfigReader* Conf = new ConfigReader(ServerInstance); std::string Censorfile = Conf->ReadValue("censor","file",0); // this automatically re-reads the configuration file into the class - ConfigReader* MyConf = new ConfigReader(Censorfile); + ConfigReader* MyConf = new ConfigReader(ServerInstance, Censorfile); if ((Censorfile == "") || (!MyConf->Verify())) { CensorException e; diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 05f34d037..d89c2c3e3 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -110,7 +110,7 @@ public: virtual void OnRehash(const std::string ¶meter) { - ConfigReader Conf; + ConfigReader Conf(ServerInstance); NotifyOpers = Conf.ReadFlag("cgiirc", "opernotice", 0); // If we send an oper notice when a CGI:IRC has their host changed. diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index c9cdc2f60..c88b99cdc 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -297,7 +297,7 @@ class ModuleChanProtect : public Module * object was kept between rehashes...now we just * stack-allocate it locally. */ - ConfigReader Conf; + ConfigReader Conf(ServerInstance); FirstInGetsFounder = Conf.ReadFlag("options","noservices",0); } diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index e00e0ac86..fcda8881a 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -374,7 +374,7 @@ class CloakUser : public ModeHandler void DoRehash() { - ConfigReader Conf; + ConfigReader Conf(ServerInstance); key1 = key2 = key3 = key4 = 0; key1 = Conf.ReadInteger("cloak","key1",0,false); key2 = Conf.ReadInteger("cloak","key2",0,false); diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp index 9bbac7aa3..e04563218 100644 --- a/src/modules/m_conn_waitpong.cpp +++ b/src/modules/m_conn_waitpong.cpp @@ -47,7 +47,7 @@ class ModuleWaitPong : public Module virtual void OnRehash(const std::string ¶m) { - Conf = new ConfigReader; + Conf = new ConfigReader(ServerInstance); sendsnotice = Conf->ReadFlag("waitpong", "sendsnotice", 0); diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp index 89c7f4c62..bf05c272a 100644 --- a/src/modules/m_connflood.cpp +++ b/src/modules/m_connflood.cpp @@ -64,7 +64,7 @@ public: void InitConf() { /* read configuration variables */ - conf = new ConfigReader; + conf = new ConfigReader(ServerInstance); /* throttle configuration */ seconds = conf->ReadInteger("connflood", "seconds", 0, true); maxconns = conf->ReadInteger("connflood", "maxconns", 0, true); diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp index c823b9c1e..67a7aaca6 100644 --- a/src/modules/m_denychans.cpp +++ b/src/modules/m_denychans.cpp @@ -34,13 +34,13 @@ class ModuleDenyChannels : public Module ModuleDenyChannels(InspIRCd* Me) : Module::Module(Me) { - Conf = new ConfigReader; + Conf = new ConfigReader(ServerInstance); } virtual void OnRehash(const std::string ¶m) { DELETE(Conf); - Conf = new ConfigReader; + Conf = new ConfigReader(ServerInstance); } virtual ~ModuleDenyChannels() diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index c54be801e..526316362 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -126,10 +126,10 @@ class ModuleFilter : public Module { // reload our config file on rehash - we must destroy and re-allocate the classes // to call the constructor again and re-read our data. - ConfigReader* Conf = new ConfigReader; + ConfigReader* Conf = new ConfigReader(ServerInstance); std::string filterfile = Conf->ReadValue("filter","file",0); // this automatically re-reads the configuration file into the class - ConfigReader* MyConf = new ConfigReader(filterfile); + ConfigReader* MyConf = new ConfigReader(ServerInstance, filterfile); if ((filterfile == "") || (!MyConf->Verify())) { // bail if the user forgot to create a config file diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index 452a7114b..46b82b234 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -210,7 +210,7 @@ class ModuleHelpop : public Module virtual void ReadConfig() { - conf = new ConfigReader; + conf = new ConfigReader(ServerInstance); h_file = conf->ReadValue("helpop", "file", 0); if (h_file == "") @@ -220,7 +220,7 @@ class ModuleHelpop : public Module throw(e); } - helpop = new ConfigReader(h_file); + helpop = new ConfigReader(ServerInstance, h_file); if ((helpop->ReadValue("nohelp", "line1", 0) == "") || (helpop->ReadValue("nohelpo", "line1", 0) == "") || (helpop->ReadValue("start", "line1", 0) == "")) diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index 2fe7ddbb8..d270c74d4 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -49,7 +49,7 @@ class ModuleHostChange : public Module : Module::Module(Me) { - Conf = new ConfigReader; + Conf = new ConfigReader(ServerInstance); OnRehash(""); } @@ -71,7 +71,7 @@ class ModuleHostChange : public Module virtual void OnRehash(const std::string ¶meter) { DELETE(Conf); - Conf = new ConfigReader; + Conf = new ConfigReader(ServerInstance); MySuffix = Conf->ReadValue("host","suffix",0); for (hostchanges_t::iterator i = hostchanges.begin(); i != hostchanges.end(); i++) { diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index f8178ed3a..1afa3bd09 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -220,7 +220,7 @@ class HttpSocket : public InspSocket claimed = false; HTTPRequest httpr(request_type,uri,&headers,this,this->GetIP()); Event e((char*)&httpr, (Module*)HttpModule, "httpd_url"); - e.Send(); + e.Send(this->Instance); if (!claimed) { @@ -258,7 +258,7 @@ class ModuleHttp : public Module std::string bindip; std::string indexfile; - FileReader index; + FileReader* index; HttpSocket* http; @@ -266,18 +266,23 @@ class ModuleHttp : public Module void ReadConfig() { - ConfigReader c; + ConfigReader c(ServerInstance); this->host = c.ReadValue("http", "host", 0); this->bindip = c.ReadValue("http", "ip", 0); this->port = c.ReadInteger("http", "port", 0, true); this->indexfile = c.ReadValue("http", "index", 0); - index.LoadFile(this->indexfile); + if (index) + { + delete index; + index = NULL; + } + index = new FileReader(ServerInstance, this->indexfile); } void CreateListener() { - http = new HttpSocket(ServerInstance, this->bindip, this->port, true, 0, &index); + http = new HttpSocket(ServerInstance, this->bindip, this->port, true, 0, index); if ((http) && (http->GetState() == I_LISTENING)) { ServerInstance->AddSocket(http); @@ -286,7 +291,7 @@ class ModuleHttp : public Module ModuleHttp(InspIRCd* Me) : Module::Module(Me) { - + index = NULL; ReadConfig(); CreateListener(); } diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index a52089a93..7e7c106a1 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -49,7 +49,7 @@ class ModuleHttpStats : public Module void ReadConfig() { - ConfigReader c; + ConfigReader c(ServerInstance); this->stylesheet = c.ReadValue("httpstats", "stylesheet", 0); } diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 88229c6c1..47266469d 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -181,7 +181,7 @@ class ModuleIdent : public Module public: void ReadSettings() { - Conf = new ConfigReader; + Conf = new ConfigReader(ServerInstance); IdentTimeout = Conf->ReadInteger("ident","timeout",0,true); if (!IdentTimeout) IdentTimeout = 1; diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index 25938d0cc..776e1a16d 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -229,7 +229,7 @@ class ModuleMsgFlood : public Module n.push_back("+b"); n.push_back(user->MakeWildHost()); Event rmode((char *)&n, NULL, "send_mode"); - rmode.Send(); + rmode.Send(ServerInstance); } dest->ServerKickUser(user, "Channel flood triggered (mode +f)", true); } diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp index dc8e1081a..45c5e3959 100644 --- a/src/modules/m_operjoin.cpp +++ b/src/modules/m_operjoin.cpp @@ -43,7 +43,7 @@ class ModuleOperjoin : public Module : Module::Module(Me) { - conf = new ConfigReader; + conf = new ConfigReader(ServerInstance); operChan = conf->ReadValue("operjoin", "channel", 0); } @@ -55,7 +55,7 @@ class ModuleOperjoin : public Module virtual void OnRehash(const std::string ¶meter) { DELETE(conf); - conf = new ConfigReader; + conf = new ConfigReader(ServerInstance); } virtual ~ModuleOperjoin() diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp index 1909ab5c8..a8f45d6f9 100644 --- a/src/modules/m_operlevels.cpp +++ b/src/modules/m_operlevels.cpp @@ -26,7 +26,7 @@ class ModuleOperLevels : public Module { - conf = new ConfigReader; + conf = new ConfigReader(ServerInstance); } virtual ~ModuleOperLevels() @@ -42,7 +42,7 @@ class ModuleOperLevels : public Module virtual void OnRehash(const std::string ¶meter) { DELETE(conf); - conf = new ConfigReader; + conf = new ConfigReader(ServerInstance); } virtual Version GetVersion() diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp index b354abf0a..4526b05d3 100644 --- a/src/modules/m_opermodes.cpp +++ b/src/modules/m_opermodes.cpp @@ -36,7 +36,7 @@ class ModuleModesOnOper : public Module : Module::Module(Me) { - Conf = new ConfigReader; + Conf = new ConfigReader(ServerInstance); } void Implements(char* List) @@ -47,7 +47,7 @@ class ModuleModesOnOper : public Module virtual void OnRehash(const std::string ¶meter) { DELETE(Conf); - Conf = new ConfigReader; + Conf = new ConfigReader(ServerInstance); } virtual ~ModuleModesOnOper() diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index b988dd00e..f0457904a 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -13,18 +13,6 @@ using namespace std; static FileReader* opermotd; - -void LoadOperMOTD() -{ - ConfigReader* conf = new ConfigReader; - std::string filename; - - filename = conf->ReadValue("opermotd","file",0); - - opermotd->LoadFile(filename); - DELETE(conf); -} - void ShowOperMOTD(userrec* user) { if(!opermotd->FileSize()) @@ -32,22 +20,18 @@ void ShowOperMOTD(userrec* user) user->WriteServ(std::string("425 ") + user->nick + std::string(" :OPERMOTD file is missing")); return; } - user->WriteServ(std::string("375 ") + user->nick + std::string(" :- IRC Operators Message of the Day")); - for(int i=0; i != opermotd->FileSize(); i++) { user->WriteServ(std::string("372 ") + user->nick + std::string(" :- ") + opermotd->GetLine(i)); } - user->WriteServ(std::string("376 ") + user->nick + std::string(" :- End of OPERMOTD")); - } class cmd_opermotd : public command_t { public: - cmd_opermotd (InspIRCd* Instance) : command_t(Instance,"OPERMOTD", 'o', 0) + cmd_opermotd (InspIRCd* Instance) : command_t(Instance,"OPERMOTD", 'o', 0) { this->source = "m_opermotd.so"; syntax = "[<servername>]"; @@ -59,62 +43,76 @@ class cmd_opermotd : public command_t } }; + class ModuleOpermotd : public Module { - cmd_opermotd* mycommand; - public: - ModuleOpermotd(InspIRCd* Me) - : Module::Module(Me) - { - - mycommand = new cmd_opermotd(ServerInstance); - ServerInstance->AddCommand(mycommand); - opermotd = new FileReader(); - LoadOperMOTD(); - } + cmd_opermotd* mycommand; + public: - virtual ~ModuleOpermotd() + void LoadOperMOTD() + { + ConfigReader* conf = new ConfigReader(ServerInstance); + std::string filename; + filename = conf->ReadValue("opermotd","file",0); + if (opermotd) { + delete opermotd; + opermotd = NULL; } + opermotd = new FileReader(ServerInstance, filename); + DELETE(conf); + } + + ModuleOpermotd(InspIRCd* Me) + : Module::Module(Me) + { + opermotd = NULL; + mycommand = new cmd_opermotd(ServerInstance); + ServerInstance->AddCommand(mycommand); + opermotd = new FileReader(ServerInstance); + LoadOperMOTD(); + } - virtual Version GetVersion() - { - return Version(1,0,0,1,VF_VENDOR); - } + virtual ~ModuleOpermotd() + { + } - void Implements(char* List) - { - List[I_OnRehash] = List[I_OnOper] = 1; - } + virtual Version GetVersion() + { + return Version(1,0,0,1,VF_VENDOR); + } - virtual void OnOper(userrec* user, const std::string &opertype) - { - ShowOperMOTD(user); - } + void Implements(char* List) + { + List[I_OnRehash] = List[I_OnOper] = 1; + } - virtual void OnRehash(const std::string ¶meter) - { - LoadOperMOTD(); - } + virtual void OnOper(userrec* user, const std::string &opertype) + { + ShowOperMOTD(user); + } + virtual void OnRehash(const std::string ¶meter) + { + LoadOperMOTD(); + } }; class ModuleOpermotdFactory : public ModuleFactory { - public: - ModuleOpermotdFactory() - { - } - - ~ModuleOpermotdFactory() - { - } + public: + ModuleOpermotdFactory() + { + } - virtual Module* CreateModule(InspIRCd* Me) - { - return new ModuleOpermotd(Me); - } + ~ModuleOpermotdFactory() + { + } + virtual Module* CreateModule(InspIRCd* Me) + { + return new ModuleOpermotd(Me); + } }; extern "C" void* init_module(void) diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index 7b5349068..c65a992e7 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -50,7 +50,7 @@ class ModuleOverride : public Module virtual void OnRehash(const std::string ¶meter) { // on a rehash we delete our classes for good measure and create them again. - ConfigReader* Conf = new ConfigReader; + ConfigReader* Conf = new ConfigReader(ServerInstance); // re-read our config options on a rehash NoisyOverride = Conf->ReadFlag("override","noisy",0); diff --git a/src/modules/m_park.cpp b/src/modules/m_park.cpp index c232e8a2c..e27a47d04 100644 --- a/src/modules/m_park.cpp +++ b/src/modules/m_park.cpp @@ -219,7 +219,7 @@ class ModulePark : public Module public: virtual void ReadSettings() { - Conf = new ConfigReader; + Conf = new ConfigReader(ServerInstance); ParkMaxTime = Conf->ReadInteger("park","maxtime",0,true); ConcurrentParks = Conf->ReadInteger("park","maxperip",0,true); ParkMaxMsgs = Conf->ReadInteger("park","maxmessages",0,true); diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp index c1353ef09..035b39a0c 100644 --- a/src/modules/m_randquote.cpp +++ b/src/modules/m_randquote.cpp @@ -83,7 +83,7 @@ class ModuleRandQuote : public Module : Module::Module(Me) { - conf = new ConfigReader; + conf = new ConfigReader(ServerInstance); // Sort the Randomizer thingie.. srand(time(NULL)); @@ -99,7 +99,7 @@ class ModuleRandQuote : public Module throw(e); } - quotes = new FileReader(q_file); + quotes = new FileReader(ServerInstance, q_file); if(!quotes->Exists()) { RandquoteException e("m_randquote: QuoteFile not Found!! Please check your config - module will not function."); diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index be2364934..e4b149df2 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -263,8 +263,7 @@ class ModuleRemove : public Module virtual void OnRehash(const std::string&) { - ConfigReader conf; - + ConfigReader conf(ServerInstance); supportnokicks = conf.ReadFlag("remove", "supportnokicks", 0); } diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index eb1feffa8..50d83617c 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -34,7 +34,7 @@ class ModuleRestrictChans : public Module void ReadConfig() { - ConfigReader* MyConf = new ConfigReader(); + ConfigReader* MyConf = new ConfigReader(ServerInstance); allowchans.clear(); for (int i = 0; i < MyConf->Enumerate("allowchannel"); i++) { diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 4ff327598..57c1ce406 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -1935,7 +1935,7 @@ class TreeSocket : public InspSocket std::deque<std::string> par; par.push_back(prefix); par.push_back(""); - DoStats(*(params[0].c_str()), source, results); + DoStats(this->Instance, *(params[0].c_str()), source, results); for (size_t i = 0; i < results.size(); i++) { par[1] = "::" + results[i]; @@ -2299,7 +2299,7 @@ class TreeSocket : public InspSocket unsigned long signon = atoi(params[1].c_str()); unsigned long idle = atoi(params[2].c_str()); if ((who_to_send_to) && (IS_LOCAL(who_to_send_to))) - do_whois(who_to_send_to,u,signon,idle,nick_whoised.c_str()); + do_whois(this->Instance,who_to_send_to,u,signon,idle,nick_whoised.c_str()); } else { @@ -3073,12 +3073,12 @@ class ServernameResolver : public Resolver * admin takes the tag away and rehashes while the domain is resolving. */ Link MyLink; - public: + public: ServernameResolver(InspIRCd* Instance, const std::string &hostname, Link x) : Resolver(Instance, hostname, DNS_QUERY_FORWARD), MyLink(x) { /* Nothing in here, folks */ } - + void OnLookupComplete(const std::string &result) { /* Initiate the connection, now that we have an IP to use. @@ -3304,7 +3304,7 @@ std::vector<TreeSocket*> Bindings; void ReadConfiguration(bool rebind) { - Conf = new ConfigReader; + Conf = new ConfigReader(ServerInstance); if (rebind) { for (int j =0; j < Conf->Enumerate("bind"); j++) diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index 23001d203..741031561 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -84,7 +84,7 @@ class ModuleSWhois : public Module ModuleSWhois(InspIRCd* Me) : Module::Module(Me) { - Conf = new ConfigReader(); + Conf = new ConfigReader(ServerInstance); mycommand = new cmd_swhois(ServerInstance); ServerInstance->AddCommand(mycommand); } @@ -92,7 +92,7 @@ class ModuleSWhois : public Module void OnRehash(const std::string ¶meter) { DELETE(Conf); - Conf = new ConfigReader(); + Conf = new ConfigReader(ServerInstance); } void Implements(char* List) diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 30aba781c..a063ce12d 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -184,7 +184,7 @@ class ModuleTimedBans : public Module n.push_back("-b"); n.push_back(i->mask); Event rmode((char *)&n, NULL, "send_mode"); - rmode.Send(); + rmode.Send(ServerInstance); DELETE(temp); } else diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp index af2dd2bb9..f0ebfe54b 100644 --- a/src/modules/m_vhost.cpp +++ b/src/modules/m_vhost.cpp @@ -67,7 +67,7 @@ class ModuleVHost : public Module ModuleVHost(InspIRCd* Me) : Module::Module(Me) { - Conf = new ConfigReader; + Conf = new ConfigReader(ServerInstance); mycommand = new cmd_vhost(ServerInstance); ServerInstance->AddCommand(mycommand); } @@ -85,7 +85,7 @@ class ModuleVHost : public Module virtual void OnRehash(const std::string ¶meter) { DELETE(Conf); - Conf = new ConfigReader; + Conf = new ConfigReader(ServerInstance); } virtual Version GetVersion() |