diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-26 14:13:13 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-26 14:13:13 +0000 |
commit | 6d03943426dcce76ba66567a9b18425a5ebb4c0c (patch) | |
tree | bedffa6d2a65a9ef556405224a6d7a181c8a1ba5 /src/modules | |
parent | 810c662c9b55908101ca085293c52c3239ef22d1 (diff) |
Remove InspIRCd* parameters and fields
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11763 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
179 files changed, 575 insertions, 671 deletions
diff --git a/src/modules/extra/m_geoip.cpp b/src/modules/extra/m_geoip.cpp index d442cc16d..13b35fdfb 100644 --- a/src/modules/extra/m_geoip.cpp +++ b/src/modules/extra/m_geoip.cpp @@ -29,8 +29,7 @@ class ModuleGeoIP : public Module public: - ModuleGeoIP(InspIRCd *Me) : Module(Me) - { + ModuleGeoIP() { OnRehash(NULL); Implementation eventlist[] = { I_OnRehash, I_OnUserRegister }; ServerInstance->Modules->Attach(eventlist, this, 2); @@ -51,7 +50,7 @@ class ModuleGeoIP : public Module { GeoBans.clear(); - ConfigReader conf(ServerInstance); + ConfigReader conf; banunknown = conf.ReadFlag("geoip", "banunknown", 0); diff --git a/src/modules/extra/m_ldapauth.cpp b/src/modules/extra/m_ldapauth.cpp index 45202e6fa..6fa5abfe7 100644 --- a/src/modules/extra/m_ldapauth.cpp +++ b/src/modules/extra/m_ldapauth.cpp @@ -46,9 +46,8 @@ class ModuleLDAPAuth : public Module LDAP *conn; public: - ModuleLDAPAuth(InspIRCd* Me) - : Module(Me) - { + ModuleLDAPAuth() + { conn = NULL; Implementation eventlist[] = { I_OnUserDisconnect, I_OnCheckReady, I_OnRehash, I_OnUserRegister }; ServerInstance->Modules->Attach(eventlist, this, 4); @@ -63,7 +62,7 @@ public: virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; base = Conf.ReadValue("ldapauth", "baserdn", 0); attribute = Conf.ReadValue("ldapauth", "attribute", 0); diff --git a/src/modules/extra/m_ldapoper.cpp b/src/modules/extra/m_ldapoper.cpp index ed06d6890..634a99fa7 100644 --- a/src/modules/extra/m_ldapoper.cpp +++ b/src/modules/extra/m_ldapoper.cpp @@ -41,9 +41,8 @@ class ModuleLDAPAuth : public Module LDAP *conn; public: - ModuleLDAPAuth(InspIRCd* Me) - : Module(Me) - { + ModuleLDAPAuth() + { conn = NULL; Implementation eventlist[] = { I_OnRehash, I_OnPassCompare }; ServerInstance->Modules->Attach(eventlist, this, 2); @@ -58,7 +57,7 @@ public: virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; base = Conf.ReadValue("ldapoper", "baserdn", 0); ldapserver = Conf.ReadValue("ldapoper", "server", 0); diff --git a/src/modules/extra/m_mssql.cpp b/src/modules/extra/m_mssql.cpp index f58858696..8cd9e2ea7 100644 --- a/src/modules/extra/m_mssql.cpp +++ b/src/modules/extra/m_mssql.cpp @@ -51,11 +51,9 @@ class QueryThread : public SocketThread { private: ModuleMsSQL* Parent; - InspIRCd* ServerInstance; public: - QueryThread(InspIRCd* si, ModuleMsSQL* mod) - : SocketThread(si), Parent(mod), ServerInstance(si) - { + QueryThread(ModuleMsSQL* mod) + : SocketThread(si), Parent(mod), { } ~QueryThread() { } virtual void Run(); @@ -232,7 +230,6 @@ class SQLConn : public classbase { private: ResultQueue results; - InspIRCd* ServerInstance; Module* mod; SQLhost host; TDSLOGIN* login; @@ -242,8 +239,8 @@ class SQLConn : public classbase public: QueryQueue queue; - SQLConn(InspIRCd* SI, Module* m, const SQLhost& hi) - : ServerInstance(SI), mod(m), host(hi), login(NULL), sock(NULL), context(NULL) + SQLConn(Module* m, const SQLhost& hi) + : mod(m), host(hi), login(NULL), sock(NULL), context(NULL) { if (OpenDB()) { @@ -643,8 +640,8 @@ class ModuleMsSQL : public Module QueryThread* queryDispatcher; public: - ModuleMsSQL(InspIRCd* Me) - : Module(Me), currid(0) + ModuleMsSQL() + : currid(0) { LoggingMutex = new Mutex(); ResultsMutex = new Mutex(); @@ -658,7 +655,7 @@ class ModuleMsSQL : public Module ReadConf(); - queryDispatcher = new QueryThread(ServerInstance, this); + queryDispatcher = new QueryThread(this); ServerInstance->Threads->Start(queryDispatcher); ServerInstance->Modules->PublishInterface("SQL", this); @@ -709,7 +706,7 @@ class ModuleMsSQL : public Module bool HostInConf(const SQLhost &h) { - ConfigReader conf(ServerInstance); + ConfigReader conf; for(int i = 0; i < conf.Enumerate("database"); i++) { SQLhost host; @@ -729,7 +726,7 @@ class ModuleMsSQL : public Module { ClearOldConnections(); - ConfigReader conf(ServerInstance); + ConfigReader conf; for(int i = 0; i < conf.Enumerate("database"); i++) { SQLhost host; @@ -760,7 +757,7 @@ class ModuleMsSQL : public Module SQLConn* newconn; - newconn = new SQLConn(ServerInstance, this, hi); + newconn = new SQLConn(this, hi); connections.insert(std::make_pair(hi.id, newconn)); } diff --git a/src/modules/extra/m_mysql.cpp b/src/modules/extra/m_mysql.cpp index 3718eecf8..023ead94b 100644 --- a/src/modules/extra/m_mysql.cpp +++ b/src/modules/extra/m_mysql.cpp @@ -89,7 +89,6 @@ class ModuleSQL : public Module public: ConfigReader *Conf; - InspIRCd* PublicServerInstance; int currid; bool rehashing; DispatcherThread* Dispatcher; @@ -97,7 +96,7 @@ class ModuleSQL : public Module Mutex LoggingMutex; Mutex ConnMutex; - ModuleSQL(InspIRCd* Me); + ModuleSQL(); ~ModuleSQL(); unsigned long NewID(); const char* OnRequest(Request* request); @@ -593,7 +592,7 @@ void ClearAllConnections() } } -void ConnectDatabases(InspIRCd* ServerInstance, ModuleSQL* Parent) +void ConnectDatabases(ModuleSQL* Parent) { for (ConnMap::iterator i = Connections.begin(); i != Connections.end(); i++) { @@ -612,7 +611,7 @@ void ConnectDatabases(InspIRCd* ServerInstance, ModuleSQL* Parent) } } -void LoadDatabases(ConfigReader* conf, InspIRCd* ServerInstance, ModuleSQL* Parent) +void LoadDatabases(ConfigReader* conf, ModuleSQL* Parent) { Parent->ConnMutex.Lock(); ClearOldConnections(conf); @@ -639,7 +638,7 @@ void LoadDatabases(ConfigReader* conf, InspIRCd* ServerInstance, ModuleSQL* Pare ThisSQL->setInitialQuery(initquery); } } - ConnectDatabases(ServerInstance, Parent); + ConnectDatabases(Parent); Parent->ConnMutex.Unlock(); } @@ -673,23 +672,22 @@ class DispatcherThread : public SocketThread { private: ModuleSQL* Parent; - InspIRCd* ServerInstance; public: - DispatcherThread(InspIRCd* Instance, ModuleSQL* CreatorModule) : SocketThread(Instance), Parent(CreatorModule), ServerInstance(Instance) { } + DispatcherThread(ModuleSQL* CreatorModule) : SocketThread(Instance), Parent(CreatorModule),{ } ~DispatcherThread() { } virtual void Run(); virtual void OnNotify(); }; -ModuleSQL::ModuleSQL(InspIRCd* Me) : Module(Me), rehashing(false) +ModuleSQL::ModuleSQL() : rehashing(false) { ServerInstance->Modules->UseInterface("SQLutils"); - Conf = new ConfigReader(ServerInstance); + Conf = new ConfigReader; PublicServerInstance = ServerInstance; currid = 0; - Dispatcher = new DispatcherThread(ServerInstance, this); + Dispatcher = new DispatcherThread(this); ServerInstance->Threads->Start(Dispatcher); if (!ServerInstance->Modules->PublishFeature("SQL", this)) diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index c61e0983c..c0d301107 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -93,7 +93,7 @@ class ReconnectTimer : public Timer private: Module* mod; public: - ReconnectTimer(InspIRCd* SI, Module* m) + ReconnectTimer(Module* m) : Timer(5, SI->Time(), false), mod(m) { } @@ -301,7 +301,6 @@ public: class SQLConn : public EventHandler { private: - InspIRCd* ServerInstance; SQLhost confhost; /* The <database> entry */ Module* us; /* Pointer to the SQL provider itself */ PGconn* sql; /* PgSQL database connection handle */ @@ -311,8 +310,8 @@ class SQLConn : public EventHandler time_t idle; /* Time we last heard from the database */ public: - SQLConn(InspIRCd* SI, Module* self, const SQLhost& hi) - : EventHandler(), ServerInstance(SI), confhost(hi), us(self), sql(NULL), status(CWRITE), qinprog(false) + SQLConn(Module* self, const SQLhost& hi) + : EventHandler(), confhost(hi), us(self), sql(NULL), status(CWRITE), qinprog(false) { idle = this->ServerInstance->Time(); if(!DoConnect()) @@ -763,8 +762,8 @@ class ModulePgSQL : public Module ReconnectTimer* retimer; public: - ModulePgSQL(InspIRCd* Me) - : Module(Me), currid(0) + ModulePgSQL() + : currid(0) { ServerInstance->Modules->UseInterface("SQLutils"); @@ -813,7 +812,7 @@ class ModulePgSQL : public Module bool HostInConf(const SQLhost &h) { - ConfigReader conf(ServerInstance); + ConfigReader conf; for(int i = 0; i < conf.Enumerate("database"); i++) { SQLhost host; @@ -834,7 +833,7 @@ class ModulePgSQL : public Module { ClearOldConnections(); - ConfigReader conf(ServerInstance); + ConfigReader conf; for(int i = 0; i < conf.Enumerate("database"); i++) { SQLhost host; @@ -889,7 +888,7 @@ class ModulePgSQL : public Module SQLConn* newconn; - newconn = new SQLConn(ServerInstance, this, hi); + newconn = new SQLConn(this, hi); connections.insert(std::make_pair(hi.id, newconn)); } @@ -905,7 +904,7 @@ class ModulePgSQL : public Module break; } } - retimer = new ReconnectTimer(ServerInstance, this); + retimer = new ReconnectTimer(this); ServerInstance->Timers->AddTimer(retimer); } diff --git a/src/modules/extra/m_regex_pcre.cpp b/src/modules/extra/m_regex_pcre.cpp index 5254f04a6..4389ad685 100644 --- a/src/modules/extra/m_regex_pcre.cpp +++ b/src/modules/extra/m_regex_pcre.cpp @@ -39,14 +39,14 @@ private: pcre* regex; public: - PCRERegex(const std::string& rx, InspIRCd* Me) : Regex(rx, Me) + PCRERegex(const std::string& rx, ) : Regex(rx, Me) { const char* error; int erroffset; regex = pcre_compile(rx.c_str(), 0, &error, &erroffset, NULL); if (!regex) { - Me->Logs->Log("REGEX", DEBUG, "pcre_compile failed: /%s/ [%d] %s", rx.c_str(), erroffset, error); + ServerInstance->Logs->Log("REGEX", DEBUG, "pcre_compile failed: /%s/ [%d] %s", rx.c_str(), erroffset, error); throw PCREException(rx, error, erroffset); } } @@ -70,11 +70,10 @@ public: class ModuleRegexPCRE : public Module { public: - ModuleRegexPCRE(InspIRCd* Me) : Module(Me) - { - Me->Modules->PublishInterface("RegularExpression", this); + ModuleRegexPCRE() { + ServerInstance->Modules->PublishInterface("RegularExpression", this); Implementation eventlist[] = { I_OnRequest }; - Me->Modules->Attach(eventlist, this, 1); + ServerInstance->Modules->Attach(eventlist, this, 1); } virtual Version GetVersion() diff --git a/src/modules/extra/m_regex_posix.cpp b/src/modules/extra/m_regex_posix.cpp index 34a7e9bab..5fe4db29f 100644 --- a/src/modules/extra/m_regex_posix.cpp +++ b/src/modules/extra/m_regex_posix.cpp @@ -34,7 +34,7 @@ private: regex_t regbuf; public: - POSIXRegex(const std::string& rx, InspIRCd* Me, bool extended) : Regex(rx, Me) + POSIXRegex(const std::string& rx, bool extended) : Regex(rx, Me) { int flags = (extended ? REG_EXTENDED : 0) | REG_NOSUB; int errcode; @@ -76,11 +76,10 @@ class ModuleRegexPOSIX : public Module private: bool extended; public: - ModuleRegexPOSIX(InspIRCd* Me) : Module(Me) - { - Me->Modules->PublishInterface("RegularExpression", this); + ModuleRegexPOSIX() { + ServerInstance->Modules->PublishInterface("RegularExpression", this); Implementation eventlist[] = { I_OnRequest, I_OnRehash }; - Me->Modules->Attach(eventlist, this, 2); + ServerInstance->Modules->Attach(eventlist, this, 2); OnRehash(NULL); } @@ -96,7 +95,7 @@ public: virtual void OnRehash(User* u) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; extended = Conf.ReadFlag("posix", "extended", 0); } diff --git a/src/modules/extra/m_regex_tre.cpp b/src/modules/extra/m_regex_tre.cpp index c50429a5e..1ed35605b 100644 --- a/src/modules/extra/m_regex_tre.cpp +++ b/src/modules/extra/m_regex_tre.cpp @@ -36,7 +36,7 @@ private: regex_t regbuf; public: - TRERegex(const std::string& rx, InspIRCd* Me) : Regex(rx, Me) + TRERegex(const std::string& rx, ) : Regex(rx, Me) { int flags = REG_EXTENDED | REG_NOSUB; int errcode; @@ -76,11 +76,10 @@ public: class ModuleRegexTRE : public Module { public: - ModuleRegexTRE(InspIRCd* Me) : Module(Me) - { - Me->Modules->PublishInterface("RegularExpression", this); + ModuleRegexTRE() { + ServerInstance->Modules->PublishInterface("RegularExpression", this); Implementation eventlist[] = { I_OnRequest }; - Me->Modules->Attach(eventlist, this, 1); + ServerInstance->Modules->Attach(eventlist, this, 1); } virtual Version GetVersion() diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp index 1f2df8a1a..d7c0675bb 100644 --- a/src/modules/extra/m_sqlauth.cpp +++ b/src/modules/extra/m_sqlauth.cpp @@ -32,9 +32,8 @@ class ModuleSQLAuth : public Module bool verbose; public: - ModuleSQLAuth(InspIRCd* Me) - : Module(Me) - { + ModuleSQLAuth() + { ServerInstance->Modules->UseInterface("SQLutils"); ServerInstance->Modules->UseInterface("SQL"); @@ -60,7 +59,7 @@ public: virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; databaseid = Conf.ReadValue("sqlauth", "dbid", 0); /* Database ID, given to the SQL service provider */ freeformquery = Conf.ReadValue("sqlauth", "query", 0); /* Field name where username can be found */ diff --git a/src/modules/extra/m_sqlite3.cpp b/src/modules/extra/m_sqlite3.cpp index 86b2cb378..063113102 100644 --- a/src/modules/extra/m_sqlite3.cpp +++ b/src/modules/extra/m_sqlite3.cpp @@ -51,7 +51,7 @@ class ResultNotifier : public BufferedSocket ModuleSQLite3* mod; public: - ResultNotifier(ModuleSQLite3* m, InspIRCd* SI, int newfd, char* ip) : BufferedSocket(SI, newfd, ip), mod(m) + ResultNotifier(ModuleSQLite3* m, int newfd, char* ip) : BufferedSocket(SI, newfd, ip), mod(m) { } @@ -77,7 +77,7 @@ class SQLiteListener : public ListenSocketBase FileReader* index; public: - SQLiteListener(ModuleSQLite3* P, InspIRCd* Instance, int port, const std::string &addr) : ListenSocketBase(Instance, port, addr), Parent(P) + SQLiteListener(ModuleSQLite3* P, int port, const std::string &addr) : ListenSocketBase(port, addr), Parent(P) { uslen = sizeof(sock_us); if (getsockname(this->fd,(sockaddr*)&sock_us,&uslen)) @@ -274,14 +274,13 @@ class SQLConn : public classbase { private: ResultQueue results; - InspIRCd* ServerInstance; Module* mod; SQLhost host; sqlite3* conn; public: - SQLConn(InspIRCd* SI, Module* m, const SQLhost& hi) - : ServerInstance(SI), mod(m), host(hi) + SQLConn(Module* m, const SQLhost& hi) + : mod(m), host(hi) { if (OpenDB() != SQLITE_OK) { @@ -543,8 +542,8 @@ class ModuleSQLite3 : public Module unsigned long currid; public: - ModuleSQLite3(InspIRCd* Me) - : Module(Me), currid(0) + ModuleSQLite3() + : currid(0) { ServerInstance->Modules->UseInterface("SQLutils"); @@ -632,7 +631,7 @@ class ModuleSQLite3 : public Module bool HostInConf(const SQLhost &h) { - ConfigReader conf(ServerInstance); + ConfigReader conf; for(int i = 0; i < conf.Enumerate("database"); i++) { SQLhost host; @@ -652,7 +651,7 @@ class ModuleSQLite3 : public Module { ClearOldConnections(); - ConfigReader conf(ServerInstance); + ConfigReader conf; for(int i = 0; i < conf.Enumerate("database"); i++) { SQLhost host; @@ -681,7 +680,7 @@ class ModuleSQLite3 : public Module SQLConn* newconn; - newconn = new SQLConn(ServerInstance, this, hi); + newconn = new SQLConn(this, hi); connections.insert(std::make_pair(hi.id, newconn)); } diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index 556cc8b31..4713f24a9 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -28,8 +28,6 @@ std::map<unsigned long,QueryInfo*> active_queries; class QueryInfo { -private: - InspIRCd* ServerInstance; public: QueryState qs; unsigned long id; @@ -43,7 +41,7 @@ public: time_t date; bool insert; - QueryInfo(InspIRCd* Instance, const std::string &n, const std::string &s, const std::string &h, unsigned long i, int cat) + QueryInfo(const std::string &n, const std::string &s, const std::string &h, unsigned long i, int cat) { ServerInstance = Instance; qs = FIND_SOURCE; @@ -183,9 +181,8 @@ class ModuleSQLLog : public Module { public: - ModuleSQLLog(InspIRCd* Me) - : Module(Me) - { + ModuleSQLLog() + { ServerInstance->Modules->UseInterface("SQLutils"); ServerInstance->Modules->UseInterface("SQL"); @@ -213,7 +210,7 @@ class ModuleSQLLog : public Module void ReadConfig() { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; dbid = Conf.ReadValue("sqllog","dbid",0); // database id of a database configured in sql module } @@ -253,7 +250,7 @@ class ModuleSQLLog : public Module SQLrequest req = SQLrequest(this, SQLModule, dbid, SQLquery("SELECT id,actor FROM ircd_log_actors WHERE actor='?'") % source); if(req.Send()) { - QueryInfo* i = new QueryInfo(ServerInstance, nick, source, host, req.id, category); + QueryInfo* i = new QueryInfo(nick, source, host, req.id, category); i->qs = FIND_SOURCE; active_queries[req.id] = i; } diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index 3b0e6e226..47aa8d1fd 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -32,9 +32,8 @@ class ModuleSQLOper : public Module parameterlist names; public: - ModuleSQLOper(InspIRCd* Me) - : Module(Me) - { + ModuleSQLOper() + { ServerInstance->Modules->UseInterface("SQLutils"); ServerInstance->Modules->UseInterface("SQL"); ServerInstance->Modules->UseInterface("HashRequest"); @@ -114,7 +113,7 @@ public: virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; databaseid = Conf.ReadValue("sqloper", "dbid", 0); /* Database ID of a database configured for the service provider module */ hashtype = assign(Conf.ReadValue("sqloper", "hash", 0)); @@ -298,7 +297,7 @@ public: bool OperUser(User* user, const std::string &pattern, const std::string &type) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; for (int j = 0; j < Conf.Enumerate("type"); j++) { diff --git a/src/modules/extra/m_sqlutils.cpp b/src/modules/extra/m_sqlutils.cpp index c257d4098..6d40ee22c 100644 --- a/src/modules/extra/m_sqlutils.cpp +++ b/src/modules/extra/m_sqlutils.cpp @@ -30,9 +30,8 @@ private: IdChanMap idchan; public: - ModuleSQLutils(InspIRCd* Me) - : Module(Me) - { + ModuleSQLutils() + { ServerInstance->Modules->PublishInterface("SQLutils", this); Implementation eventlist[] = { I_OnChannelDelete, I_OnUnloadModule, I_OnRequest, I_OnUserDisconnect }; ServerInstance->Modules->Attach(eventlist, this, 4); diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 3362e9378..1fe84649f 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -143,8 +143,8 @@ class ModuleSSLGnuTLS : public Module GenericCap capHandler; public: - ModuleSSLGnuTLS(InspIRCd* Me) - : Module(Me), starttls(this), capHandler(this, "tls") + ModuleSSLGnuTLS() + : starttls(this), capHandler(this, "tls") { ServerInstance->Modules->PublishInterface("BufferedSocketHook", this); @@ -169,7 +169,7 @@ class ModuleSSLGnuTLS : public Module void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; listenports.clear(); sslports.clear(); @@ -200,7 +200,7 @@ class ModuleSSLGnuTLS : public Module OnRehash(user); - ConfigReader Conf(ServerInstance); + ConfigReader Conf; std::string confdir(ServerInstance->ConfigFileName); // +1 so we the path ends with a / diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 645add4c2..f566b326b 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -100,7 +100,7 @@ class ModuleSSLOpenSSL : public Module public: - ModuleSSLOpenSSL(InspIRCd* Me) + ModuleSSLOpenSSL() { ServerInstance->Modules->PublishInterface("BufferedSocketHook", this); @@ -144,7 +144,7 @@ class ModuleSSLOpenSSL : public Module void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; listenports.clear(); sslports.clear(); @@ -175,7 +175,7 @@ class ModuleSSLOpenSSL : public Module OnRehash(user); - ConfigReader Conf(ServerInstance); + ConfigReader Conf; std::string confdir(ServerInstance->ConfigFileName); // +1 so we the path ends with a / diff --git a/src/modules/extra/m_testclient.cpp b/src/modules/extra/m_testclient.cpp index 21603c3c8..3e41f533f 100644 --- a/src/modules/extra/m_testclient.cpp +++ b/src/modules/extra/m_testclient.cpp @@ -20,9 +20,8 @@ private: public: - ModuleTestClient(InspIRCd* Me) - : Module(Me) - { + ModuleTestClient() + { Implementation eventlist[] = { I_OnRequest, I_OnBackgroundTimer }; ServerInstance->Modules->Attach(eventlist, this, 2); } diff --git a/src/modules/extra/m_ziplink.cpp b/src/modules/extra/m_ziplink.cpp index 557ad1cfa..976a27b5c 100644 --- a/src/modules/extra/m_ziplink.cpp +++ b/src/modules/extra/m_ziplink.cpp @@ -56,9 +56,8 @@ class ModuleZLib : public Module unsigned int net_buffer_size; public: - ModuleZLib(InspIRCd* Me) - : Module(Me) - { + ModuleZLib() + { ServerInstance->Modules->PublishInterface("BufferedSocketHook", this); sessions = new izip_session[ServerInstance->SE->GetMaxFds()]; diff --git a/src/modules/m_abbreviation.cpp b/src/modules/m_abbreviation.cpp index 8ff325730..c8aadfcae 100644 --- a/src/modules/m_abbreviation.cpp +++ b/src/modules/m_abbreviation.cpp @@ -20,12 +20,11 @@ class ModuleAbbreviation : public Module public: - ModuleAbbreviation(InspIRCd* Me) - : Module(Me) - { - Me->Modules->Attach(I_OnPreCommand, this); + ModuleAbbreviation() + { + ServerInstance->Modules->Attach(I_OnPreCommand, this); /* Must do this first */ - Me->Modules->SetPriority(this, I_OnPreCommand, PRIORITY_FIRST); + ServerInstance->Modules->SetPriority(this, I_OnPreCommand, PRIORITY_FIRST); } virtual Version GetVersion() diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 57c6834af..3f3c3b1ba 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -65,7 +65,7 @@ class ModuleAlias : public Module virtual void ReadAliases() { - ConfigReader MyConf(ServerInstance); + ConfigReader MyConf; AllowBots = MyConf.ReadFlag("fantasy", "allowbots", "no", 0); @@ -93,13 +93,12 @@ class ModuleAlias : public Module public: - ModuleAlias(InspIRCd* Me) - : Module(Me) - { + ModuleAlias() + { ReadAliases(); - Me->Modules->Attach(I_OnPreCommand, this); - Me->Modules->Attach(I_OnRehash, this); - Me->Modules->Attach(I_OnUserMessage, this); + ServerInstance->Modules->Attach(I_OnPreCommand, this); + ServerInstance->Modules->Attach(I_OnRehash, this); + ServerInstance->Modules->Attach(I_OnUserMessage, this); } diff --git a/src/modules/m_allowinvite.cpp b/src/modules/m_allowinvite.cpp index ae4e0b92e..0de992501 100644 --- a/src/modules/m_allowinvite.cpp +++ b/src/modules/m_allowinvite.cpp @@ -18,7 +18,7 @@ class AllowInvite : public SimpleChannelModeHandler { public: - AllowInvite(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'A') { } + AllowInvite(Module* Creator) : SimpleChannelModeHandler(Creator, 'A') { } }; class ModuleAllowInvite : public Module @@ -26,7 +26,7 @@ class ModuleAllowInvite : public Module AllowInvite ni; public: - ModuleAllowInvite(InspIRCd* Me) : Module(Me), ni(Me, this) + ModuleAllowInvite() : ni(this) { if (!ServerInstance->Modes->AddMode(&ni)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_alltime.cpp b/src/modules/m_alltime.cpp index 5a05e3339..37f6a5fd2 100644 --- a/src/modules/m_alltime.cpp +++ b/src/modules/m_alltime.cpp @@ -49,8 +49,8 @@ class Modulealltime : public Module { CommandAlltime mycommand; public: - Modulealltime(InspIRCd *Me) - : Module(Me), mycommand(this) + Modulealltime() + : mycommand(this) { ServerInstance->AddCommand(&mycommand); } diff --git a/src/modules/m_antibear.cpp b/src/modules/m_antibear.cpp index e429f5c56..a89e9dd4d 100644 --- a/src/modules/m_antibear.cpp +++ b/src/modules/m_antibear.cpp @@ -20,7 +20,7 @@ class ModuleAntiBear : public Module { LocalIntExt bearExt; public: - ModuleAntiBear(InspIRCd* Me) : Module(Me), bearExt("antibear_timewait", this) + ModuleAntiBear() : bearExt("antibear_timewait", this) { Extensible::Register(&bearExt); Implementation eventlist[] = { I_OnUserRegister, I_OnPreCommand }; @@ -42,7 +42,7 @@ class ModuleAntiBear : public Module { if (!strncmp(parameters[1].c_str(), "\1TIME Mon May 01 18:54:20 2006", 30)) { - ZLine* zl = new ZLine(ServerInstance, ServerInstance->Time(), 86400, ServerInstance->Config->ServerName, + ZLine* zl = new ZLine(ServerInstance->Time(), 86400, ServerInstance->Config->ServerName, "Unless you're stuck in a time warp, you appear to be a bear bot!", user->GetIPString()); if (ServerInstance->XLines->AddLine(zl,NULL)) { diff --git a/src/modules/m_antibottler.cpp b/src/modules/m_antibottler.cpp index c5a56619e..8d4931e3b 100644 --- a/src/modules/m_antibottler.cpp +++ b/src/modules/m_antibottler.cpp @@ -18,9 +18,8 @@ class ModuleAntiBottler : public Module { public: - ModuleAntiBottler(InspIRCd* Me) - : Module(Me) - { + ModuleAntiBottler() + { Implementation eventlist[] = { I_OnPreCommand }; ServerInstance->Modules->Attach(eventlist, this, 1); diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp index aa1aa633a..0d149ccf2 100644 --- a/src/modules/m_auditorium.cpp +++ b/src/modules/m_auditorium.cpp @@ -18,7 +18,7 @@ class AuditoriumMode : public ModeHandler { public: - AuditoriumMode(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'u', PARAM_NONE, MODETYPE_CHANNEL) + AuditoriumMode(Module* Creator) : ModeHandler(Creator, 'u', PARAM_NONE, MODETYPE_CHANNEL) { levelrequired = OP_VALUE; } @@ -44,8 +44,8 @@ class ModuleAuditorium : public Module bool ShowOps; bool OperOverride; public: - ModuleAuditorium(InspIRCd* Me) - : Module(Me), aum(Me, this) + ModuleAuditorium() + : aum(this) { if (!ServerInstance->Modes->AddMode(&aum)) throw ModuleException("Could not add new modes!"); @@ -53,7 +53,7 @@ class ModuleAuditorium : public Module OnRehash(NULL); Implementation eventlist[] = { I_OnUserJoin, I_OnUserPart, I_OnUserKick, I_OnUserQuit, I_OnNamesListItem, I_OnRehash, I_OnHostCycle }; - Me->Modules->Attach(eventlist, this, 7); + ServerInstance->Modules->Attach(eventlist, this, 7); } @@ -64,7 +64,7 @@ class ModuleAuditorium : public Module void OnRehash(User* user) { - ConfigReader conf(ServerInstance); + ConfigReader conf; ShowOps = conf.ReadFlag("auditorium", "showops", 0); OperOverride = conf.ReadFlag("auditorium", "operoverride", 0); } diff --git a/src/modules/m_banexception.cpp b/src/modules/m_banexception.cpp index 0cd915ef9..35b30f0d4 100644 --- a/src/modules/m_banexception.cpp +++ b/src/modules/m_banexception.cpp @@ -31,7 +31,7 @@ class BanException : public ListModeBase { public: - BanException(InspIRCd* Instance, Module* Creator) : ListModeBase(Instance, Creator, 'e', "End of Channel Exception List", 348, 349, true) { } + BanException(Module* Creator) : ListModeBase(Creator, 'e', "End of Channel Exception List", 348, 349, true) { } }; @@ -40,7 +40,7 @@ class ModuleBanException : public Module BanException be; public: - ModuleBanException(InspIRCd* Me) : Module(Me), be(Me, this) + ModuleBanException() : be(this) { if (!ServerInstance->Modes->AddMode(&be)) throw ModuleException("Could not add new modes!"); @@ -48,7 +48,7 @@ public: be.DoImplements(this); Implementation list[] = { I_OnRehash, I_OnRequest, I_On005Numeric, I_OnExtBanCheck, I_OnCheckChannelBan }; - Me->Modules->Attach(list, this, 5); + ServerInstance->Modules->Attach(list, this, 5); } diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index dae5a775e..11ce93c9a 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -39,7 +39,7 @@ class BanRedirect : public ModeWatcher { public: SimpleExtItem<BanRedirectList> extItem; - BanRedirect(InspIRCd* Instance, Module* parent) : ModeWatcher(Instance, 'b', MODETYPE_CHANNEL), + BanRedirect(Module* parent) : ModeWatcher('b', MODETYPE_CHANNEL), extItem("banredirect", parent) { } @@ -202,8 +202,8 @@ class ModuleBanRedirect : public Module Module* ExceptionModule; public: - ModuleBanRedirect(InspIRCd* Me) - : Module(Me), re(Me, this) + ModuleBanRedirect() + : re(this) { nofollow = false; @@ -214,7 +214,7 @@ class ModuleBanRedirect : public Module Extensible::Register(&re.extItem); Implementation list[] = { I_OnRehash, I_OnUserPreJoin, I_OnChannelDelete, I_OnCleanup }; - Me->Modules->Attach(list, this, 4); + ServerInstance->Modules->Attach(list, this, 4); } virtual void OnChannelDelete(Channel* chan) @@ -231,7 +231,7 @@ class ModuleBanRedirect : public Module if(redirects) { - irc::modestacker modestack(ServerInstance, false); + irc::modestacker modestack(false); StringDeque stackresult; std::vector<std::string> mode_junk; mode_junk.push_back(chan->name); @@ -315,7 +315,7 @@ class ModuleBanRedirect : public Module user->WriteNumeric(474, "%s %s :Cannot join channel (You are banned)", user->nick.c_str(), chan->name.c_str()); user->WriteNumeric(470, "%s %s %s :You are banned from this channel, so you are automatically transfered to the redirected channel.", user->nick.c_str(), chan->name.c_str(), redir->targetchan.c_str()); nofollow = true; - Channel::JoinUser(ServerInstance, user, redir->targetchan.c_str(), false, "", false, ServerInstance->Time()); + Channel::JoinUser(user, redir->targetchan.c_str(), false, "", false, ServerInstance->Time()); nofollow = false; return MOD_RES_ALLOW; } diff --git a/src/modules/m_blockamsg.cpp b/src/modules/m_blockamsg.cpp index c9d20e3ef..7c4d63419 100644 --- a/src/modules/m_blockamsg.cpp +++ b/src/modules/m_blockamsg.cpp @@ -45,7 +45,7 @@ class ModuleBlockAmsg : public Module SimpleExtItem<BlockedMessage> blockamsg; public: - ModuleBlockAmsg(InspIRCd* Me) : Module(Me), blockamsg("blockamsg", this) + ModuleBlockAmsg() : blockamsg("blockamsg", this) { this->OnRehash(NULL); Extensible::Register(&blockamsg); @@ -65,7 +65,7 @@ class ModuleBlockAmsg : public Module virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; ForgetDelay = Conf.ReadInteger("blockamsg", "delay", 0, false); diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index 88c09d91c..9e81050f3 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -21,7 +21,7 @@ class BlockCaps : public SimpleChannelModeHandler { public: - BlockCaps(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'B') { } + BlockCaps(Module* Creator) : SimpleChannelModeHandler(Creator, 'B') { } }; class ModuleBlockCAPS : public Module @@ -32,7 +32,7 @@ class ModuleBlockCAPS : public Module char capsmap[256]; public: - ModuleBlockCAPS(InspIRCd* Me) : Module(Me), bc(Me, this) + ModuleBlockCAPS() : bc(this) { OnRehash(NULL); if (!ServerInstance->Modes->AddMode(&bc)) @@ -60,7 +60,7 @@ public: Channel* c = (Channel*)dest; - if (CHANOPS_EXEMPT(ServerInstance, 'B') && c->GetPrefixValue(user) == OP_VALUE) + if (CHANOPS_EXEMPT('B') && c->GetPrefixValue(user) == OP_VALUE) { return MOD_RES_PASSTHRU; } @@ -101,7 +101,7 @@ public: void ReadConf() { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; percent = Conf.ReadInteger("blockcaps", "percent", "100", 0, true); minlen = Conf.ReadInteger("blockcaps", "minlen", "1", 0, true); std::string hmap = Conf.ReadValue("blockcaps", "capsmap", 0); diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index d0423dfe9..1c7cd8c52 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -20,7 +20,7 @@ class BlockColor : public SimpleChannelModeHandler { public: - BlockColor(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'c') { } + BlockColor(Module* Creator) : SimpleChannelModeHandler(Creator, 'c') { } }; class ModuleBlockColour : public Module @@ -29,7 +29,7 @@ class ModuleBlockColour : public Module BlockColor bc; public: - ModuleBlockColour(InspIRCd* Me) : Module(Me), bc(Me, this) + ModuleBlockColour() : bc(this) { if (!ServerInstance->Modes->AddMode(&bc)) throw ModuleException("Could not add new modes!"); @@ -48,7 +48,7 @@ class ModuleBlockColour : public Module { Channel* c = (Channel*)dest; - if (CHANOPS_EXEMPT(ServerInstance, 'c') && c->GetPrefixValue(user) == OP_VALUE) + if (CHANOPS_EXEMPT('c') && c->GetPrefixValue(user) == OP_VALUE) { return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp index f2a72781e..4c8007b8b 100644 --- a/src/modules/m_botmode.cpp +++ b/src/modules/m_botmode.cpp @@ -20,15 +20,15 @@ class BotMode : public SimpleUserModeHandler { public: - BotMode(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Creator, 'B') { } + BotMode(Module* Creator) : SimpleUserModeHandler(Creator, 'B') { } }; class ModuleBotMode : public Module { BotMode bm; public: - ModuleBotMode(InspIRCd* Me) - : Module(Me), bm(Me, this) + ModuleBotMode() + : bm(this) { if (!ServerInstance->Modes->AddMode(&bm)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index a6bdb8511..45d3f0e5c 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -128,7 +128,7 @@ struct CallerIDExtInfo : public ExtensionItem class User_g : public SimpleUserModeHandler { public: - User_g(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Creator, 'g') { } + User_g(Module* Creator) : SimpleUserModeHandler(Creator, 'g') { } }; class CommandAccept : public Command @@ -342,7 +342,7 @@ private: } public: - ModuleCallerID(InspIRCd* Me) : Module(Me), cmd(this), myumode(Me, this) + ModuleCallerID() : cmd(this), myumode(this) { OnRehash(NULL); @@ -429,7 +429,7 @@ public: virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; cmd.maxaccepts = Conf.ReadInteger("callerid", "maxaccepts", "16", 0, true); operoverride = Conf.ReadFlag("callerid", "operoverride", "0", 0); tracknick = Conf.ReadFlag("callerid", "tracknick", "0", 0); diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index 355c6d0fb..dbd81ed53 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -69,7 +69,7 @@ class CommandCAP : public Command reghold.set(user, 1); Event event((char*) &Data, this->creator, "cap_req"); - event.Send(ServerInstance); + event.Send(); if (Data.ack.size() > 0) { @@ -97,7 +97,7 @@ class CommandCAP : public Command reghold.set(user, 1); Event event((char*) &Data, this->creator, subcommand == "LS" ? "cap_ls" : "cap_list"); - event.Send(ServerInstance); + event.Send(); std::string Result; if (Data.wanted.size() > 0) @@ -117,7 +117,7 @@ class CommandCAP : public Command reghold.set(user, 1); Event event((char*) &Data, this->creator, "cap_clear"); - event.Send(ServerInstance); + event.Send(); std::string Result = irc::stringjoiner(" ", Data.ack, 0, Data.ack.size() - 1).GetJoined(); user->WriteServ("CAP * ACK :%s", Result.c_str()); @@ -135,8 +135,8 @@ class ModuleCAP : public Module { CommandCAP cmd; public: - ModuleCAP(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleCAP() + : cmd(this) { ServerInstance->AddCommand(&cmd); Extensible::Register(&cmd.reghold); diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index 2abedd975..bfb30f5e8 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -23,8 +23,8 @@ class CBan : public XLine public: irc::string matchtext; - CBan(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, std::string ch) - : XLine(Instance, s_time, d, src, re, "CBAN") + CBan(time_t s_time, long d, std::string src, std::string re, std::string ch) + : XLine(s_time, d, src, re, "CBAN") { this->matchtext = ch.c_str(); } @@ -63,13 +63,13 @@ public: class CBanFactory : public XLineFactory { public: - CBanFactory(InspIRCd* Instance) : XLineFactory(Instance, "CBAN") { } + CBanFactory() : XLineFactory("CBAN") { } /** Generate a shun */ XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) { - return new CBan(ServerInstance, set_time, duration, source, reason, xline_specific_mask); + return new CBan(set_time, duration, source, reason, xline_specific_mask); } bool AutoApplyToUserList(XLine *x) @@ -116,7 +116,7 @@ class CommandCBan : public Command try { - r = new CBan(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), reason, parameters[0].c_str()); + r = new CBan(ServerInstance->Time(), duration, user->nick.c_str(), reason, parameters[0].c_str()); } catch (...) { @@ -162,7 +162,7 @@ class ModuleCBan : public Module CBanFactory f; public: - ModuleCBan(InspIRCd* Me) : Module(Me), mycommand(this), f(Me) + ModuleCBan() : mycommand(this) { ServerInstance->XLines->RegisterFactory(&f); diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index af3baa292..29410962b 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -26,7 +26,7 @@ typedef std::map<irc::string,irc::string> censor_t; class CensorUser : public SimpleUserModeHandler { public: - CensorUser(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Creator, 'G') { } + CensorUser(Module* Creator) : SimpleUserModeHandler(Creator, 'G') { } }; /** Handles channel mode +G @@ -34,7 +34,7 @@ class CensorUser : public SimpleUserModeHandler class CensorChannel : public SimpleChannelModeHandler { public: - CensorChannel(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'G') { } + CensorChannel(Module* Creator) : SimpleChannelModeHandler(Creator, 'G') { } }; class ModuleCensor : public Module @@ -44,8 +44,8 @@ class ModuleCensor : public Module CensorChannel cc; public: - ModuleCensor(InspIRCd* Me) - : Module(Me), cu(Me, this), cc(Me, this) + ModuleCensor() + : cu(this), cc(this) { /* Read the configuration file on startup. */ @@ -77,7 +77,7 @@ class ModuleCensor : public Module { active = ((Channel*)dest)->IsModeSet('G'); Channel* c = (Channel*)dest; - if (CHANOPS_EXEMPT(ServerInstance, 'G') && c->GetPrefixValue(user) == OP_VALUE) + if (CHANOPS_EXEMPT('G') && c->GetPrefixValue(user) == OP_VALUE) { return MOD_RES_PASSTHRU; } @@ -115,7 +115,7 @@ 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* MyConf = new ConfigReader(ServerInstance); + ConfigReader* MyConf = new ConfigReader; censors.clear(); for (int index = 0; index < MyConf->Enumerate("badword"); index++) diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index 6cdad0958..1300092c7 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -106,8 +106,8 @@ class CGIResolver : public Resolver User* them; bool notify; public: - CGIResolver(Module* me, InspIRCd* Instance, bool NotifyOpers, const std::string &source, bool forward, User* u, int userfd, const std::string &type, bool &cached) - : Resolver(Instance, source, forward ? DNS_QUERY_A : DNS_QUERY_PTR4, cached, me), typ(type), theirfd(userfd), them(u), notify(NotifyOpers) { } + CGIResolver(Module* me, bool NotifyOpers, const std::string &source, bool forward, User* u, int userfd, const std::string &type, bool &cached) + : Resolver(source, forward ? DNS_QUERY_A : DNS_QUERY_PTR4, cached, me), typ(type), theirfd(userfd), them(u), notify(NotifyOpers) { } virtual void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached) { @@ -146,7 +146,7 @@ class ModuleCgiIRC : public Module CommandWebirc cmd; bool NotifyOpers; public: - ModuleCgiIRC(InspIRCd* Me) : Module(Me), cmd(this, NotifyOpers) + ModuleCgiIRC() : cmd(this, NotifyOpers) { OnRehash(NULL); ServerInstance->AddCommand(&cmd); @@ -167,7 +167,7 @@ public: virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; cmd.Hosts.clear(); NotifyOpers = Conf.ReadFlag("cgiirc", "opernotice", 0); // If we send an oper notice when a CGI:IRC has their host changed. @@ -307,7 +307,7 @@ public: { bool cached; - CGIResolver* r = new CGIResolver(this, ServerInstance, NotifyOpers, user->password, false, user, user->GetFd(), "PASS", cached); + CGIResolver* r = new CGIResolver(this, NotifyOpers, user->password, false, user, user->GetFd(), "PASS", cached); ServerInstance->AddResolver(r, cached); } catch (...) @@ -358,7 +358,7 @@ public: { bool cached; - CGIResolver* r = new CGIResolver(this, ServerInstance, NotifyOpers, newipstr, false, user, user->GetFd(), "IDENT", cached); + CGIResolver* r = new CGIResolver(this, NotifyOpers, newipstr, false, user, user->GetFd(), "IDENT", cached); ServerInstance->AddResolver(r, cached); } catch (...) diff --git a/src/modules/m_chancreate.cpp b/src/modules/m_chancreate.cpp index c31cbe9cf..666353049 100644 --- a/src/modules/m_chancreate.cpp +++ b/src/modules/m_chancreate.cpp @@ -19,9 +19,8 @@ class ModuleChanCreate : public Module { private: public: - ModuleChanCreate(InspIRCd* Me) - : Module(Me) - { + ModuleChanCreate() + { ServerInstance->SNO->EnableSnomask('j', "CHANCREATE"); ServerInstance->SNO->EnableSnomask('J', "REMOTECHANCREATE"); Implementation eventlist[] = { I_OnUserJoin }; diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index 7c28036b7..cd7300372 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -25,7 +25,7 @@ class ChanFilter : public ListModeBase { public: - ChanFilter(InspIRCd* Instance, Module* Creator) : ListModeBase(Instance, Creator, 'g', "End of channel spamfilter list", 941, 940, false, "chanfilter") { } + ChanFilter(Module* Creator) : ListModeBase(Creator, 'g', "End of channel spamfilter list", 941, 940, false, "chanfilter") { } virtual bool ValidateParam(User* user, Channel* chan, std::string &word) { @@ -62,8 +62,8 @@ class ModuleChanFilter : public Module public: - ModuleChanFilter(InspIRCd* Me) - : Module(Me), cf(Me, this) + ModuleChanFilter() + : cf(this) { if (!ServerInstance->Modes->AddMode(&cf)) throw ModuleException("Could not add new modes!"); @@ -78,14 +78,14 @@ class ModuleChanFilter : public Module virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; hidemask = Conf.ReadFlag("chanfilter", "hidemask", 0); cf.DoRehash(); } virtual ModResult ProcessMessages(User* user,Channel* chan,std::string &text) { - if (!IS_LOCAL(user) || (CHANOPS_EXEMPT(ServerInstance, 'g') && chan->GetPrefixValue(user) == OP_VALUE)) + if (!IS_LOCAL(user) || (CHANOPS_EXEMPT('g') && chan->GetPrefixValue(user) == OP_VALUE)) return MOD_RES_PASSTHRU; modelist* list = cf.extItem.get(chan); diff --git a/src/modules/m_chanlog.cpp b/src/modules/m_chanlog.cpp index 0e40ba80c..826c6f32f 100644 --- a/src/modules/m_chanlog.cpp +++ b/src/modules/m_chanlog.cpp @@ -24,8 +24,7 @@ class ModuleChanLog : public Module std::multimap<char, std::string> logstreams; public: - ModuleChanLog(InspIRCd* Me) : Module(Me) - { + ModuleChanLog() { Implementation eventlist[] = { I_OnRehash, I_OnSendSnotice }; ServerInstance->Modules->Attach(eventlist, this, 2); @@ -38,7 +37,7 @@ class ModuleChanLog : public Module virtual void OnRehash(User *user) { - ConfigReader MyConf(ServerInstance); + ConfigReader MyConf; std::string snomasks; std::string channel; @@ -128,7 +127,7 @@ class ChannelLogStream : public LogStream std::string channel; public: - ChannelLogStream(InspIRCd *Instance, int loglevel, const std::string &chan) : LogStream(Instance, loglevel), channel(chan) + ChannelLogStream(int loglevel, const std::string &chan) : LogStream(loglevel), channel(chan) { } diff --git a/src/modules/m_channames.cpp b/src/modules/m_channames.cpp index a918eefd2..008422c66 100644 --- a/src/modules/m_channames.cpp +++ b/src/modules/m_channames.cpp @@ -19,9 +19,8 @@ static bool allowedmap[256]; class NewIsChannelHandler : public HandlerBase2<bool, const char*, size_t> { - InspIRCd* Server; public: - NewIsChannelHandler(InspIRCd* Srv) : Server(Srv) { } + NewIsChannelHandler() { } virtual ~NewIsChannelHandler() { } virtual bool Call(const char*, size_t); }; @@ -44,19 +43,14 @@ bool NewIsChannelHandler::Call(const char* chname, size_t max) class ModuleChannelNames : public Module { private: - InspIRCd* ServerInstance; - NewIsChannelHandler* myhandler; - caller2<bool, const char*, size_t> * rememberer; + NewIsChannelHandler myhandler; + caller2<bool, const char*, size_t> rememberer; bool badchan; public: - ModuleChannelNames(InspIRCd* Me) : Module(Me) + ModuleChannelNames() : rememberer(ServerInstance->IsChannel) { - rememberer = (caller2<bool, const char*, size_t> *) malloc(sizeof(caller2<bool, const char*, size_t>)); - ServerInstance = Me; - *rememberer = ServerInstance->IsChannel; - myhandler = new NewIsChannelHandler(ServerInstance); - ServerInstance->IsChannel = myhandler; + ServerInstance->IsChannel = &myhandler; badchan = false; Implementation eventlist[] = { I_OnRehash, I_OnUserKick }; ServerInstance->Modules->Attach(eventlist, this, 2); @@ -95,7 +89,7 @@ class ModuleChannelNames : public Module virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; std::string denyToken = Conf.ReadValue("channames", "denyrange", 0); std::string allowToken = Conf.ReadValue("channames", "allowrange", 0); memset(allowedmap, 1, sizeof(allowedmap)); @@ -130,9 +124,7 @@ class ModuleChannelNames : public Module virtual ~ModuleChannelNames() { - delete myhandler; - ServerInstance->IsChannel = *rememberer; - free(rememberer); + ServerInstance->IsChannel = rememberer; ValidateChans(); } diff --git a/src/modules/m_channelban.cpp b/src/modules/m_channelban.cpp index 387aeb2b9..5b7b326bd 100644 --- a/src/modules/m_channelban.cpp +++ b/src/modules/m_channelban.cpp @@ -19,8 +19,7 @@ class ModuleBadChannelExtban : public Module { private: public: - ModuleBadChannelExtban(InspIRCd* Me) : Module(Me) - { + ModuleBadChannelExtban() { Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); } diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index 4d046b415..12b5c1db4 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -67,7 +67,7 @@ class FounderProtectBase const UserMembList* cl = channel->GetUsers(); std::vector<std::string> mode_junk; mode_junk.push_back(channel->name); - irc::modestacker modestack(ServerInstance, false); + irc::modestacker modestack(false); std::deque<std::string> stackresult; for (UserMembCIter i = cl->begin(); i != cl->end(); i++) @@ -266,8 +266,8 @@ class ModuleChanProtect : public Module public: - ModuleChanProtect(InspIRCd* Me) - : Module(Me), FirstInGetsFounder(false), QPrefix(0), APrefix(0), DeprivSelf(false), DeprivOthers(false), booting(true), cp(NULL), cf(NULL) + ModuleChanProtect() + : FirstInGetsFounder(false), QPrefix(0), APrefix(0), DeprivSelf(false), DeprivOthers(false), booting(true), cp(NULL), cf(NULL) { /* Load config stuff */ LoadSettings(); @@ -291,7 +291,7 @@ class ModuleChanProtect : public Module void LoadSettings() { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; FirstInGetsFounder = Conf.ReadFlag("chanprotect", "noservices", 0); diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index cf07e3644..e3de63325 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -203,7 +203,7 @@ class ModuleCheck : public Module private: CommandCheck mycommand; public: - ModuleCheck(InspIRCd* Me) : Module(Me), mycommand(this) + ModuleCheck() : mycommand(this) { ServerInstance->AddCommand(&mycommand); } diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index 43f6dea7c..fdec5d6d0 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -86,7 +86,7 @@ class ModuleChgHost : public Module CommandChghost cmd; char hostmap[256]; public: - ModuleChgHost(InspIRCd* Me) : cmd(this, hostmap) + ModuleChgHost() : cmd(this, hostmap) { OnRehash(NULL); ServerInstance->AddCommand(&cmd); @@ -97,7 +97,7 @@ class ModuleChgHost : public Module void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; std::string hmap = Conf.ReadValue("hostname", "charmap", 0); if (hmap.empty()) diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index 34d969c05..135b26446 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -80,7 +80,7 @@ class ModuleChgIdent : public Module CommandChgident cmd; public: - ModuleChgIdent(InspIRCd* Me) : Module(Me), cmd(this) + ModuleChgIdent() : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp index 506325eee..17ad9dc48 100644 --- a/src/modules/m_chgname.cpp +++ b/src/modules/m_chgname.cpp @@ -72,7 +72,7 @@ class ModuleChgName : public Module CommandChgname cmd; public: - ModuleChgName(InspIRCd* Me) : Module(Me), cmd(this) + ModuleChgName() : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 25d997798..2bd8df80e 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -197,7 +197,7 @@ class CloakUser : public ModeHandler void DoRehash() { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; bool lowercase; /* These are *not* using the need_positive parameter of ReadInteger - @@ -256,7 +256,7 @@ class ModuleCloaking : public Module CloakUser* cu; public: - ModuleCloaking(InspIRCd*) + ModuleCloaking() { /* Attempt to locate the md5 service provider, bail if we can't find it */ Module* HashModule = ServerInstance->Modules->Find("m_md5.so"); diff --git a/src/modules/m_clones.cpp b/src/modules/m_clones.cpp index 966f29705..9742ea29d 100644 --- a/src/modules/m_clones.cpp +++ b/src/modules/m_clones.cpp @@ -61,7 +61,7 @@ class ModuleClones : public Module private: CommandClones cmd; public: - ModuleClones(InspIRCd* Me) : Module(Me), cmd(this) + ModuleClones() : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_close.cpp b/src/modules/m_close.cpp index 762036407..1cddc5012 100644 --- a/src/modules/m_close.cpp +++ b/src/modules/m_close.cpp @@ -68,8 +68,8 @@ class ModuleClose : public Module { CommandClose cmd; public: - ModuleClose(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleClose() + : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_commonchans.cpp b/src/modules/m_commonchans.cpp index 35d7f5179..20b409b9b 100644 --- a/src/modules/m_commonchans.cpp +++ b/src/modules/m_commonchans.cpp @@ -20,7 +20,7 @@ class PrivacyMode : public ModeHandler { public: - PrivacyMode(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'c', PARAM_NONE, MODETYPE_USER) { } + PrivacyMode(Module* Creator) : ModeHandler(Creator, 'c', PARAM_NONE, MODETYPE_USER) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -49,7 +49,7 @@ class ModulePrivacyMode : public Module { PrivacyMode pm; public: - ModulePrivacyMode(InspIRCd* Me) : Module(Me), pm(Me, this) + ModulePrivacyMode() : pm(this) { if (!ServerInstance->Modes->AddMode(&pm)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_conn_join.cpp b/src/modules/m_conn_join.cpp index af6b50afd..b78cc85be 100644 --- a/src/modules/m_conn_join.cpp +++ b/src/modules/m_conn_join.cpp @@ -42,9 +42,8 @@ class ModuleConnJoin : public Module } public: - ModuleConnJoin(InspIRCd* Me) - : Module(Me) - { + ModuleConnJoin() + { OnRehash(NULL); Implementation eventlist[] = { I_OnPostConnect, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 2); @@ -58,7 +57,7 @@ class ModuleConnJoin : public Module virtual void OnRehash(User* user) { - ConfigReader* conf = new ConfigReader(ServerInstance); + ConfigReader* conf = new ConfigReader; JoinChan = conf->ReadValue("autojoin", "channel", 0); Joinchans.clear(); if (!JoinChan.empty()) @@ -82,7 +81,7 @@ class ModuleConnJoin : public Module for(std::vector<std::string>::iterator it = Joinchans.begin(); it != Joinchans.end(); it++) if (ServerInstance->IsChannel(it->c_str(), ServerInstance->Config->Limits.ChanMax)) - Channel::JoinUser(ServerInstance, user, it->c_str(), false, "", false, ServerInstance->Time()); + Channel::JoinUser(user, it->c_str(), false, "", false, ServerInstance->Time()); } }; diff --git a/src/modules/m_conn_umodes.cpp b/src/modules/m_conn_umodes.cpp index 195321bfb..2ad8ab876 100644 --- a/src/modules/m_conn_umodes.cpp +++ b/src/modules/m_conn_umodes.cpp @@ -22,10 +22,9 @@ class ModuleModesOnConnect : public Module ConfigReader *Conf; public: - ModuleModesOnConnect(InspIRCd* Me) : Module(Me) - { + ModuleModesOnConnect() { - Conf = new ConfigReader(ServerInstance); + Conf = new ConfigReader; Implementation eventlist[] = { I_OnUserConnect, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 2); // for things like +x on connect, important, otherwise we have to resort to config order (bleh) -- w00t @@ -36,7 +35,7 @@ class ModuleModesOnConnect : public Module virtual void OnRehash(User* user) { delete Conf; - Conf = new ConfigReader(ServerInstance); + Conf = new ConfigReader; } virtual ~ModuleModesOnConnect() diff --git a/src/modules/m_conn_waitpong.cpp b/src/modules/m_conn_waitpong.cpp index b77116410..46f4a69eb 100644 --- a/src/modules/m_conn_waitpong.cpp +++ b/src/modules/m_conn_waitpong.cpp @@ -22,8 +22,8 @@ class ModuleWaitPong : public Module LocalStringExt ext; public: - ModuleWaitPong(InspIRCd* Me) - : Module(Me), ext("waitpong_pingstr", this) + ModuleWaitPong() + : ext("waitpong_pingstr", this) { OnRehash(NULL); Implementation eventlist[] = { I_OnUserRegister, I_OnCheckReady, I_OnPreCommand, I_OnRehash }; @@ -32,7 +32,7 @@ class ModuleWaitPong : public Module void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; sendsnotice = Conf.ReadFlag("waitpong", "sendsnotice", 0); diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp index d5bb20fe3..d13dc1e0a 100644 --- a/src/modules/m_connectban.cpp +++ b/src/modules/m_connectban.cpp @@ -25,8 +25,7 @@ class ModuleConnectBan : public Module unsigned int ipv4_cidr; unsigned int ipv6_cidr; public: - ModuleConnectBan(InspIRCd* Me) : Module(Me) - { + ModuleConnectBan() { Implementation eventlist[] = { I_OnUserConnect, I_OnGarbageCollect, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 3); OnRehash(NULL); @@ -43,7 +42,7 @@ class ModuleConnectBan : public Module virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; std::string duration; ipv4_cidr = Conf.ReadInteger("connectban", "ipv4cidr", 0, true); @@ -91,7 +90,7 @@ class ModuleConnectBan : public Module if (i->second >= threshold) { // Create zline for set duration. - ZLine* zl = new ZLine(ServerInstance, ServerInstance->Time(), banduration, ServerInstance->Config->ServerName, "Connect flooding", u->GetCIDRMask(range)); + ZLine* zl = new ZLine(ServerInstance->Time(), banduration, ServerInstance->Config->ServerName, "Connect flooding", u->GetCIDRMask(range)); if (ServerInstance->XLines->AddLine(zl,NULL)) ServerInstance->XLines->ApplyLines(); else diff --git a/src/modules/m_connflood.cpp b/src/modules/m_connflood.cpp index 04fe45627..419dbab9c 100644 --- a/src/modules/m_connflood.cpp +++ b/src/modules/m_connflood.cpp @@ -28,8 +28,7 @@ private: public: - ModuleConnFlood(InspIRCd* Me) : Module(Me) - { + ModuleConnFlood() { InitConf(); Implementation eventlist[] = { I_OnRehash, I_OnUserRegister }; @@ -48,7 +47,7 @@ public: void InitConf() { /* read configuration variables */ - conf = new ConfigReader(ServerInstance); + conf = new ConfigReader; /* throttle configuration */ seconds = conf->ReadInteger("connflood", "seconds", 0, true); maxconns = conf->ReadInteger("connflood", "maxconns", 0, true); diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index aa5749a04..9ff250cd6 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -50,7 +50,7 @@ class CommandTitle : public Command snprintf(TheHost,MAXBUF,"%s@%s",user->ident.c_str(), user->host.c_str()); snprintf(TheIP, MAXBUF,"%s@%s",user->ident.c_str(), user->GetIPString()); - ConfigReader Conf(ServerInstance); + ConfigReader Conf; for (int i=0; i<Conf.Enumerate("title"); i++) { std::string name = Conf.ReadValue("title", "name", "", i); @@ -86,7 +86,7 @@ class ModuleCustomTitle : public Module CommandTitle cmd; public: - ModuleCustomTitle(InspIRCd* Me) : Module(Me), cmd(this) + ModuleCustomTitle() : cmd(this) { ServerInstance->AddCommand(&cmd); Extensible::Register(&cmd.ctitle); diff --git a/src/modules/m_cycle.cpp b/src/modules/m_cycle.cpp index 6ff275689..4b3d3e83b 100644 --- a/src/modules/m_cycle.cpp +++ b/src/modules/m_cycle.cpp @@ -61,7 +61,7 @@ class CommandCycle : public Command if (!channel->PartUser(user, reason)) delete channel; - Channel::JoinUser(ServerInstance, user, parameters[0].c_str(), true, "", false, ServerInstance->Time()); + Channel::JoinUser(user, parameters[0].c_str(), true, "", false, ServerInstance->Time()); } return CMD_SUCCESS; @@ -80,8 +80,8 @@ class ModuleCycle : public Module { CommandCycle cmd; public: - ModuleCycle(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleCycle() + : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index a25d553d1..10a8d9310 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -239,10 +239,10 @@ class ModuleDCCAllow : public Module CommandDccallow cmd; public: - ModuleDCCAllow(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleDCCAllow() + : cmd(this) { - Conf = new ConfigReader(ServerInstance); + Conf = new ConfigReader; ext = new SimpleExtItem<dccallowlist>("dccallow", this); Extensible::Register(ext); ServerInstance->AddCommand(&cmd); @@ -255,7 +255,7 @@ class ModuleDCCAllow : public Module virtual void OnRehash(User* user) { delete Conf; - Conf = new ConfigReader(ServerInstance); + Conf = new ConfigReader; ReadFileConf(); } diff --git a/src/modules/m_deaf.cpp b/src/modules/m_deaf.cpp index 82da68100..53085271a 100644 --- a/src/modules/m_deaf.cpp +++ b/src/modules/m_deaf.cpp @@ -20,7 +20,7 @@ class User_d : public ModeHandler { public: - User_d(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'd', PARAM_NONE, MODETYPE_USER) { } + User_d(Module* Creator) : ModeHandler(Creator, 'd', PARAM_NONE, MODETYPE_USER) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -53,8 +53,8 @@ class ModuleDeaf : public Module std::string deaf_bypasschars_uline; public: - ModuleDeaf(InspIRCd* Me) - : Module(Me), m1(Me, this) + ModuleDeaf() + : m1(this) { if (!ServerInstance->Modes->AddMode(&m1)) throw ModuleException("Could not add new modes!"); @@ -67,7 +67,7 @@ class ModuleDeaf : public Module virtual void OnRehash(User* user) { - ConfigReader* conf = new ConfigReader(ServerInstance); + ConfigReader* conf = new ConfigReader; deaf_bypasschars = conf->ReadValue("deaf", "bypasschars", 0); deaf_bypasschars_uline = conf->ReadValue("deaf", "bypasscharsuline", 0); diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index 182399eaa..41038d9cb 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -19,7 +19,7 @@ class DelayJoinMode : public ModeHandler private: CUList empty; public: - DelayJoinMode(InspIRCd* Instance, Module* Parent) : ModeHandler(Parent, 'D', PARAM_NONE, MODETYPE_CHANNEL) + DelayJoinMode(Module* Parent) : ModeHandler(Parent, 'D', PARAM_NONE, MODETYPE_CHANNEL) { levelrequired = OP_VALUE; } @@ -32,7 +32,7 @@ class ModuleDelayJoin : public Module DelayJoinMode djm; public: LocalIntExt unjoined; - ModuleDelayJoin(InspIRCd* Me) : Module(Me), djm(Me, this), unjoined("delayjoin", this) + ModuleDelayJoin() : djm(this), unjoined("delayjoin", this) { if (!ServerInstance->Modes->AddMode(&djm)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_delaymsg.cpp b/src/modules/m_delaymsg.cpp index 9acfc57ea..7931a5982 100644 --- a/src/modules/m_delaymsg.cpp +++ b/src/modules/m_delaymsg.cpp @@ -22,7 +22,7 @@ class DelayMsgMode : public ModeHandler CUList empty; public: LocalIntExt jointime; - DelayMsgMode(InspIRCd* Instance, Module* Parent) : ModeHandler(Parent, 'd', PARAM_SETONLY, MODETYPE_CHANNEL) + DelayMsgMode(Module* Parent) : ModeHandler(Parent, 'd', PARAM_SETONLY, MODETYPE_CHANNEL) , jointime("delaymsg", Parent) { levelrequired = OP_VALUE; @@ -54,7 +54,7 @@ class ModuleDelayMsg : public Module private: DelayMsgMode djm; public: - ModuleDelayMsg(InspIRCd* Me) : Module(Me), djm(Me, this) + ModuleDelayMsg() : djm(this) { if (!ServerInstance->Modes->AddMode(&djm)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp index f47d414bd..f95c0b107 100644 --- a/src/modules/m_denychans.cpp +++ b/src/modules/m_denychans.cpp @@ -23,10 +23,9 @@ class ModuleDenyChannels : public Module ConfigReader *Conf; public: - ModuleDenyChannels(InspIRCd* Me) : Module(Me) - { + ModuleDenyChannels() { - Conf = new ConfigReader(ServerInstance); + Conf = new ConfigReader; Implementation eventlist[] = { I_OnUserPreJoin, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 2); } @@ -34,7 +33,7 @@ class ModuleDenyChannels : public Module virtual void OnRehash(User* user) { delete Conf; - Conf = new ConfigReader(ServerInstance); + Conf = new ConfigReader; /* check for redirect validity and loops/chains */ for (int i =0; i < Conf->Enumerate("badchan"); i++) { @@ -116,7 +115,7 @@ class ModuleDenyChannels : public Module if ((!newchan) || (!(newchan->IsModeSet('L')))) { user->WriteNumeric(926, "%s %s :Channel %s is forbidden, redirecting to %s: %s",user->nick.c_str(),cname,cname,redirect.c_str(), reason.c_str()); - Channel::JoinUser(ServerInstance,user,redirect.c_str(),false,"",false,ServerInstance->Time()); + Channel::JoinUser(user,redirect.c_str(),false,"",false,ServerInstance->Time()); return MOD_RES_DENY; } } diff --git a/src/modules/m_devoice.cpp b/src/modules/m_devoice.cpp index 2e590095f..7c2dcb3d8 100644 --- a/src/modules/m_devoice.cpp +++ b/src/modules/m_devoice.cpp @@ -54,7 +54,7 @@ class ModuleDeVoice : public Module { CommandDevoice cmd; public: - ModuleDeVoice(InspIRCd* Me) : Module(Me), cmd(this) + ModuleDeVoice() : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 06709979b..cb32ede78 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -51,8 +51,8 @@ class DNSBLResolver : public Resolver public: - DNSBLResolver(Module *me, InspIRCd *Instance, const std::string &hostname, User* u, int userfd, DNSBLConfEntry *conf, bool &cached) - : Resolver(Instance, hostname, DNS_QUERY_A, cached, me) + DNSBLResolver(Module *me, const std::string &hostname, User* u, int userfd, DNSBLConfEntry *conf, bool &cached) + : Resolver(hostname, DNS_QUERY_A, cached, me) { theirfd = userfd; them = u; @@ -125,7 +125,7 @@ class DNSBLResolver : public Resolver } case DNSBLConfEntry::I_KLINE: { - KLine* kl = new KLine(ServerInstance, ServerInstance->Time(), ConfEntry->duration, ServerInstance->Config->ServerName, reason.c_str(), + KLine* kl = new KLine(ServerInstance->Time(), ConfEntry->duration, ServerInstance->Config->ServerName, reason.c_str(), "*", them->GetIPString()); if (ServerInstance->XLines->AddLine(kl,NULL)) { @@ -139,7 +139,7 @@ class DNSBLResolver : public Resolver } case DNSBLConfEntry::I_GLINE: { - GLine* gl = new GLine(ServerInstance, ServerInstance->Time(), ConfEntry->duration, ServerInstance->Config->ServerName, reason.c_str(), + GLine* gl = new GLine(ServerInstance->Time(), ConfEntry->duration, ServerInstance->Config->ServerName, reason.c_str(), "*", them->GetIPString()); if (ServerInstance->XLines->AddLine(gl,NULL)) { @@ -153,7 +153,7 @@ class DNSBLResolver : public Resolver } case DNSBLConfEntry::I_ZLINE: { - ZLine* zl = new ZLine(ServerInstance, ServerInstance->Time(), ConfEntry->duration, ServerInstance->Config->ServerName, reason.c_str(), + ZLine* zl = new ZLine(ServerInstance->Time(), ConfEntry->duration, ServerInstance->Config->ServerName, reason.c_str(), them->GetIPString()); if (ServerInstance->XLines->AddLine(zl,NULL)) { @@ -215,8 +215,7 @@ class ModuleDNSBL : public Module return DNSBLConfEntry::I_UNKNOWN; } public: - ModuleDNSBL(InspIRCd *Me) : Module(Me) - { + ModuleDNSBL() { ReadConf(); Implementation eventlist[] = { I_OnRehash, I_OnUserRegister, I_OnStats }; ServerInstance->Modules->Attach(eventlist, this, 3); @@ -246,7 +245,7 @@ class ModuleDNSBL : public Module */ virtual void ReadConf() { - ConfigReader *MyConf = new ConfigReader(ServerInstance); + ConfigReader *MyConf = new ConfigReader; ClearEntries(); for (int i=0; i< MyConf->Enumerate("dnsbl"); i++) @@ -358,7 +357,7 @@ class ModuleDNSBL : public Module /* now we'd need to fire off lookups for `hostname'. */ bool cached; - DNSBLResolver *r = new DNSBLResolver(this, ServerInstance, hostname, user, user->GetFd(), *i, cached); + DNSBLResolver *r = new DNSBLResolver(this, hostname, user, user->GetFd(), *i, cached); ServerInstance->AddResolver(r, cached); } } diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 0c020513f..b6dbee4ea 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -101,7 +101,7 @@ class CommandFilter : public Command { FilterBase* Base; public: - CommandFilter(FilterBase* f, const std::string &ssource) + CommandFilter(FilterBase* f) : Command(reinterpret_cast<Module*>(f), "FILTER", 1, 5), Base(f) { flags_needed = 'o'; @@ -127,7 +127,7 @@ class FilterBase : public Module protected: std::vector<std::string> exemptfromfilter; // List of channel names excluded from filtering. public: - FilterBase(InspIRCd* Me, const std::string &source); + FilterBase(); virtual ~FilterBase(); virtual ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list); virtual FilterResult* FilterMatch(User* user, const std::string &text, int flags) = 0; @@ -242,9 +242,9 @@ bool FilterBase::AppliesToMe(User* user, FilterResult* filter, int iflags) return true; } -FilterBase::FilterBase(InspIRCd* Me, const std::string &source) : Module(Me), filtcommand(this, source) +FilterBase::FilterBase() : filtcommand(this) { - Me->Modules->UseInterface("RegularExpression"); + ServerInstance->Modules->UseInterface("RegularExpression"); ServerInstance->AddCommand(&filtcommand); Implementation eventlist[] = { I_OnPreCommand, I_OnStats, I_OnSyncNetwork, I_OnDecodeMetaData, I_OnUserPreMessage, I_OnUserPreNotice, I_OnRehash, I_OnLoadModule }; ServerInstance->Modules->Attach(eventlist, this, 8); @@ -310,7 +310,7 @@ ModResult FilterBase::OnUserPreNotice(User* user,void* dest,int target_type, std } if (f->action == "gline") { - GLine* gl = new GLine(ServerInstance, ServerInstance->Time(), f->gline_time, ServerInstance->Config->ServerName, f->reason.c_str(), "*", user->GetIPString()); + GLine* gl = new GLine(ServerInstance->Time(), f->gline_time, ServerInstance->Config->ServerName, f->reason.c_str(), "*", user->GetIPString()); if (ServerInstance->XLines->AddLine(gl,NULL)) { ServerInstance->XLines->ApplyLines(); @@ -399,7 +399,7 @@ ModResult FilterBase::OnPreCommand(std::string &command, std::vector<std::string if (f->action == "gline") { /* Note: We gline *@IP so that if their host doesnt resolve the gline still applies. */ - GLine* gl = new GLine(ServerInstance, ServerInstance->Time(), f->gline_time, ServerInstance->Config->ServerName, f->reason.c_str(), "*", user->GetIPString()); + GLine* gl = new GLine(ServerInstance->Time(), f->gline_time, ServerInstance->Config->ServerName, f->reason.c_str(), "*", user->GetIPString()); if (ServerInstance->XLines->AddLine(gl,NULL)) { ServerInstance->XLines->ApplyLines(); @@ -417,7 +417,7 @@ ModResult FilterBase::OnPreCommand(std::string &command, std::vector<std::string void FilterBase::OnRehash(User* user) { - ConfigReader MyConf(ServerInstance); + ConfigReader MyConf; std::vector<std::string>().swap(exemptfromfilter); for (int index = 0; index < MyConf.Enumerate("exemptfromfilter"); ++index) { @@ -467,7 +467,7 @@ void FilterBase::OnLoadModule(Module* mod, const std::string& name) /* Force a rehash to make sure that any filters that couldnt be applied from the conf * on startup or on load are applied right now. */ - ConfigReader Config(ServerInstance); + ConfigReader Config; ServerInstance->SNO->WriteGlobalSno('a', "Found and activated regex module '%s' for m_filter.so.", RegexEngine.c_str()); ReadFilters(Config); } @@ -562,8 +562,7 @@ class ModuleFilter : public FilterBase ImplFilter fr; public: - ModuleFilter(InspIRCd* Me) - : FilterBase(Me, "m_filter.so") + ModuleFilter() { OnRehash(NULL); } @@ -644,7 +643,7 @@ class ModuleFilter : public FilterBase virtual void OnRehash(User* user) { - ConfigReader MyConf(ServerInstance); + ConfigReader MyConf; FilterBase::OnRehash(user); ReadFilters(MyConf); } diff --git a/src/modules/m_gecosban.cpp b/src/modules/m_gecosban.cpp index 0a868d347..9d1550b38 100644 --- a/src/modules/m_gecosban.cpp +++ b/src/modules/m_gecosban.cpp @@ -19,8 +19,7 @@ class ModuleGecosBan : public Module { private: public: - ModuleGecosBan(InspIRCd* Me) : Module(Me) - { + ModuleGecosBan() { Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); } diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp index 19359a976..348984e14 100644 --- a/src/modules/m_globalload.cpp +++ b/src/modules/m_globalload.cpp @@ -142,8 +142,8 @@ class ModuleGlobalLoad : public Module CommandGreloadmodule cmd3; public: - ModuleGlobalLoad(InspIRCd* Me) - : Module(Me), cmd1(this), cmd2(this), cmd3(this) + ModuleGlobalLoad() + : cmd1(this), cmd2(this), cmd3(this) { ServerInstance->AddCommand(&cmd1); ServerInstance->AddCommand(&cmd2); diff --git a/src/modules/m_globops.cpp b/src/modules/m_globops.cpp index 81d969979..3574ad605 100644 --- a/src/modules/m_globops.cpp +++ b/src/modules/m_globops.cpp @@ -51,8 +51,8 @@ class ModuleGlobops : public Module { CommandGlobops cmd; public: - ModuleGlobops(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleGlobops() + : cmd(this) { ServerInstance->AddCommand(&cmd); ServerInstance->SNO->EnableSnomask('g',"GLOBOPS"); diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index f16c64e82..bcf1f1e20 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -22,7 +22,7 @@ static std::map<irc::string, std::string> helpop_map; class Helpop : public ModeHandler { public: - Helpop(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'h', PARAM_NONE, MODETYPE_USER) + Helpop(Module* Creator) : ModeHandler(Creator, 'h', PARAM_NONE, MODETYPE_USER) { oper = true; } @@ -120,8 +120,8 @@ class ModuleHelpop : public Module Helpop ho; public: - ModuleHelpop(InspIRCd* Me) - : Module(Me), cmd(this), ho(Me, this) + ModuleHelpop() + : cmd(this), ho(this) { ReadConfig(); if (!ServerInstance->Modes->AddMode(&ho)) @@ -133,7 +133,7 @@ class ModuleHelpop : public Module virtual void ReadConfig() { - ConfigReader MyConf(ServerInstance); + ConfigReader MyConf; helpop_map.clear(); diff --git a/src/modules/m_hidechans.cpp b/src/modules/m_hidechans.cpp index 6c3dba88f..0d405186b 100644 --- a/src/modules/m_hidechans.cpp +++ b/src/modules/m_hidechans.cpp @@ -20,7 +20,7 @@ class HideChans : public ModeHandler { public: - HideChans(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'I', PARAM_NONE, MODETYPE_USER) { } + HideChans(Module* Creator) : ModeHandler(Creator, 'I', PARAM_NONE, MODETYPE_USER) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -50,7 +50,7 @@ class ModuleHideChans : public Module bool AffectsOpers; HideChans hm; public: - ModuleHideChans(InspIRCd* Me) : Module(Me), hm(Me, this) + ModuleHideChans() : hm(this) { if (!ServerInstance->Modes->AddMode(&hm)) throw ModuleException("Could not add new modes!"); @@ -71,7 +71,7 @@ class ModuleHideChans : public Module virtual void OnRehash(User* user) { - ConfigReader conf(ServerInstance); + ConfigReader conf; AffectsOpers = conf.ReadFlag("hidechans", "affectsopers", 0); } diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp index 8294f5390..b9ea5fa2a 100644 --- a/src/modules/m_hideoper.cpp +++ b/src/modules/m_hideoper.cpp @@ -20,7 +20,7 @@ class HideOper : public ModeHandler { public: - HideOper(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'H', PARAM_NONE, MODETYPE_USER) + HideOper(Module* Creator) : ModeHandler(Creator, 'H', PARAM_NONE, MODETYPE_USER) { oper = true; } @@ -52,8 +52,8 @@ class ModuleHideOper : public Module { HideOper hm; public: - ModuleHideOper(InspIRCd* Me) - : Module(Me), hm(Me, this) + ModuleHideOper() + : hm(this) { if (!ServerInstance->Modes->AddMode(&hm)) diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index a89b5949d..cb5ab6925 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -36,9 +36,8 @@ class ModuleHostChange : public Module std::string MySeparator; public: - ModuleHostChange(InspIRCd* Me) - : Module(Me) - { + ModuleHostChange() + { OnRehash(NULL); Implementation eventlist[] = { I_OnRehash, I_OnUserConnect }; ServerInstance->Modules->Attach(eventlist, this, 2); @@ -62,7 +61,7 @@ class ModuleHostChange : public Module virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; MySuffix = Conf.ReadValue("host","suffix",0); MyPrefix = Conf.ReadValue("host","prefix","",0); MySeparator = Conf.ReadValue("host","separator",".",0); diff --git a/src/modules/m_httpd.cpp b/src/modules/m_httpd.cpp index 929697c5f..e9d05d3e5 100644 --- a/src/modules/m_httpd.cpp +++ b/src/modules/m_httpd.cpp @@ -315,11 +315,11 @@ class HttpServerSocket : public BufferedSocket claimed = false; HTTPRequest httpr(request_type,uri,&headers,this,ip,postdata); Event acl((char*)&httpr, (Module*)HttpModule, "httpd_acl"); - acl.Send(ServerInstance); + acl.Send(); if (!claimed) { Event e((char*)&httpr, (Module*)HttpModule, "httpd_url"); - e.Send(ServerInstance); + e.Send(); if (!claimed) { SendHTTPError(404); @@ -342,7 +342,7 @@ class HttpListener : public ListenSocketBase FileReader* index; public: - HttpListener(InspIRCd* Instance, FileReader *idx, int port, const std::string &addr) : ListenSocketBase(Instance, port, addr) + HttpListener(FileReader *idx, int port, const std::string &addr) : ListenSocketBase(port, addr) { this->index = idx; } @@ -370,7 +370,7 @@ class ModuleHttpServer : public Module std::string indexfile; FileReader* index; HttpListener *http; - ConfigReader c(ServerInstance); + ConfigReader c; httpsocks.clear(); // XXX this will BREAK if this module is made rehashable httplisteners.clear(); @@ -381,16 +381,15 @@ class ModuleHttpServer : public Module bindip = c.ReadValue("http", "ip", i); port = c.ReadInteger("http", "port", i, true); indexfile = c.ReadValue("http", "index", i); - index = new FileReader(ServerInstance, indexfile); + index = new FileReader(indexfile); if (!index->Exists()) throw ModuleException("Can't read index file: "+indexfile); - http = new HttpListener(ServerInstance, index, port, (char *)bindip.c_str()); // XXX this cast SUCKS. + http = new HttpListener(index, port, (char *)bindip.c_str()); // XXX this cast SUCKS. httplisteners.push_back(http); } } - ModuleHttpServer(InspIRCd* Me) : Module(Me) - { + ModuleHttpServer() { ReadConfig(); HttpModule = this; Implementation eventlist[] = { I_OnRequest }; diff --git a/src/modules/m_httpd_acl.cpp b/src/modules/m_httpd_acl.cpp index 812ea843f..8c682cfa9 100644 --- a/src/modules/m_httpd_acl.cpp +++ b/src/modules/m_httpd_acl.cpp @@ -47,7 +47,7 @@ class ModuleHTTPAccessList : public Module void ReadConfig() { acl_list.clear(); - ConfigReader c(ServerInstance); + ConfigReader c; int n_items = c.Enumerate("httpdacl"); for (int i = 0; i < n_items; ++i) { @@ -88,8 +88,7 @@ class ModuleHTTPAccessList : public Module } } - ModuleHTTPAccessList(InspIRCd* Me) : Module(Me) - { + ModuleHTTPAccessList() { ReadConfig(); Implementation eventlist[] = { I_OnEvent, I_OnRequest }; ServerInstance->Modules->Attach(eventlist, this, 2); diff --git a/src/modules/m_httpd_config.cpp b/src/modules/m_httpd_config.cpp index 5f902eb29..55f943d2c 100644 --- a/src/modules/m_httpd_config.cpp +++ b/src/modules/m_httpd_config.cpp @@ -28,12 +28,11 @@ class ModuleHttpStats : public Module void ReadConfig() { - ConfigReader c(ServerInstance); + ConfigReader c; this->stylesheet = c.ReadValue("httpstats", "stylesheet", 0); } - ModuleHttpStats(InspIRCd* Me) : Module(Me) - { + ModuleHttpStats() { ReadConfig(); this->changed = true; Implementation eventlist[] = { I_OnEvent, I_OnRequest }; diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index 01d77d806..46f474e2d 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -28,12 +28,11 @@ class ModuleHttpStats : public Module void ReadConfig() { - ConfigReader c(ServerInstance); + ConfigReader c; this->stylesheet = c.ReadValue("httpstats", "stylesheet", 0); } - ModuleHttpStats(InspIRCd* Me) : Module(Me) - { + ModuleHttpStats() { ReadConfig(); this->changed = true; Implementation eventlist[] = { I_OnEvent, I_OnRequest }; diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 66bd8835a..d74873e00 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -75,13 +75,12 @@ class IdentRequestSocket : public EventHandler { private: User *user; /* User we are attached to */ - InspIRCd* ServerInstance; /* Server instance */ bool done; /* True if lookup is finished */ std::string result; /* Holds the ident string if done */ public: time_t age; - IdentRequestSocket(InspIRCd *Server, User* u) : user(u), ServerInstance(Server), result(u->ident) + IdentRequestSocket(User* u) : user(u), result(u->ident) { age = ServerInstance->Time(); socklen_t size = 0; @@ -280,9 +279,9 @@ class ModuleIdent : public Module ConfigReader *Conf; SimpleExtItem<IdentRequestSocket> ext; public: - ModuleIdent(InspIRCd *Me) : Module(Me), ext("ident_socket", this) + ModuleIdent() : ext("ident_socket", this) { - Conf = new ConfigReader(ServerInstance); + Conf = new ConfigReader; OnRehash(NULL); Implementation eventlist[] = { I_OnRehash, I_OnUserRegister, I_OnCheckReady, I_OnCleanup, I_OnUserDisconnect }; ServerInstance->Modules->Attach(eventlist, this, 5); @@ -301,7 +300,7 @@ class ModuleIdent : public Module virtual void OnRehash(User *user) { delete Conf; - Conf = new ConfigReader(ServerInstance); + Conf = new ConfigReader; RequestTimeout = Conf->ReadInteger("ident", "timeout", 0, true); if (!RequestTimeout) @@ -333,7 +332,7 @@ class ModuleIdent : public Module try { - IdentRequestSocket *isock = new IdentRequestSocket(ServerInstance, user); + IdentRequestSocket *isock = new IdentRequestSocket(user); ext.set(user, isock); } catch (ModuleException &e) diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp index 068e6d666..cfccc3de7 100644 --- a/src/modules/m_invisible.cpp +++ b/src/modules/m_invisible.cpp @@ -19,7 +19,7 @@ class InvisibleMode : public ModeHandler { public: - InvisibleMode(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'Q', PARAM_NONE, MODETYPE_USER) + InvisibleMode(Module* Creator) : ModeHandler(Creator, 'Q', PARAM_NONE, MODETYPE_USER) { oper = true; } @@ -80,7 +80,7 @@ class InvisibleMode : public ModeHandler class InvisibleDeOper : public ModeWatcher { public: - InvisibleDeOper(InspIRCd* Instance) : ModeWatcher(Instance, 'o', MODETYPE_USER) + InvisibleDeOper() : ModeWatcher('o', MODETYPE_USER) { } @@ -105,8 +105,7 @@ class ModuleInvisible : public Module InvisibleMode qm; InvisibleDeOper ido; public: - ModuleInvisible(InspIRCd* Me) - : Module(Me), qm(Me, this), ido(Me) + ModuleInvisible() : qm(this) { if (!ServerInstance->Modes->AddMode(&qm)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_inviteexception.cpp b/src/modules/m_inviteexception.cpp index e2a68120b..777e8efd7 100644 --- a/src/modules/m_inviteexception.cpp +++ b/src/modules/m_inviteexception.cpp @@ -27,21 +27,19 @@ * Now supports CIDR and IP addresses -- Brain */ -class InspIRCd* ServerInstance; - /** Handles channel mode +I */ class InviteException : public ListModeBase { public: - InviteException(InspIRCd* Instance, Module* Creator) : ListModeBase(Instance, Creator, 'I', "End of Channel Invite Exception List", 346, 347, true) { } + InviteException(Module* Creator) : ListModeBase(Creator, 'I', "End of Channel Invite Exception List", 346, 347, true) { } }; class ModuleInviteException : public Module { InviteException ie; public: - ModuleInviteException(InspIRCd* Me) : Module(Me), ie(Me, this) + ModuleInviteException() : ie(this) { if (!ServerInstance->Modes->AddMode(&ie)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index 854276500..2520cbfcf 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -19,8 +19,6 @@ */ class joinfloodsettings : public classbase { - private: - InspIRCd* ServerInstance; public: int secs; int joins; @@ -29,7 +27,7 @@ class joinfloodsettings : public classbase int counter; bool locked; - joinfloodsettings(InspIRCd *Instance, int b, int c) : ServerInstance(Instance), secs(b), joins(c) + joinfloodsettings(int b, int c) : secs(b), joins(c) { reset = ServerInstance->Time() + secs; counter = 0; @@ -87,7 +85,7 @@ class JoinFlood : public ModeHandler { public: SimpleExtItem<joinfloodsettings> ext; - JoinFlood(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'j', PARAM_SETONLY, MODETYPE_CHANNEL), + JoinFlood(Module* Creator) : ModeHandler(Creator, 'j', PARAM_SETONLY, MODETYPE_CHANNEL), ext("joinflood", Creator) { } ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter) @@ -137,7 +135,7 @@ class JoinFlood : public ModeHandler if (!f) { parameter = ConvToStr(njoins) + ":" +ConvToStr(nsecs); - f = new joinfloodsettings(ServerInstance, nsecs, njoins); + f = new joinfloodsettings(nsecs, njoins); ext.set(channel, f); channel->SetModeParam('j', parameter); return MODEACTION_ALLOW; @@ -156,7 +154,7 @@ class JoinFlood : public ModeHandler // new mode param, replace old with new if ((nsecs > 0) && (njoins > 0)) { - f = new joinfloodsettings(ServerInstance, nsecs, njoins); + f = new joinfloodsettings(nsecs, njoins); ext.set(channel, f); channel->SetModeParam('j', parameter); return MODEACTION_ALLOW; @@ -196,8 +194,8 @@ class ModuleJoinFlood : public Module public: - ModuleJoinFlood(InspIRCd* Me) - : Module(Me), jf(Me, this) + ModuleJoinFlood() + : jf(this) { if (!ServerInstance->Modes->AddMode(&jf)) diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp index 78d4bf4b8..0e8f13c4d 100644 --- a/src/modules/m_jumpserver.cpp +++ b/src/modules/m_jumpserver.cpp @@ -135,7 +135,7 @@ class ModuleJumpServer : public Module { CommandJumpserver js; public: - ModuleJumpServer(InspIRCd* Me) : js(this) + ModuleJumpServer() : js(this) { ServerInstance->AddCommand(&js); Implementation eventlist[] = { I_OnUserRegister }; diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index 05deee417..33eefadb2 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -31,7 +31,7 @@ class KickRejoin : public ModeHandler { public: SimpleExtItem<delaylist> ext; - KickRejoin(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'J', PARAM_SETONLY, MODETYPE_CHANNEL), + KickRejoin(Module* Creator) : ModeHandler(Creator, 'J', PARAM_SETONLY, MODETYPE_CHANNEL), ext("norejoinusers", Creator) { } ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter) @@ -104,8 +104,8 @@ class ModuleKickNoRejoin : public Module public: - ModuleKickNoRejoin(InspIRCd* Me) - : Module(Me), kr(Me, this) + ModuleKickNoRejoin() + : kr(this) { if (!ServerInstance->Modes->AddMode(&kr)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index e2f9310d6..28b3b1c50 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -77,7 +77,7 @@ class CommandKnock : public Command class Knock : public SimpleChannelModeHandler { public: - Knock(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'K') { } + Knock(Module* Creator) : SimpleChannelModeHandler(Creator, 'K') { } }; class ModuleKnock : public Module @@ -85,7 +85,7 @@ class ModuleKnock : public Module CommandKnock cmd; Knock kn; public: - ModuleKnock(InspIRCd* Me) : Module(Me), cmd(this), kn(Me, this) + ModuleKnock() : cmd(this), kn(this) { if (!ServerInstance->Modes->AddMode(&kn)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp index 6844fc953..78c15dead 100644 --- a/src/modules/m_lockserv.cpp +++ b/src/modules/m_lockserv.cpp @@ -74,7 +74,7 @@ private: } public: - ModuleLockserv(InspIRCd* Me) : lockcommand(this, locked), unlockcommand(this, locked) + ModuleLockserv() : lockcommand(this, locked), unlockcommand(this, locked) { ResetLocked(); ServerInstance->AddCommand(&lockcommand); diff --git a/src/modules/m_maphide.cpp b/src/modules/m_maphide.cpp index 9a46df1d4..4c9d0591f 100644 --- a/src/modules/m_maphide.cpp +++ b/src/modules/m_maphide.cpp @@ -19,9 +19,8 @@ class ModuleMapHide : public Module { std::string url; public: - ModuleMapHide(InspIRCd* Me) - : Module(Me) - { + ModuleMapHide() + { ServerInstance->Modules->Attach(I_OnPreCommand, this); ServerInstance->Modules->Attach(I_OnRehash, this); OnRehash(NULL); @@ -29,7 +28,7 @@ class ModuleMapHide : public Module void OnRehash(User* user) { - ConfigReader MyConf(ServerInstance); + ConfigReader MyConf; url = MyConf.ReadValue("security", "maphide", 0); } diff --git a/src/modules/m_md5.cpp b/src/modules/m_md5.cpp index 2771ba495..911f6d926 100644 --- a/src/modules/m_md5.cpp +++ b/src/modules/m_md5.cpp @@ -264,8 +264,8 @@ class ModuleMD5 : public Module public: - ModuleMD5(InspIRCd* Me) - : Module(Me), key(NULL), chars(NULL) + ModuleMD5() + : key(NULL), chars(NULL) { ServerInstance->Modules->PublishInterface("HashRequest", this); Implementation eventlist[] = { I_OnRequest }; diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index 611ff953f..5a40664d9 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -28,7 +28,7 @@ class floodsettings : public classbase time_t reset; std::map<User*,int> counters; - floodsettings(InspIRCd *Instance, bool a, int b, int c) : ServerInstance(Instance), ban(a), secs(b), lines(c) + floodsettings(bool a, int b, int c) : ban(a), secs(b), lines(c) { reset = ServerInstance->Time() + secs; }; @@ -77,7 +77,7 @@ class MsgFlood : public ModeHandler { public: SimpleExtItem<floodsettings> ext; - MsgFlood(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'f', PARAM_SETONLY, MODETYPE_CHANNEL), + MsgFlood(Module* Creator) : ModeHandler(Creator, 'f', PARAM_SETONLY, MODETYPE_CHANNEL), ext("messageflood", Creator) { } ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter) @@ -137,7 +137,7 @@ class MsgFlood : public ModeHandler if (!f) { parameter = std::string(ban ? "*" : "") + ConvToStr(nlines) + ":" +ConvToStr(nsecs); - f = new floodsettings(ServerInstance,ban,nsecs,nlines); + f = new floodsettings(ban,nsecs,nlines); ext.set(channel, f); channel->SetModeParam('f', parameter); return MODEACTION_ALLOW; @@ -155,7 +155,7 @@ class MsgFlood : public ModeHandler { if ((((nlines != f->lines) || (nsecs != f->secs) || (ban != f->ban))) && (((nsecs > 0) && (nlines > 0)))) { - floodsettings *fs = new floodsettings(ServerInstance,ban,nsecs,nlines); + floodsettings *fs = new floodsettings(ban,nsecs,nlines); ext.set(channel, fs); channel->SetModeParam('f', parameter); return MODEACTION_ALLOW; @@ -195,8 +195,8 @@ class ModuleMsgFlood : public Module public: - ModuleMsgFlood(InspIRCd* Me) - : Module(Me), mf(Me, this) + ModuleMsgFlood() + : mf(this) { if (!ServerInstance->Modes->AddMode(&mf)) throw ModuleException("Could not add new modes!"); @@ -207,7 +207,7 @@ class ModuleMsgFlood : public Module ModResult ProcessMessages(User* user,Channel* dest, const std::string &text) { - if (!IS_LOCAL(user) || (CHANOPS_EXEMPT(ServerInstance, 'f') && dest->GetPrefixValue(user) == OP_VALUE)) + if (!IS_LOCAL(user) || (CHANOPS_EXEMPT('f') && dest->GetPrefixValue(user) == OP_VALUE)) { return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_muteban.cpp b/src/modules/m_muteban.cpp index 6040252c1..6e3ca525f 100644 --- a/src/modules/m_muteban.cpp +++ b/src/modules/m_muteban.cpp @@ -19,8 +19,7 @@ class ModuleQuietBan : public Module { private: public: - ModuleQuietBan(InspIRCd* Me) : Module(Me) - { + ModuleQuietBan() { Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 3); } diff --git a/src/modules/m_namesx.cpp b/src/modules/m_namesx.cpp index 6f954df64..7614cdc76 100644 --- a/src/modules/m_namesx.cpp +++ b/src/modules/m_namesx.cpp @@ -20,7 +20,7 @@ class ModuleNamesX : public Module { public: GenericCap cap; - ModuleNamesX(InspIRCd* Me) : Module(Me), cap(this, "multi-prefix") + ModuleNamesX() : cap(this, "multi-prefix") { Implementation eventlist[] = { I_OnPreCommand, I_OnNamesListItem, I_On005Numeric, I_OnEvent }; ServerInstance->Modules->Attach(eventlist, this, 4); diff --git a/src/modules/m_nationalchars.cpp b/src/modules/m_nationalchars.cpp index 2fe8dcf39..04b53f02c 100755 --- a/src/modules/m_nationalchars.cpp +++ b/src/modules/m_nationalchars.cpp @@ -24,9 +24,8 @@ class lwbNickHandler : public HandlerBase2<bool, const char*, size_t> { - InspIRCd* Server; public: - lwbNickHandler(InspIRCd* Srv) : Server(Srv) { } + lwbNickHandler() { } virtual ~lwbNickHandler() { } virtual bool Call(const char*, size_t); }; @@ -214,29 +213,21 @@ bool lwbNickHandler::Call(const char* n, size_t max) class ModuleNationalChars : public Module { private: - - InspIRCd* ServerInstance; - lwbNickHandler* myhandler; + lwbNickHandler myhandler; std::string charset, casemapping; unsigned char m_additional[256], m_additionalUp[256], m_lower[256], m_upper[256]; - caller2<bool, const char*, size_t> * rememberer; + caller2<bool, const char*, size_t> rememberer; bool forcequit; const unsigned char * lowermap_rememberer; public: - ModuleNationalChars(InspIRCd* Me) : Module(Me) + ModuleNationalChars() : rememberer(ServerInstance->IsNick) { - rememberer = (caller2<bool, const char*, size_t> *) malloc(sizeof(caller2<bool, const char*, size_t>)); - lowermap_rememberer = national_case_insensitive_map; memcpy(m_lower, rfc_case_insensitive_map, 256); national_case_insensitive_map = m_lower; - ServerInstance = Me; - - *rememberer = ServerInstance->IsNick; - myhandler = new lwbNickHandler(ServerInstance); - ServerInstance->IsNick = myhandler; + ServerInstance->IsNick = &myhandler; Implementation eventlist[] = { I_OnRehash, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); @@ -252,7 +243,7 @@ class ModuleNationalChars : public Module virtual void OnRehash(User* user) { - ConfigReader* conf = new ConfigReader(ServerInstance); + ConfigReader* conf = new ConfigReader; charset = conf->ReadValue("nationalchars", "file", 0); casemapping = conf->ReadValue("nationalchars", "casemapping", charset, 0, false); charset.insert(0, "../locales/"); @@ -279,9 +270,7 @@ class ModuleNationalChars : public Module virtual ~ModuleNationalChars() { - delete myhandler; - ServerInstance->IsNick = *rememberer; - free(rememberer); + ServerInstance->IsNick = rememberer; national_case_insensitive_map = lowermap_rememberer; CheckForceQuit("National characters module unloaded"); } diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp index 5a59814d4..4e6dca5b9 100644 --- a/src/modules/m_nickflood.cpp +++ b/src/modules/m_nickflood.cpp @@ -19,8 +19,6 @@ */ class nickfloodsettings : public classbase { - private: - InspIRCd* ServerInstance; public: int secs; int nicks; @@ -29,9 +27,9 @@ class nickfloodsettings : public classbase int counter; bool locked; - nickfloodsettings(InspIRCd *Instance, int b, int c) : ServerInstance(Instance), secs(b), nicks(c) + nickfloodsettings(int b, int c) : secs(b), nicks(c) { - reset = Instance->Time() + secs; + reset = ServerInstance->Time() + secs; counter = 0; locked = false; }; @@ -91,7 +89,7 @@ class NickFlood : public ModeHandler { public: SimpleExtItem<nickfloodsettings> ext; - NickFlood(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'F', PARAM_SETONLY, MODETYPE_CHANNEL), + NickFlood(Module* Creator) : ModeHandler(Creator, 'F', PARAM_SETONLY, MODETYPE_CHANNEL), ext("nickflood", Creator) { } ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter) @@ -140,7 +138,7 @@ class NickFlood : public ModeHandler if (!f) { parameter = ConvToStr(nnicks) + ":" +ConvToStr(nsecs); - f = new nickfloodsettings(ServerInstance, nsecs, nnicks); + f = new nickfloodsettings(nsecs, nnicks); ext.set(channel, f); channel->SetModeParam('F', parameter); return MODEACTION_ALLOW; @@ -159,7 +157,7 @@ class NickFlood : public ModeHandler // new mode param, replace old with new if ((nsecs > 0) && (nnicks > 0)) { - f = new nickfloodsettings(ServerInstance, nsecs, nnicks); + f = new nickfloodsettings(nsecs, nnicks); ext.set(channel, f); channel->SetModeParam('F', parameter); return MODEACTION_ALLOW; @@ -197,8 +195,8 @@ class ModuleNickFlood : public Module public: - ModuleNickFlood(InspIRCd* Me) - : Module(Me), nf(Me, this) + ModuleNickFlood() + : nf(this) { if (!ServerInstance->Modes->AddMode(&nf)) throw ModuleException("Could not add new modes!"); @@ -219,7 +217,7 @@ class ModuleNickFlood : public Module nickfloodsettings *f = nf.ext.get(channel); if (f) { - if (CHANOPS_EXEMPT(ServerInstance, 'F') && channel->GetPrefixValue(user) == OP_VALUE) + if (CHANOPS_EXEMPT('F') && channel->GetPrefixValue(user) == OP_VALUE) continue; if (f->islocked()) @@ -256,7 +254,7 @@ class ModuleNickFlood : public Module nickfloodsettings *f = nf.ext.get(channel); if (f) { - if (CHANOPS_EXEMPT(ServerInstance, 'F') && channel->GetPrefixValue(user) == OP_VALUE) + if (CHANOPS_EXEMPT('F') && channel->GetPrefixValue(user) == OP_VALUE) return; /* moved this here to avoid incrementing the counter for nick diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index 7e1309457..755ae6da4 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -151,8 +151,8 @@ class ModuleNickLock : public Module CommandNicklock cmd1; CommandNickunlock cmd2; public: - ModuleNickLock(InspIRCd* Me) - : Module(Me), locked("nick_locked", this), cmd1(this, locked), cmd2(this, locked) + ModuleNickLock() + : locked("nick_locked", this), cmd1(this, locked), cmd2(this, locked) { ServerInstance->AddCommand(&cmd1); ServerInstance->AddCommand(&cmd2); diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index eaadb59fe..58b9b7dcb 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -18,7 +18,7 @@ class NoCTCP : public ModeHandler { public: - NoCTCP(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'C', PARAM_NONE, MODETYPE_CHANNEL) { } + NoCTCP(Module* Creator) : ModeHandler(Creator, 'C', PARAM_NONE, MODETYPE_CHANNEL) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -50,8 +50,8 @@ class ModuleNoCTCP : public Module public: - ModuleNoCTCP(InspIRCd* Me) - : Module(Me), nc(Me, this) + ModuleNoCTCP() + : nc(this) { if (!ServerInstance->Modes->AddMode(&nc)) throw ModuleException("Could not add new modes!"); @@ -80,7 +80,7 @@ class ModuleNoCTCP : public Module { Channel* c = (Channel*)dest; - if (CHANOPS_EXEMPT(ServerInstance, 'C') && c->GetPrefixValue(user) == OP_VALUE) + if (CHANOPS_EXEMPT('C') && c->GetPrefixValue(user) == OP_VALUE) { return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp index b060d87f8..db77184d6 100644 --- a/src/modules/m_nokicks.cpp +++ b/src/modules/m_nokicks.cpp @@ -18,7 +18,7 @@ class NoKicks : public SimpleChannelModeHandler { public: - NoKicks(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'Q') { } + NoKicks(Module* Creator) : SimpleChannelModeHandler(Creator, 'Q') { } }; class ModuleNoKicks : public Module @@ -26,8 +26,8 @@ class ModuleNoKicks : public Module NoKicks nk; public: - ModuleNoKicks(InspIRCd* Me) - : Module(Me), nk(Me, this) + ModuleNoKicks() + : nk(this) { if (!ServerInstance->Modes->AddMode(&nk)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index 456d83580..2ed25dfe5 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -18,7 +18,7 @@ class NoNicks : public ModeHandler { public: - NoNicks(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'N', PARAM_NONE, MODETYPE_CHANNEL) { } + NoNicks(Module* Creator) : ModeHandler(Creator, 'N', PARAM_NONE, MODETYPE_CHANNEL) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -47,7 +47,7 @@ class ModuleNoNickChange : public Module { NoNicks nn; public: - ModuleNoNickChange(InspIRCd* Me) : Module(Me), nn(Me, this) + ModuleNoNickChange() : nn(this) { ServerInstance->Modes->AddMode(&nn); Implementation eventlist[] = { I_OnUserPreNick, I_On005Numeric }; @@ -86,7 +86,7 @@ class ModuleNoNickChange : public Module { Channel* curr = *i; - if (CHANOPS_EXEMPT(ServerInstance, 'N') && curr->GetPrefixValue(user) == OP_VALUE) + if (CHANOPS_EXEMPT('N') && curr->GetPrefixValue(user) == OP_VALUE) continue; if (!curr->GetExtBanStatus(user, 'N').check(!curr->IsModeSet('N'))) diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp index e5a3f9996..c3523a7ef 100644 --- a/src/modules/m_nonotice.cpp +++ b/src/modules/m_nonotice.cpp @@ -18,7 +18,7 @@ class NoNotice : public SimpleChannelModeHandler { public: - NoNotice(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'T') { } + NoNotice(Module* Creator) : SimpleChannelModeHandler(Creator, 'T') { } }; class ModuleNoNotice : public Module @@ -26,8 +26,8 @@ class ModuleNoNotice : public Module NoNotice nt; public: - ModuleNoNotice(InspIRCd* Me) - : Module(Me), nt(Me, this) + ModuleNoNotice() + : nt(this) { if (!ServerInstance->Modes->AddMode(&nt)) throw ModuleException("Could not add new modes!"); @@ -52,7 +52,7 @@ class ModuleNoNotice : public Module // ulines are exempt. return MOD_RES_PASSTHRU; } - else if (CHANOPS_EXEMPT(ServerInstance, 'T') && c->GetPrefixValue(user) == OP_VALUE) + else if (CHANOPS_EXEMPT('T') && c->GetPrefixValue(user) == OP_VALUE) { // channel ops are exempt if set in conf. return MOD_RES_PASSTHRU; diff --git a/src/modules/m_nopartmsg.cpp b/src/modules/m_nopartmsg.cpp index 32500f069..270159147 100644 --- a/src/modules/m_nopartmsg.cpp +++ b/src/modules/m_nopartmsg.cpp @@ -19,8 +19,7 @@ class ModulePartMsgBan : public Module { private: public: - ModulePartMsgBan(InspIRCd* Me) : Module(Me) - { + ModulePartMsgBan() { Implementation eventlist[] = { I_OnUserPart, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); } diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp index b8c12f00a..8b8c1401e 100644 --- a/src/modules/m_ojoin.cpp +++ b/src/modules/m_ojoin.cpp @@ -60,7 +60,7 @@ class CommandOjoin : public Command } active = true; - Channel* channel = Channel::JoinUser(ServerInstance, user, parameters[0].c_str(), false, "", false); + Channel* channel = Channel::JoinUser(user, parameters[0].c_str(), false, "", false); active = false; if (channel) @@ -133,7 +133,7 @@ class NetworkPrefix : public ModeHandler const UserMembList* cl = channel->GetUsers(); std::vector<std::string> mode_junk; mode_junk.push_back(channel->name); - irc::modestacker modestack(ServerInstance, false); + irc::modestacker modestack(false); std::deque<std::string> stackresult; for (UserMembCIter i = cl->begin(); i != cl->end(); i++) @@ -235,8 +235,8 @@ class ModuleOjoin : public Module public: - ModuleOjoin(InspIRCd* Me) - : Module(Me), np(NULL), mycommand(this) + ModuleOjoin() + : np(NULL), mycommand(this) { /* Load config stuff */ OnRehash(NULL); @@ -271,7 +271,7 @@ class ModuleOjoin : public Module void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; if (!np) { diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp index 1dbc61f90..edafcd071 100644 --- a/src/modules/m_operchans.cpp +++ b/src/modules/m_operchans.cpp @@ -19,7 +19,7 @@ class OperChans : public ModeHandler { public: /* This is an oper-only mode */ - OperChans(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'O', PARAM_NONE, MODETYPE_CHANNEL) { oper = true; } + OperChans(Module* Creator) : ModeHandler(Creator, 'O', PARAM_NONE, MODETYPE_CHANNEL) { oper = true; } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -48,8 +48,8 @@ class ModuleOperChans : public Module { OperChans oc; public: - ModuleOperChans(InspIRCd* Me) - : Module(Me), oc(Me, this) + ModuleOperChans() + : oc(this) { if (!ServerInstance->Modes->AddMode(&oc)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_operinvex.cpp b/src/modules/m_operinvex.cpp index a32f39176..e8e9215b4 100644 --- a/src/modules/m_operinvex.cpp +++ b/src/modules/m_operinvex.cpp @@ -22,8 +22,7 @@ class ModuleOperInvex : public Module { private: public: - ModuleOperInvex(InspIRCd* Me) : Module(Me) - { + ModuleOperInvex() { Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); } diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp index 6b94a4ef9..ac4aab548 100644 --- a/src/modules/m_operjoin.cpp +++ b/src/modules/m_operjoin.cpp @@ -43,8 +43,7 @@ class ModuleOperjoin : public Module } public: - ModuleOperjoin(InspIRCd* Me) : Module(Me) - { + ModuleOperjoin() { OnRehash(NULL); Implementation eventlist[] = { I_OnPostOper, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 2); @@ -53,7 +52,7 @@ class ModuleOperjoin : public Module virtual void OnRehash(User* user) { - ConfigReader* conf = new ConfigReader(ServerInstance); + ConfigReader* conf = new ConfigReader; operChan = conf->ReadValue("operjoin", "channel", 0); override = conf->ReadFlag("operjoin", "override", "0", 0); @@ -92,7 +91,7 @@ class ModuleOperjoin : public Module for(std::vector<std::string>::iterator it = operChans.begin(); it != operChans.end(); it++) if (ServerInstance->IsChannel(it->c_str(), ServerInstance->Config->Limits.ChanMax)) - Channel::JoinUser(ServerInstance, user, it->c_str(), override, "", false, ServerInstance->Time()); + Channel::JoinUser(user, it->c_str(), override, "", false, ServerInstance->Time()); std::map<std::string, std::vector<std::string> >::iterator i = operTypeChans.find(user->oper); @@ -103,7 +102,7 @@ class ModuleOperjoin : public Module { if (ServerInstance->IsChannel(it->c_str(), ServerInstance->Config->Limits.ChanMax)) { - Channel::JoinUser(ServerInstance, user, it->c_str(), override, "", false, ServerInstance->Time()); + Channel::JoinUser(user, it->c_str(), override, "", false, ServerInstance->Time()); } } } diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp index 979ce8654..b992b33b6 100644 --- a/src/modules/m_operlevels.cpp +++ b/src/modules/m_operlevels.cpp @@ -19,10 +19,9 @@ class ModuleOperLevels : public Module private: ConfigReader* conf; public: - ModuleOperLevels(InspIRCd* Me) - : Module(Me) - { - conf = new ConfigReader(ServerInstance); + ModuleOperLevels() + { + conf = new ConfigReader; Implementation eventlist[] = { I_OnRehash, I_OnKill }; ServerInstance->Modules->Attach(eventlist, this, 2); } @@ -36,7 +35,7 @@ class ModuleOperLevels : public Module virtual void OnRehash(User* user) { delete conf; - conf = new ConfigReader(ServerInstance); + conf = new ConfigReader; } virtual Version GetVersion() diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp index fb89b162f..e0ef99a22 100644 --- a/src/modules/m_operlog.cpp +++ b/src/modules/m_operlog.cpp @@ -20,8 +20,7 @@ class ModuleOperLog : public Module private: public: - ModuleOperLog(InspIRCd* Me) : Module(Me) - { + ModuleOperLog() { Implementation eventlist[] = { I_OnPreCommand, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); diff --git a/src/modules/m_opermodes.cpp b/src/modules/m_opermodes.cpp index 5b78e431b..3890f82e6 100644 --- a/src/modules/m_opermodes.cpp +++ b/src/modules/m_opermodes.cpp @@ -23,11 +23,10 @@ class ModuleModesOnOper : public Module ConfigReader *Conf; public: - ModuleModesOnOper(InspIRCd* Me) - : Module(Me) - { + ModuleModesOnOper() + { - Conf = new ConfigReader(ServerInstance); + Conf = new ConfigReader; Implementation eventlist[] = { I_OnPostOper, I_OnRehash }; ServerInstance->Modules->Attach(eventlist, this, 2); } @@ -36,7 +35,7 @@ class ModuleModesOnOper : public Module virtual void OnRehash(User* user) { delete Conf; - Conf = new ConfigReader(ServerInstance); + Conf = new ConfigReader; } virtual ~ModuleModesOnOper() diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index 418c36b0c..411cd42c8 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -63,7 +63,7 @@ class ModuleOpermotd : public Module void LoadOperMOTD() { - ConfigReader* conf = new ConfigReader(ServerInstance); + ConfigReader* conf = new ConfigReader; std::string filename; filename = conf->ReadValue("opermotd","file",0); if (opermotd) @@ -71,17 +71,17 @@ class ModuleOpermotd : public Module delete opermotd; opermotd = NULL; } - opermotd = new FileReader(ServerInstance, filename); + opermotd = new FileReader(filename); onoper = conf->ReadFlag("opermotd","onoper","yes",0); delete conf; } - ModuleOpermotd(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleOpermotd() + : cmd(this) { opermotd = NULL; ServerInstance->AddCommand(&cmd); - opermotd = new FileReader(ServerInstance); + opermotd = new FileReader; LoadOperMOTD(); Implementation eventlist[] = { I_OnRehash, I_OnOper }; ServerInstance->Modules->Attach(eventlist, this, 2); diff --git a/src/modules/m_operprefix.cpp b/src/modules/m_operprefix.cpp index 732d58857..10dcdb37d 100644 --- a/src/modules/m_operprefix.cpp +++ b/src/modules/m_operprefix.cpp @@ -24,7 +24,7 @@ class OperPrefixMode : public ModeHandler { public: - OperPrefixMode(InspIRCd* Instance, Module* Creator, char pfx) : ModeHandler(Creator, 'y', PARAM_ALWAYS, MODETYPE_CHANNEL) + OperPrefixMode(Module* Creator, char pfx) : ModeHandler(Creator, 'y', PARAM_ALWAYS, MODETYPE_CHANNEL) { list = true; prefix = pfx; @@ -78,12 +78,11 @@ class ModuleOperPrefixMode : public Module private: OperPrefixMode* opm; public: - ModuleOperPrefixMode(InspIRCd* Me) : Module(Me) - { - ConfigReader Conf(ServerInstance); + ModuleOperPrefixMode() { + ConfigReader Conf; std::string pfx = Conf.ReadValue("operprefix", "prefix", "!", 0, false); - opm = new OperPrefixMode(ServerInstance, this, pfx[0]); + opm = new OperPrefixMode(this, pfx[0]); if ((!ServerInstance->Modes->AddMode(opm))) throw ModuleException("Could not add a new mode!"); diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index 92f0f8efc..3c45bb37d 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -26,9 +26,8 @@ class ModuleOverride : public Module public: - ModuleOverride(InspIRCd* Me) - : Module(Me) - { + ModuleOverride() + { // read our config options (main config file) OnRehash(NULL); ServerInstance->SNO->EnableSnomask('G', "GODMODE"); @@ -43,7 +42,7 @@ class ModuleOverride : public Module void OnRehash(User* user) { // on a rehash we delete our classes for good measure and create them again. - ConfigReader Conf(ServerInstance); + ConfigReader Conf; // re-read our config options on a rehash NoisyOverride = Conf.ReadFlag("override", "noisy", 0); diff --git a/src/modules/m_password_hash.cpp b/src/modules/m_password_hash.cpp index 1617110d1..011a592e7 100644 --- a/src/modules/m_password_hash.cpp +++ b/src/modules/m_password_hash.cpp @@ -75,8 +75,8 @@ class ModuleOperHash : public Module bool diduseiface; /* If we've called UseInterface yet. */ public: - ModuleOperHash(InspIRCd* Me) - : Module(Me), cmd(this, hashers, names) + ModuleOperHash() + : cmd(this, hashers, names) { diduseiface = false; diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index 60d2ec248..3e2e18a8e 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -110,7 +110,7 @@ static bool WriteDatabase() class PermChannel : public ModeHandler { public: - PermChannel(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'P', PARAM_NONE, MODETYPE_CHANNEL) { } + PermChannel(Module* Creator) : ModeHandler(Creator, 'P', PARAM_NONE, MODETYPE_CHANNEL) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -175,7 +175,7 @@ class ModulePermanentChannels : public Module PermChannel p; public: - ModulePermanentChannels(InspIRCd* Me) : Module(Me), p(Me, this) + ModulePermanentChannels() : p(this) { if (!ServerInstance->Modes->AddMode(&p)) throw ModuleException("Could not add new modes!"); @@ -215,7 +215,7 @@ public: * Process config-defined list of permanent channels. * -- w00t */ - ConfigReader MyConf(ServerInstance); + ConfigReader MyConf; permchannelsconf = MyConf.ReadValue("permchanneldb", "filename", "", 0, false); @@ -235,7 +235,7 @@ public: if (!c) { - c = new Channel(ServerInstance, channel, ServerInstance->Time()); + c = new Channel(channel, ServerInstance->Time()); if (!topic.empty()) { c->SetTopic(NULL, topic, true); diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp index c3a9c514f..e2910e7cd 100644 --- a/src/modules/m_randquote.cpp +++ b/src/modules/m_randquote.cpp @@ -57,11 +57,11 @@ class ModuleRandQuote : public Module CommandRandquote cmd; ConfigReader *conf; public: - ModuleRandQuote(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleRandQuote() + : cmd(this) { - conf = new ConfigReader(ServerInstance); + conf = new ConfigReader; // Sort the Randomizer thingie.. srand(ServerInstance->Time()); @@ -74,7 +74,7 @@ class ModuleRandQuote : public Module throw ModuleException("m_randquote: Quotefile not specified - Please check your config."); } - quotes = new FileReader(ServerInstance, q_file); + quotes = new FileReader(q_file); if(!quotes->Exists()) { throw ModuleException("m_randquote: QuoteFile not Found!! Please check your config - module will not function."); diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp index 13468823e..6bd375f88 100644 --- a/src/modules/m_redirect.cpp +++ b/src/modules/m_redirect.cpp @@ -20,7 +20,7 @@ class Redirect : public ModeHandler { public: - Redirect(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'L', PARAM_SETONLY, MODETYPE_CHANNEL) { } + Redirect(Module* Creator) : ModeHandler(Creator, 'L', PARAM_SETONLY, MODETYPE_CHANNEL) { } ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter) { @@ -89,8 +89,8 @@ class ModuleRedirect : public Module public: - ModuleRedirect(InspIRCd* Me) - : Module(Me), re(Me, this) + ModuleRedirect() + : re(this) { if (!ServerInstance->Modes->AddMode(&re)) @@ -120,7 +120,7 @@ class ModuleRedirect : public Module } user->WriteNumeric(470, "%s %s %s :You may not join this channel, so you are automatically being transferred to the redirect channel.", user->nick.c_str(), cname, channel.c_str()); - Channel::JoinUser(ServerInstance, user, channel.c_str(), false, "", false, ServerInstance->Time()); + Channel::JoinUser(user, channel.c_str(), false, "", false, ServerInstance->Time()); return MOD_RES_DENY; } } diff --git a/src/modules/m_regex.h b/src/modules/m_regex.h index b10a5115b..c8cbc10b6 100644 --- a/src/modules/m_regex.h +++ b/src/modules/m_regex.h @@ -20,10 +20,9 @@ class Regex : public classbase { protected: std::string regex_string; // The raw uncompiled regex string. - InspIRCd* ServerInstance; // Constructor may as well be protected, as this class is abstract. - Regex(const std::string& rx, InspIRCd* Me) : regex_string(rx), ServerInstance(Me) + Regex(const std::string& rx) : regex_string(rx) { } diff --git a/src/modules/m_regex_glob.cpp b/src/modules/m_regex_glob.cpp index 8d7eaafc3..ef843cc76 100644 --- a/src/modules/m_regex_glob.cpp +++ b/src/modules/m_regex_glob.cpp @@ -20,7 +20,7 @@ class GlobRegex : public Regex { public: - GlobRegex(const std::string& rx, InspIRCd* Me) : Regex(rx, Me) + GlobRegex(const std::string& rx) : Regex(rx) { } @@ -37,11 +37,10 @@ public: class ModuleRegexGlob : public Module { public: - ModuleRegexGlob(InspIRCd* Me) : Module(Me) - { - Me->Modules->PublishInterface("RegularExpression", this); + ModuleRegexGlob() { + ServerInstance->Modules->PublishInterface("RegularExpression", this); Implementation eventlist[] = { I_OnRequest }; - Me->Modules->Attach(eventlist, this, 1); + ServerInstance->Modules->Attach(eventlist, this, 1); } virtual Version GetVersion() @@ -64,7 +63,7 @@ public: { RegexFactoryRequest* rfr = (RegexFactoryRequest*)request; std::string rx = rfr->GetRegex(); - rfr->result = (Regex*)new GlobRegex(rx, ServerInstance); + rfr->result = new GlobRegex(rx); return "OK"; } return NULL; diff --git a/src/modules/m_regonlycreate.cpp b/src/modules/m_regonlycreate.cpp index 546d8235a..3354c1132 100644 --- a/src/modules/m_regonlycreate.cpp +++ b/src/modules/m_regonlycreate.cpp @@ -18,9 +18,8 @@ class ModuleRegOnlyCreate : public Module { public: - ModuleRegOnlyCreate(InspIRCd* Me) - : Module(Me) - { + ModuleRegOnlyCreate() + { Implementation eventlist[] = { I_OnUserPreJoin }; ServerInstance->Modules->Attach(eventlist, this, 1); } diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index 09f60ad19..ef60639f4 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -187,7 +187,7 @@ class ModuleRemove : public Module public: - ModuleRemove(InspIRCd*) : cmd1(this, supportnokicks), cmd2(this, supportnokicks) + ModuleRemove() : cmd1(this, supportnokicks), cmd2(this, supportnokicks) { ServerInstance->AddCommand(&cmd1); ServerInstance->AddCommand(&cmd2); @@ -204,7 +204,7 @@ class ModuleRemove : public Module virtual void OnRehash(User* user) { - ConfigReader conf(ServerInstance); + ConfigReader conf; supportnokicks = conf.ReadFlag("remove", "supportnokicks", 0); } diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index 8e60359f6..bc66afce5 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -23,7 +23,7 @@ class ModuleRestrictChans : public Module void ReadConfig() { - ConfigReader* MyConf = new ConfigReader(ServerInstance); + ConfigReader* MyConf = new ConfigReader; allowchans.clear(); for (int i = 0; i < MyConf->Enumerate("allowchannel"); i++) { @@ -36,9 +36,8 @@ class ModuleRestrictChans : public Module } public: - ModuleRestrictChans(InspIRCd* Me) - : Module(Me) - { + ModuleRestrictChans() + { ReadConfig(); Implementation eventlist[] = { I_OnUserPreJoin, I_OnRehash }; diff --git a/src/modules/m_restrictmsg.cpp b/src/modules/m_restrictmsg.cpp index affcd5a24..de7737e66 100644 --- a/src/modules/m_restrictmsg.cpp +++ b/src/modules/m_restrictmsg.cpp @@ -21,9 +21,8 @@ class ModuleRestrictMsg : public Module public: - ModuleRestrictMsg(InspIRCd* Me) - : Module(Me) - { + ModuleRestrictMsg() + { Implementation eventlist[] = { I_OnUserPreMessage, I_OnUserPreNotice }; ServerInstance->Modules->Attach(eventlist, this, 2); diff --git a/src/modules/m_ripemd160.cpp b/src/modules/m_ripemd160.cpp index 87ca21ada..1d3b1eb34 100644 --- a/src/modules/m_ripemd160.cpp +++ b/src/modules/m_ripemd160.cpp @@ -407,7 +407,7 @@ class ModuleRIPEMD160 : public Module byte *RMD(byte *message, dword length, unsigned int* key) { ServerInstance->Logs->Log("m_ripemd160", DEBUG, "RMD: '%s' length=%u", (const char*)message, length); - dword MDbuf[RMDsize/32]; /* contains (A, B, C, D(, E)) */ + dword MDbuf[RMDsize/32]; /* contains (A, B, C, D(E)) */ static byte hashcode[RMDsize/8]; /* for final hash-value */ dword X[16]; /* current 16-word chunk */ unsigned int i; /* counter */ @@ -442,7 +442,7 @@ class ModuleRIPEMD160 : public Module public: - ModuleRIPEMD160(InspIRCd* Me) : Module(Me), currkey(NULL), chars("0123456789abcdef") + ModuleRIPEMD160() : currkey(NULL), chars("0123456789abcdef") { ServerInstance->Modules->PublishInterface("HashRequest", this); Implementation eventlist[] = { I_OnRequest }; diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index 94f17ab8c..8bad04f29 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -34,8 +34,8 @@ class RLine : public XLine * @param regex Pattern to match with * @ */ - RLine(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, std::string regexs) - : XLine(Instance, s_time, d, src, re, "R") + RLine(time_t s_time, long d, std::string src, std::string re, std::string regexs) + : XLine(s_time, d, src, re, "R") { matchtext = regexs; @@ -75,7 +75,7 @@ class RLine : public XLine void Apply(User* u) { if (ZlineOnMatch) { - background_zlines.push_back(new ZLine(ServerInstance, ServerInstance->Time(), duration ? expiry - ServerInstance->Time() : 0, ServerInstance->Config->ServerName, reason.c_str(), u->GetIPString())); + background_zlines.push_back(new ZLine(ServerInstance->Time(), duration ? expiry - ServerInstance->Time() : 0, ServerInstance->Config->ServerName, reason.c_str(), u->GetIPString())); } DefaultApply(u, "R", false); } @@ -102,7 +102,7 @@ class RLine : public XLine class RLineFactory : public XLineFactory { public: - RLineFactory(InspIRCd* Instance) : XLineFactory(Instance, "R") + RLineFactory() : XLineFactory("R") { } @@ -110,7 +110,7 @@ class RLineFactory : public XLineFactory */ XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) { - return new RLine(ServerInstance, set_time, duration, source, reason, xline_specific_mask); + return new RLine(set_time, duration, source, reason, xline_specific_mask); } ~RLineFactory() @@ -143,7 +143,7 @@ class CommandRLine : public Command try { - r = new RLine(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), parameters[0].c_str()); + r = new RLine(ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), parameters[0].c_str()); } catch (ModuleException &e) { @@ -203,12 +203,12 @@ class ModuleRLine : public Module std::string RegexEngine; public: - ModuleRLine(InspIRCd* Me) : Module(Me), r(this), f(Me) + ModuleRLine() : r(this) { mymodule = this; OnRehash(NULL); - Me->Modules->UseInterface("RegularExpression"); + ServerInstance->Modules->UseInterface("RegularExpression"); ServerInstance->AddCommand(&r); ServerInstance->XLines->RegisterFactory(&f); @@ -244,7 +244,7 @@ class ModuleRLine : public Module virtual void OnRehash(User *user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; if (!Conf.ReadFlag("rline", "zlineonmatch", 0) && ZlineOnMatch) background_zlines.clear(); diff --git a/src/modules/m_rpc_json.cpp b/src/modules/m_rpc_json.cpp index 76b5f0e2e..e57bb77b5 100644 --- a/src/modules/m_rpc_json.cpp +++ b/src/modules/m_rpc_json.cpp @@ -42,7 +42,7 @@ class ModuleRpcJson : public Module private: public: - ModuleRpcJson(InspIRCd *Me) : Module(Me) + ModuleRpcJson() { ServerInstance->Modules->PublishInterface("RPC", this); Implementation eventlist[] = { I_OnEvent }; @@ -89,7 +89,7 @@ class ModuleRpcJson : public Module RPCRequest modreq("json", method->GetString(), params); Event mev((char*) &modreq, this, "RPCMethod"); - mev.Send(ServerInstance); + mev.Send(); if (!modreq.claimed) throw JsonException("Unrecognized method"); diff --git a/src/modules/m_rpctest.cpp b/src/modules/m_rpctest.cpp index 146eabacf..a33976510 100644 --- a/src/modules/m_rpctest.cpp +++ b/src/modules/m_rpctest.cpp @@ -22,8 +22,7 @@ class ModuleRPCTest : public Module private: public: - ModuleRPCTest(InspIRCd *Me) : Module(Me) - { + ModuleRPCTest() { Implementation eventlist[] = { I_OnEvent }; ServerInstance->Modules->Attach(eventlist, this, 1); } diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp index 325972d76..0160de7c2 100644 --- a/src/modules/m_safelist.cpp +++ b/src/modules/m_safelist.cpp @@ -40,7 +40,7 @@ class ModuleSafeList : public Module SimpleExtItem<ListData> listData; LocalIntExt listTime; public: - ModuleSafeList(InspIRCd* Me) : Module(Me), listData("safelist_data", this), listTime("safelist_last", this) + ModuleSafeList() : listData("safelist_data", this), listTime("safelist_last", this) { OnRehash(NULL); Extensible::Register(&listData); @@ -55,7 +55,7 @@ class ModuleSafeList : public Module void OnRehash(User* user) { - ConfigReader MyConf(ServerInstance); + ConfigReader MyConf; ThrottleSecs = MyConf.ReadInteger("safelist", "throttle", "60", 0, true); LimitList = MyConf.ReadInteger("safelist", "maxlisters", "50", 0, true); ServerNameSize = strlen(ServerInstance->Config->ServerName) + 4; diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index 207415d9e..28634e4f9 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -49,7 +49,7 @@ class CommandSajoin : public Command */ if (IS_LOCAL(dest)) { - Channel::JoinUser(ServerInstance, dest, parameters[1].c_str(), true, "", false, ServerInstance->Time()); + Channel::JoinUser(dest, parameters[1].c_str(), true, "", false, ServerInstance->Time()); /* Fix for dotslasher and w00t - if the join didnt succeed, return CMD_FAILURE so that it doesnt propagate */ Channel* n = ServerInstance->FindChan(parameters[1]); if (n) @@ -97,8 +97,8 @@ class ModuleSajoin : public Module { CommandSajoin cmd; public: - ModuleSajoin(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleSajoin() + : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_sakick.cpp b/src/modules/m_sakick.cpp index cd0b07477..fa4d95c96 100644 --- a/src/modules/m_sakick.cpp +++ b/src/modules/m_sakick.cpp @@ -97,8 +97,8 @@ class ModuleSakick : public Module { CommandSakick cmd; public: - ModuleSakick(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleSakick() + : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index 1053f74d2..ba02c5e16 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -42,8 +42,8 @@ class ModuleSaMode : public Module { CommandSamode cmd; public: - ModuleSaMode(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleSaMode() + : cmd(this) { ServerInstance->AddCommand(&cmd); ServerInstance->Modules->Attach(I_OnPreMode, this); diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp index cd3c0aff8..c164de3a2 100644 --- a/src/modules/m_sanick.cpp +++ b/src/modules/m_sanick.cpp @@ -86,8 +86,8 @@ class ModuleSanick : public Module { CommandSanick cmd; public: - ModuleSanick(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleSanick() + : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index d4d4c58ec..255648f85 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -97,8 +97,8 @@ class ModuleSapart : public Module { CommandSapart cmd; public: - ModuleSapart(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleSapart() + : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index 4d67a2cd1..0d181aa65 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -66,8 +66,8 @@ class ModuleSaquit : public Module { CommandSaquit cmd; public: - ModuleSaquit(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleSaquit() + : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index 696b3d809..48e07ef6d 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -34,8 +34,8 @@ class SaslAuthenticator : public classbase bool state_announced; public: - SaslAuthenticator(User *user_, std::string method, InspIRCd *instance, Module *ctor) - : ServerInstance(instance), user(user_), state(SASL_INIT), state_announced(false) + SaslAuthenticator(User *user_, std::string method, Module *ctor) + : user(user_), state(SASL_INIT), state_announced(false) { parameterlist params; params.push_back("*"); @@ -168,7 +168,7 @@ class CommandAuthenticate : public Command SaslAuthenticator *sasl = authExt.get(user); if (!sasl) - authExt.set(user, new SaslAuthenticator(user, parameters[0], ServerInstance, creator)); + authExt.set(user, new SaslAuthenticator(user, parameters[0], creator)); else if (sasl->SendClientMessage(parameters) == false) // IAL abort extension --nenolod { sasl->AnnounceState(); @@ -223,8 +223,8 @@ class ModuleSASL : public Module CommandAuthenticate auth; CommandSASL sasl; public: - ModuleSASL(InspIRCd* Me) - : Module(Me), authExt("sasl_auth", this), cap(this, "sasl"), auth(this, authExt, cap), sasl(this, authExt) + ModuleSASL() + : authExt("sasl_auth", this), cap(this, "sasl"), auth(this, authExt, cap), sasl(this, authExt) { Implementation eventlist[] = { I_OnEvent, I_OnUserRegister, I_OnPostConnect, I_OnUserDisconnect, I_OnCleanup }; ServerInstance->Modules->Attach(eventlist, this, 5); diff --git a/src/modules/m_satopic.cpp b/src/modules/m_satopic.cpp index 58d9cac94..7b2c3e5eb 100644 --- a/src/modules/m_satopic.cpp +++ b/src/modules/m_satopic.cpp @@ -55,8 +55,8 @@ class ModuleSATopic : public Module { CommandSATopic cmd; public: - ModuleSATopic(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleSATopic() + : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp index b2d1f8014..5e2d704bb 100644 --- a/src/modules/m_securelist.cpp +++ b/src/modules/m_securelist.cpp @@ -21,8 +21,7 @@ class ModuleSecureList : public Module std::vector<std::string> allowlist; time_t WaitTime; public: - ModuleSecureList(InspIRCd* Me) : Module(Me) - { + ModuleSecureList() { OnRehash(NULL); Implementation eventlist[] = { I_OnRehash, I_OnPreCommand, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 3); @@ -39,7 +38,7 @@ class ModuleSecureList : public Module void OnRehash(User* user) { - ConfigReader* MyConf = new ConfigReader(ServerInstance); + ConfigReader* MyConf = new ConfigReader; allowlist.clear(); for (int i = 0; i < MyConf->Enumerate("securehost"); i++) diff --git a/src/modules/m_seenicks.cpp b/src/modules/m_seenicks.cpp index 630a7e58e..ca30cfef6 100644 --- a/src/modules/m_seenicks.cpp +++ b/src/modules/m_seenicks.cpp @@ -18,9 +18,8 @@ class ModuleSeeNicks : public Module { public: - ModuleSeeNicks(InspIRCd* Me) - : Module(Me) - { + ModuleSeeNicks() + { ServerInstance->SNO->EnableSnomask('n',"NICK"); ServerInstance->SNO->EnableSnomask('N',"REMOTENICK"); Implementation eventlist[] = { I_OnUserPostNick }; diff --git a/src/modules/m_serverban.cpp b/src/modules/m_serverban.cpp index 6f35de862..810366249 100644 --- a/src/modules/m_serverban.cpp +++ b/src/modules/m_serverban.cpp @@ -19,8 +19,7 @@ class ModuleServerBan : public Module { private: public: - ModuleServerBan(InspIRCd* Me) : Module(Me) - { + ModuleServerBan() { Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 2); } diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index 7480daf07..6e950f438 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -22,7 +22,7 @@ class Channel_r : public ModeHandler { public: - Channel_r(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'r', PARAM_NONE, MODETYPE_CHANNEL) { } + Channel_r(Module* Creator) : ModeHandler(Creator, 'r', PARAM_NONE, MODETYPE_CHANNEL) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -52,7 +52,7 @@ class User_r : public ModeHandler { public: - User_r(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'r', PARAM_NONE, MODETYPE_USER) { } + User_r(Module* Creator) : ModeHandler(Creator, 'r', PARAM_NONE, MODETYPE_USER) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -78,7 +78,7 @@ class User_r : public ModeHandler class AChannel_R : public SimpleChannelModeHandler { public: - AChannel_R(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'R') { } + AChannel_R(Module* Creator) : SimpleChannelModeHandler(Creator, 'R') { } }; /** User mode +R - unidentified users cannot message @@ -86,7 +86,7 @@ class AChannel_R : public SimpleChannelModeHandler class AUser_R : public SimpleUserModeHandler { public: - AUser_R(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Creator, 'R') { } + AUser_R(Module* Creator) : SimpleUserModeHandler(Creator, 'R') { } }; /** Channel mode +M - unidentified users cannot message channel @@ -94,7 +94,7 @@ class AUser_R : public SimpleUserModeHandler class AChannel_M : public SimpleChannelModeHandler { public: - AChannel_M(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'M') { } + AChannel_M(Module* Creator) : SimpleChannelModeHandler(Creator, 'M') { } }; class ModuleServicesAccount : public Module @@ -106,8 +106,7 @@ class ModuleServicesAccount : public Module User_r m5; StringExtItem accountname; public: - ModuleServicesAccount(InspIRCd* Me) : Module(Me), - m1(Me, this), m2(Me, this), m3(Me, this), m4(Me, this), m5(Me, this), + ModuleServicesAccount() : m1(this), m2(this), m3(this), m4(this), m5(this), accountname("accountname", this) { @@ -267,7 +266,7 @@ class ModuleServicesAccount : public Module ac.user = dest; ac.account = *account; Event n((char*)&ac, this, "account_login"); - n.Send(ServerInstance); + n.Send(); } } } diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp index ee6f2ad23..96e54f8e7 100644 --- a/src/modules/m_servprotect.cpp +++ b/src/modules/m_servprotect.cpp @@ -20,7 +20,7 @@ class ServProtectMode : public ModeHandler { public: - ServProtectMode(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'k', PARAM_NONE, MODETYPE_USER) { oper = true; } + ServProtectMode(Module* Creator) : ModeHandler(Creator, 'k', PARAM_NONE, MODETYPE_USER) { oper = true; } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -40,8 +40,8 @@ class ModuleServProtectMode : public Module { ServProtectMode bm; public: - ModuleServProtectMode(InspIRCd* Me) - : Module(Me), bm(Me, this) + ModuleServProtectMode() + : bm(this) { if (!ServerInstance->Modes->AddMode(&bm)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index ffbc66ddc..cd9368d3c 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -66,8 +66,8 @@ class ModuleSetHost : public Module CommandSethost cmd; char hostmap[256]; public: - ModuleSetHost(InspIRCd* Me) - : Module(Me), cmd(this, hostmap) + ModuleSetHost() + : cmd(this, hostmap) { OnRehash(NULL); ServerInstance->AddCommand(&cmd); @@ -78,7 +78,7 @@ class ModuleSetHost : public Module void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; std::string hmap = Conf.ReadValue("hostname", "charmap", 0); if (hmap.empty()) diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp index 3b6f6682b..a0a4cfe8d 100644 --- a/src/modules/m_setident.cpp +++ b/src/modules/m_setident.cpp @@ -59,7 +59,7 @@ class ModuleSetIdent : public Module CommandSetident cmd; public: - ModuleSetIdent(InspIRCd* Me) : Module(Me), cmd(this) + ModuleSetIdent() : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp index 68df49a33..4751d99c1 100644 --- a/src/modules/m_setidle.cpp +++ b/src/modules/m_setidle.cpp @@ -50,8 +50,8 @@ class ModuleSetIdle : public Module { CommandSetidle cmd; public: - ModuleSetIdle(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleSetIdle() + : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp index be5bdb5f9..c0e32da73 100644 --- a/src/modules/m_setname.cpp +++ b/src/modules/m_setname.cpp @@ -55,8 +55,8 @@ class ModuleSetName : public Module { CommandSetname cmd; public: - ModuleSetName(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleSetName() + : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_sha256.cpp b/src/modules/m_sha256.cpp index b6dc215db..c41bd0699 100644 --- a/src/modules/m_sha256.cpp +++ b/src/modules/m_sha256.cpp @@ -258,7 +258,7 @@ class ModuleSHA256 : public Module public: - ModuleSHA256(InspIRCd* Me) : Module(Me), key(NULL), chars(NULL) + ModuleSHA256() : key(NULL), chars(NULL) { ServerInstance->Modules->PublishInterface("HashRequest", this); Implementation eventlist[] = { I_OnRequest }; diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp index 63e02c76d..9acc019aa 100644 --- a/src/modules/m_showwhois.cpp +++ b/src/modules/m_showwhois.cpp @@ -81,9 +81,9 @@ class ModuleShowwhois : public Module public: - ModuleShowwhois(InspIRCd* Me) : cmd(this) + ModuleShowwhois() : cmd(this) { - ConfigReader conf(ServerInstance); + ConfigReader conf; bool OpersOnly = conf.ReadFlag("showwhois", "opersonly", "yes", 0); ShowWhoisFromOpers = conf.ReadFlag("showwhois", "showfromopers", "yes", 0); diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index 746dcb918..599d665a1 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -21,8 +21,8 @@ class Shun : public XLine public: std::string matchtext; - Shun(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, std::string shunmask) - : XLine(Instance, s_time, d, src, re, "SHUN") + Shun(time_t s_time, long d, std::string src, std::string re, std::string shunmask) + : XLine(s_time, d, src, re, "SHUN") { this->matchtext = shunmask; } @@ -72,13 +72,13 @@ public: class ShunFactory : public XLineFactory { public: - ShunFactory(InspIRCd* Instance) : XLineFactory(Instance, "SHUN") { } + ShunFactory() : XLineFactory("SHUN") { } /** Generate a shun */ XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) { - return new Shun(ServerInstance, set_time, duration, source, reason, xline_specific_mask); + return new Shun(set_time, duration, source, reason, xline_specific_mask); } }; @@ -136,7 +136,7 @@ class CommandShun : public Command try { - r = new Shun(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), expr.c_str(), target.c_str()); + r = new Shun(ServerInstance->Time(), duration, user->nick.c_str(), expr.c_str(), target.c_str()); } catch (...) { @@ -187,7 +187,7 @@ class ModuleShun : public Module bool affectopers; public: - ModuleShun(InspIRCd* Me) : Module(Me), cmd(this), f(Me) + ModuleShun() : cmd(this) { ServerInstance->XLines->RegisterFactory(&f); ServerInstance->AddCommand(&cmd); @@ -214,7 +214,7 @@ class ModuleShun : public Module virtual void OnRehash(User* user) { - ConfigReader MyConf(ServerInstance); + ConfigReader MyConf; std::string cmds = MyConf.ReadValue("shun", "enabledcommands", 0); if (cmds.empty()) diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 57f3416e7..eae6bf35c 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -270,8 +270,8 @@ class ModuleSilence : public Module CommandSVSSilence cmdsvssilence; public: - ModuleSilence(InspIRCd* Me) - : Module(Me), maxsilence(32), cmdsilence(this, maxsilence), cmdsvssilence(this) + ModuleSilence() + : maxsilence(32), cmdsilence(this, maxsilence), cmdsvssilence(this) { OnRehash(NULL); ServerInstance->AddCommand(&cmdsilence); @@ -283,7 +283,7 @@ class ModuleSilence : public Module void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; maxsilence = Conf.ReadInteger("silence", "maxentries", 0, true); if (!maxsilence) maxsilence = 32; diff --git a/src/modules/m_spanningtree/cachetimer.cpp b/src/modules/m_spanningtree/cachetimer.cpp index ae26f3600..989ed565f 100644 --- a/src/modules/m_spanningtree/cachetimer.cpp +++ b/src/modules/m_spanningtree/cachetimer.cpp @@ -25,7 +25,7 @@ /* $ModDep: m_spanningtree/cachetimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */ -CacheRefreshTimer::CacheRefreshTimer(InspIRCd *Inst, SpanningTreeUtilities *Util) : Timer(3600, Inst->Time(), true), Instance(Inst), Utils(Util) +CacheRefreshTimer::CacheRefreshTimer(SpanningTreeUtilities *Util) : Timer(3600, ServerInstance->Time(), true), Utils(Util) { } diff --git a/src/modules/m_spanningtree/cachetimer.h b/src/modules/m_spanningtree/cachetimer.h index aec539332..dcfba8ef3 100644 --- a/src/modules/m_spanningtree/cachetimer.h +++ b/src/modules/m_spanningtree/cachetimer.h @@ -18,7 +18,6 @@ class ModuleSpanningTree; class SpanningTreeUtilities; -class InspIRCd; /** Create a timer which recurs every second, we inherit from Timer. * Timer is only one-shot however, so at the end of each Tick() we simply @@ -27,10 +26,9 @@ class InspIRCd; class CacheRefreshTimer : public Timer { private: - InspIRCd *Instance; SpanningTreeUtilities *Utils; public: - CacheRefreshTimer(InspIRCd *Instance, SpanningTreeUtilities* Util); + CacheRefreshTimer(SpanningTreeUtilities* Util); virtual void Tick(time_t TIME); }; diff --git a/src/modules/m_spanningtree/fjoin.cpp b/src/modules/m_spanningtree/fjoin.cpp index 7f11f40dd..810cf23a5 100644 --- a/src/modules/m_spanningtree/fjoin.cpp +++ b/src/modules/m_spanningtree/fjoin.cpp @@ -53,7 +53,7 @@ bool TreeSocket::ForceJoin(const std::string &source, parameterlist ¶ms) if (params.size() < 3) return true; - irc::modestacker modestack(ServerInstance, true); /* Modes to apply from the users in the user list */ + irc::modestacker modestack(true); /* Modes to apply from the users in the user list */ User* who = NULL; /* User we are currently checking */ std::string channel = params[0]; /* Channel name, as a string */ time_t TS = atoi(params[1].c_str()); /* Timestamp given to us for remote side */ @@ -77,7 +77,7 @@ bool TreeSocket::ForceJoin(const std::string &source, parameterlist ¶ms) if (created) { - chan = new Channel(ServerInstance, channel, TS); + chan = new Channel(channel, TS); ServerInstance->SNO->WriteToSnoMask('d', "Creation FJOIN recieved for %s, timestamp: %lu", chan->name.c_str(), (unsigned long)TS); } else @@ -168,7 +168,7 @@ bool TreeSocket::ForceJoin(const std::string &source, parameterlist ¶ms) for (std::string::iterator x = modes.begin(); x != modes.end(); ++x) modestack.Push(*x, who->nick); - Channel::JoinUser(ServerInstance, who, channel.c_str(), true, "", route_back_again->bursting, TS); + Channel::JoinUser(who, channel.c_str(), true, "", route_back_again->bursting, TS); } else { @@ -203,7 +203,7 @@ bool TreeSocket::RemoveStatus(const std::string &prefix, parameterlist ¶ms) if (c) { - irc::modestacker stack(ServerInstance, false); + irc::modestacker stack(false); parameterlist stackresult; stackresult.push_back(c->name); diff --git a/src/modules/m_spanningtree/handshaketimer.cpp b/src/modules/m_spanningtree/handshaketimer.cpp index 814aa122c..b264a4c2f 100644 --- a/src/modules/m_spanningtree/handshaketimer.cpp +++ b/src/modules/m_spanningtree/handshaketimer.cpp @@ -25,7 +25,8 @@ /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */ -HandshakeTimer::HandshakeTimer(InspIRCd* Inst, TreeSocket* s, Link* l, SpanningTreeUtilities* u, int delay) : Timer(delay, Inst->Time(), true), Instance(Inst), sock(s), lnk(l), Utils(u) +HandshakeTimer::HandshakeTimer(TreeSocket* s, Link* l, SpanningTreeUtilities* u, int delay) + : Timer(delay, ServerInstance->Time(), true), sock(s), lnk(l), Utils(u) { thefd = sock->GetFd(); } diff --git a/src/modules/m_spanningtree/handshaketimer.h b/src/modules/m_spanningtree/handshaketimer.h index 0a60c78fc..3f01a8b5b 100644 --- a/src/modules/m_spanningtree/handshaketimer.h +++ b/src/modules/m_spanningtree/handshaketimer.h @@ -24,13 +24,12 @@ class Link; class HandshakeTimer : public Timer { private: - InspIRCd* Instance; TreeSocket* sock; Link* lnk; SpanningTreeUtilities* Utils; int thefd; public: - HandshakeTimer(InspIRCd* Inst, TreeSocket* s, Link* l, SpanningTreeUtilities* u, int delay); + HandshakeTimer(TreeSocket* s, Link* l, SpanningTreeUtilities* u, int delay); ~HandshakeTimer(); virtual void Tick(time_t TIME); }; diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 230c3109b..23945d095 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -31,16 +31,16 @@ /* $ModDep: m_spanningtree/cachetimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/rconnect.h m_spanningtree/rsquit.h m_spanningtree/protocolinterface.h */ -ModuleSpanningTree::ModuleSpanningTree(InspIRCd* Me) - : Module(Me), max_local(0), max_global(0) +ModuleSpanningTree::ModuleSpanningTree() + : max_local(0), max_global(0) { ServerInstance->Modules->UseInterface("BufferedSocketHook"); - Utils = new SpanningTreeUtilities(ServerInstance, this); + Utils = new SpanningTreeUtilities(this); command_rconnect = new CommandRConnect(this, Utils); ServerInstance->AddCommand(command_rconnect); command_rsquit = new CommandRSQuit(this, Utils); ServerInstance->AddCommand(command_rsquit); - RefreshTimer = new CacheRefreshTimer(ServerInstance, Utils); + RefreshTimer = new CacheRefreshTimer(Utils); ServerInstance->Timers->AddTimer(RefreshTimer); Implementation eventlist[] = @@ -55,7 +55,7 @@ ModuleSpanningTree::ModuleSpanningTree(InspIRCd* Me) ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); delete ServerInstance->PI; - ServerInstance->PI = new SpanningTreeProtocolInterface(this, Utils, ServerInstance); + ServerInstance->PI = new SpanningTreeProtocolInterface(this, Utils); loopCall = false; // update our local user count @@ -292,7 +292,7 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y) try { bool cached; - ServernameResolver* snr = new ServernameResolver((Module*)this, Utils, ServerInstance,x->IPAddr, *x, cached, start_type, y); + ServernameResolver* snr = new ServernameResolver((Module*)this, Utils, x->IPAddr, *x, cached, start_type, y); ServerInstance->AddResolver(snr, cached); } catch (ModuleException& e) @@ -942,7 +942,7 @@ void ModuleSpanningTree::OnEvent(Event* event) ModuleSpanningTree::~ModuleSpanningTree() { delete ServerInstance->PI; - ServerInstance->PI = new ProtocolInterface(ServerInstance); + ServerInstance->PI = new ProtocolInterface; /* This will also free the listeners */ delete Utils; diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index 0d44169c7..810b8ec92 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -60,7 +60,7 @@ class ModuleSpanningTree : public Module /** Constructor */ - ModuleSpanningTree(InspIRCd* Me); + ModuleSpanningTree(); /** Shows /LINKS */ diff --git a/src/modules/m_spanningtree/metadata.cpp b/src/modules/m_spanningtree/metadata.cpp index 135970a4a..ee26f0c73 100644 --- a/src/modules/m_spanningtree/metadata.cpp +++ b/src/modules/m_spanningtree/metadata.cpp @@ -33,7 +33,7 @@ bool TreeSocket::MetaData(const std::string &prefix, parameterlist ¶ms) { if (params[0] == "*") { - FOREACH_MOD_I(ServerInstance,I_OnDecodeMetaData,OnDecodeMetaData(NULL,params[1],params[2])); + FOREACH_MOD(I_OnDecodeMetaData,OnDecodeMetaData(NULL,params[1],params[2])); } else if (*(params[0].c_str()) == '#') { @@ -42,7 +42,7 @@ bool TreeSocket::MetaData(const std::string &prefix, parameterlist ¶ms) { if (item) item->unserialize(FORMAT_NETWORK, c, params[2]); - FOREACH_MOD_I(ServerInstance,I_OnDecodeMetaData,OnDecodeMetaData(c,params[1],params[2])); + FOREACH_MOD(I_OnDecodeMetaData,OnDecodeMetaData(c,params[1],params[2])); } } else if (*(params[0].c_str()) != '#') @@ -52,7 +52,7 @@ bool TreeSocket::MetaData(const std::string &prefix, parameterlist ¶ms) { if (item) item->unserialize(FORMAT_NETWORK, u, params[2]); - FOREACH_MOD_I(ServerInstance,I_OnDecodeMetaData,OnDecodeMetaData(u,params[1],params[2])); + FOREACH_MOD(I_OnDecodeMetaData,OnDecodeMetaData(u,params[1],params[2])); } } } diff --git a/src/modules/m_spanningtree/netburst.cpp b/src/modules/m_spanningtree/netburst.cpp index 3cfad9b63..b8d8c93ee 100644 --- a/src/modules/m_spanningtree/netburst.cpp +++ b/src/modules/m_spanningtree/netburst.cpp @@ -47,7 +47,7 @@ void TreeSocket::DoBurst(TreeServer* s) /* Send everything else (channel modes, xlines etc) */ this->SendChannelModes(s); this->SendXLines(s); - FOREACH_MOD_I(ServerInstance,I_OnSyncNetwork,OnSyncNetwork(Utils->Creator,(void*)this)); + FOREACH_MOD(I_OnSyncNetwork,OnSyncNetwork(Utils->Creator,(void*)this)); this->WriteLine(endburst); ServerInstance->SNO->WriteToSnoMask('l',"Finished bursting to \2"+name+"\2."); } @@ -230,7 +230,7 @@ void TreeSocket::SendChannelModes(TreeServer* Current) Utils->Creator->ProtoSendMetaData(this, c->second, i->first, value); } - FOREACH_MOD_I(ServerInstance,I_OnSyncChannel,OnSyncChannel(c->second,Utils->Creator,this)); + FOREACH_MOD(I_OnSyncChannel,OnSyncChannel(c->second,Utils->Creator,this)); } } @@ -281,7 +281,7 @@ void TreeSocket::SendUsers(TreeServer* Current) Utils->Creator->ProtoSendMetaData(this, u->second, i->first, value); } - FOREACH_MOD_I(ServerInstance,I_OnSyncUser,OnSyncUser(u->second,Utils->Creator,this)); + FOREACH_MOD(I_OnSyncUser,OnSyncUser(u->second,Utils->Creator,this)); } } } diff --git a/src/modules/m_spanningtree/privmsg.cpp b/src/modules/m_spanningtree/privmsg.cpp index c7acf393c..042edaba8 100644 --- a/src/modules/m_spanningtree/privmsg.cpp +++ b/src/modules/m_spanningtree/privmsg.cpp @@ -40,16 +40,16 @@ bool TreeSocket::ServerMessage(const std::string &messagetype, const std::string { if (messagetype == "PRIVMSG") { - FOREACH_MOD_I(ServerInstance, I_OnUserMessage, OnUserMessage(Utils->ServerUser, channel, TYPE_CHANNEL, text, status, except_list)); + FOREACH_MOD(I_OnUserMessage, OnUserMessage(Utils->ServerUser, channel, TYPE_CHANNEL, text, status, except_list)); } else { - FOREACH_MOD_I(ServerInstance, I_OnUserNotice, OnUserNotice(Utils->ServerUser, channel, TYPE_CHANNEL, text, status, except_list)); + FOREACH_MOD(I_OnUserNotice, OnUserNotice(Utils->ServerUser, channel, TYPE_CHANNEL, text, status, except_list)); } TreeServer* s = Utils->FindServer(prefix); if (s) { - FOREACH_MOD_I(ServerInstance, I_OnText, OnText(Utils->ServerUser, channel, TYPE_CHANNEL, text, status, except_list)); + FOREACH_MOD(I_OnText, OnText(Utils->ServerUser, channel, TYPE_CHANNEL, text, status, except_list)); channel->WriteChannelWithServ(s->GetName().c_str(), "%s %s :%s", messagetype.c_str(), channel->name.c_str(), text.c_str()); } } @@ -61,16 +61,16 @@ bool TreeSocket::ServerMessage(const std::string &messagetype, const std::string { if (messagetype == "PRIVMSG") { - FOREACH_MOD_I(ServerInstance, I_OnUserMessage, OnUserMessage(Utils->ServerUser, user, TYPE_USER, text, 0, except_list)); + FOREACH_MOD(I_OnUserMessage, OnUserMessage(Utils->ServerUser, user, TYPE_USER, text, 0, except_list)); } else { - FOREACH_MOD_I(ServerInstance, I_OnUserNotice, OnUserNotice(Utils->ServerUser, user, TYPE_USER, text, 0, except_list)); + FOREACH_MOD(I_OnUserNotice, OnUserNotice(Utils->ServerUser, user, TYPE_USER, text, 0, except_list)); } TreeServer* s = Utils->FindServer(prefix); if (s) { - FOREACH_MOD_I(ServerInstance, I_OnText, OnText(Utils->ServerUser, user, TYPE_USER, text, status, except_list)); + FOREACH_MOD(I_OnText, OnText(Utils->ServerUser, user, TYPE_USER, text, status, except_list)); user->Write(":%s %s %s :%s", s->GetName().c_str(), messagetype.c_str(), user->nick.c_str(), text.c_str()); } diff --git a/src/modules/m_spanningtree/protocolinterface.h b/src/modules/m_spanningtree/protocolinterface.h index 047d490b6..74120ad47 100644 --- a/src/modules/m_spanningtree/protocolinterface.h +++ b/src/modules/m_spanningtree/protocolinterface.h @@ -10,7 +10,7 @@ class SpanningTreeProtocolInterface : public ProtocolInterface ModuleSpanningTree* Module; void SendChannel(Channel* target, char status, const std::string &text); public: - SpanningTreeProtocolInterface(ModuleSpanningTree* mod, SpanningTreeUtilities* util, InspIRCd* Instance) : ProtocolInterface(Instance), Utils(util), Module(mod) { } + SpanningTreeProtocolInterface(ModuleSpanningTree* mod, SpanningTreeUtilities* util) : Utils(util), Module(mod) { } virtual ~SpanningTreeProtocolInterface() { } virtual void SendEncapsulatedData(parameterlist &encap); diff --git a/src/modules/m_spanningtree/resolvers.cpp b/src/modules/m_spanningtree/resolvers.cpp index c7c49b348..782c7795d 100644 --- a/src/modules/m_spanningtree/resolvers.cpp +++ b/src/modules/m_spanningtree/resolvers.cpp @@ -31,7 +31,7 @@ * callback to OnLookupComplete or OnError when completed. Once it has completed we * will have an IP address which we can then use to continue our connection. */ -ServernameResolver::ServernameResolver(Module* me, SpanningTreeUtilities* Util, InspIRCd* Instance, const std::string &hostname, Link x, bool &cached, QueryType qt, Autoconnect* myac) : Resolver(Instance, hostname, qt, cached, me), MyLink(x), Utils(Util), query(qt), host(hostname), mine(me), myautoconnect(myac) +ServernameResolver::ServernameResolver(Module* me, SpanningTreeUtilities* Util, const std::string &hostname, Link x, bool &cached, QueryType qt, Autoconnect* myac) : Resolver(hostname, qt, cached, me), MyLink(x), Utils(Util), query(qt), host(hostname), mine(me), myautoconnect(myac) { /* Nothing in here, folks */ } @@ -71,7 +71,7 @@ void ServernameResolver::OnError(ResolverError e, const std::string &errormessag if (query == DNS_QUERY_AAAA) { bool cached; - ServernameResolver* snr = new ServernameResolver(mine, Utils, ServerInstance, host, MyLink, cached, DNS_QUERY_A, myautoconnect); + ServernameResolver* snr = new ServernameResolver(mine, Utils, host, MyLink, cached, DNS_QUERY_A, myautoconnect); ServerInstance->AddResolver(snr, cached); return; } diff --git a/src/modules/m_spanningtree/resolvers.h b/src/modules/m_spanningtree/resolvers.h index e4404d6a5..5b5bf88cc 100644 --- a/src/modules/m_spanningtree/resolvers.h +++ b/src/modules/m_spanningtree/resolvers.h @@ -33,8 +33,8 @@ class SecurityIPResolver : public Resolver std::string host; QueryType query; public: - SecurityIPResolver(Module* me, SpanningTreeUtilities* U, InspIRCd* Instance, const std::string &hostname, Link x, bool &cached, QueryType qt) - : Resolver(Instance, hostname, qt, cached, me), MyLink(x), Utils(U), mine(me), host(hostname), query(qt) + SecurityIPResolver(Module* me, SpanningTreeUtilities* U, const std::string &hostname, Link x, bool &cached, QueryType qt) + : Resolver(hostname, qt, cached, me), MyLink(x), Utils(U), mine(me), host(hostname), query(qt) { } @@ -48,7 +48,7 @@ class SecurityIPResolver : public Resolver if (query == DNS_QUERY_AAAA) { bool cached; - SecurityIPResolver* res = new SecurityIPResolver(mine, Utils, ServerInstance, host, MyLink, cached, DNS_QUERY_A); + SecurityIPResolver* res = new SecurityIPResolver(mine, Utils, host, MyLink, cached, DNS_QUERY_A); ServerInstance->AddResolver(res, cached); return; } @@ -76,7 +76,7 @@ class ServernameResolver : public Resolver Module* mine; Autoconnect* myautoconnect; public: - ServernameResolver(Module* me, SpanningTreeUtilities* Util, InspIRCd* Instance, const std::string &hostname, Link x, bool &cached, QueryType qt, Autoconnect* myac); + ServernameResolver(Module* me, SpanningTreeUtilities* Util, const std::string &hostname, Link x, bool &cached, QueryType qt, Autoconnect* myac); void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached); void OnError(ResolverError e, const std::string &errormessage); }; diff --git a/src/modules/m_spanningtree/server.cpp b/src/modules/m_spanningtree/server.cpp index 025675642..b1c6c2cb4 100644 --- a/src/modules/m_spanningtree/server.cpp +++ b/src/modules/m_spanningtree/server.cpp @@ -72,7 +72,7 @@ bool TreeSocket::RemoteServer(const std::string &prefix, parameterlist ¶ms) Link* lnk = Utils->FindLink(servername); - TreeServer *Node = new TreeServer(this->Utils, ServerInstance, servername, description, sid, ParentOfThis,NULL, lnk ? lnk->Hidden : false); + TreeServer *Node = new TreeServer(Utils, servername, description, sid, ParentOfThis,NULL, lnk ? lnk->Hidden : false); ParentOfThis->AddChild(Node); params[4] = ":" + params[4]; @@ -158,7 +158,7 @@ bool TreeSocket::Outbound_Reply_Server(parameterlist ¶ms) Utils->timeoutlist.erase(this); - TreeServer *Node = new TreeServer(this->Utils, ServerInstance, sname, description, sid, Utils->TreeRoot, this, x->Hidden); + TreeServer *Node = new TreeServer(Utils, sname, description, sid, Utils->TreeRoot, this, x->Hidden); Utils->TreeRoot->AddChild(Node); params[4] = ":" + params[4]; diff --git a/src/modules/m_spanningtree/svsjoin.cpp b/src/modules/m_spanningtree/svsjoin.cpp index 1664190f8..dff882f62 100644 --- a/src/modules/m_spanningtree/svsjoin.cpp +++ b/src/modules/m_spanningtree/svsjoin.cpp @@ -35,7 +35,7 @@ bool TreeSocket::ServiceJoin(const std::string &prefix, parameterlist ¶ms) { /* only join if it's local, otherwise just pass it on! */ if (IS_LOCAL(u)) - Channel::JoinUser(ServerInstance, u, params[1].c_str(), false, "", false, ServerInstance->Time()); + Channel::JoinUser(u, params[1].c_str(), false, "", false, ServerInstance->Time()); Utils->DoOneToAllButSender(prefix,"SVSJOIN",params,prefix); } return true; diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp index 567d44858..ffc533daf 100644 --- a/src/modules/m_spanningtree/treeserver.cpp +++ b/src/modules/m_spanningtree/treeserver.cpp @@ -25,10 +25,10 @@ * represents our own server. Therefore, it has no route, no parent, and * no socket associated with it. Its version string is our own local version. */ -TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::string Name, std::string Desc, const std::string &id) - : ServerInstance(Instance), ServerName(Name.c_str()), ServerDesc(Desc), Utils(Util) +TreeServer::TreeServer(SpanningTreeUtilities* Util, std::string Name, std::string Desc, const std::string &id) + : ServerName(Name.c_str()), ServerDesc(Desc), Utils(Util) { - age = Instance->Time(); + age = ServerInstance->Time(); bursting = false; Parent = NULL; VersionString.clear(); @@ -46,10 +46,10 @@ TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::str * This constructor initializes the server's Route and Parent, and sets up * its ping counters so that it will be pinged one minute from now. */ -TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::string Name, std::string Desc, const std::string &id, TreeServer* Above, TreeSocket* Sock, bool Hide) - : ServerInstance(Instance), Parent(Above), ServerName(Name.c_str()), ServerDesc(Desc), Socket(Sock), Utils(Util), Hidden(Hide) +TreeServer::TreeServer(SpanningTreeUtilities* Util, std::string Name, std::string Desc, const std::string &id, TreeServer* Above, TreeSocket* Sock, bool Hide) + : Parent(Above), ServerName(Name.c_str()), ServerDesc(Desc), Socket(Sock), Utils(Util), Hidden(Hide) { - age = Instance->Time(); + age = ServerInstance->Time(); bursting = true; VersionString.clear(); ServerUserCount = ServerOperCount = 0; @@ -62,7 +62,7 @@ TreeServer::TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::str gettimeofday(&t, NULL); long ts = (t.tv_sec * 1000) + (t.tv_usec / 1000); this->StartBurst = ts; - Instance->Logs->Log("m_spanningtree",DEBUG, "Started bursting at time %lu", ts); + ServerInstance->Logs->Log("m_spanningtree",DEBUG, "Started bursting at time %lu", ts); /* find the 'route' for this server (e.g. the one directly connected * to the local server, which we can use to reach it) @@ -148,7 +148,7 @@ void TreeServer::FinishBurst() ServerInstance->SNO->WriteToSnoMask(Parent == Utils->TreeRoot ? 'l' : 'L', "Received end of netburst from \2%s\2 (burst time: %lu %s)", ServerName.c_str(), (bursttime > 10000 ? bursttime / 1000 : bursttime), (bursttime > 10000 ? "secs" : "msecs")); Event rmode((char*)ServerName.c_str(), (Module*)Utils->Creator, "new_server"); - rmode.Send(ServerInstance); + rmode.Send(); } void TreeServer::SetID(const std::string &id) diff --git a/src/modules/m_spanningtree/treeserver.h b/src/modules/m_spanningtree/treeserver.h index e8db09cdf..24f9c0499 100644 --- a/src/modules/m_spanningtree/treeserver.h +++ b/src/modules/m_spanningtree/treeserver.h @@ -30,7 +30,6 @@ */ class TreeServer : public classbase { - InspIRCd* ServerInstance; /* Creator */ TreeServer* Parent; /* Parent entry */ TreeServer* Route; /* Route entry */ std::vector<TreeServer*> Children; /* List of child objects */ @@ -61,13 +60,13 @@ class TreeServer : public classbase * represents our own server. Therefore, it has no route, no parent, and * no socket associated with it. Its version string is our own local version. */ - TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::string Name, std::string Desc, const std::string &id); + TreeServer(SpanningTreeUtilities* Util, std::string Name, std::string Desc, const std::string &id); /** When we create a new server, we call this constructor to initialize it. * This constructor initializes the server's Route and Parent, and sets up * its ping counters so that it will be pinged one minute from now. */ - TreeServer(SpanningTreeUtilities* Util, InspIRCd* Instance, std::string Name, std::string Desc, const std::string &id, TreeServer* Above, TreeSocket* Sock, bool Hide); + TreeServer(SpanningTreeUtilities* Util, std::string Name, std::string Desc, const std::string &id, TreeServer* Above, TreeSocket* Sock, bool Hide); int QuitUsers(const std::string &reason); diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 729c273ec..6bb736a85 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -66,7 +66,7 @@ TreeSocket::TreeSocket(SpanningTreeUtilities* Util, int newfd, char* ip, Autocon if (HookMod) BufferedSocketHookRequest(this, Utils->Creator, HookMod).Send(); - hstimer = new HandshakeTimer(ServerInstance, this, &(Utils->LinkBlocks[0]), this->Utils, 1); + hstimer = new HandshakeTimer(this, &(Utils->LinkBlocks[0]), this->Utils, 1); ServerInstance->Timers->AddTimer(hstimer); /* Fix by Brain - inbound sockets need a timeout, too. 30 secs should be pleanty */ @@ -117,7 +117,7 @@ void TreeSocket::OnConnected() if (GetIOHook()) { ServerInstance->SNO->WriteToSnoMask('l', "Connection to \2%s\2[%s] using transport \2%s\2", myhost.c_str(), (x->HiddenFromStats ? "<hidden>" : this->IP.c_str()), x->Hook.c_str()); - hstimer = new HandshakeTimer(ServerInstance, this, &(*x), this->Utils, 1); + hstimer = new HandshakeTimer(this, &(*x), this->Utils, 1); ServerInstance->Timers->AddTimer(hstimer); } else @@ -203,7 +203,7 @@ void TreeSocket::Squit(TreeServer* Current, const std::string &reason) if ((Current) && (Current != Utils->TreeRoot)) { Event rmode((char*)Current->GetName().c_str(), (Module*)Utils->Creator, "lost_server"); - rmode.Send(ServerInstance); + rmode.Send(); parameterlist params; params.push_back(Current->GetName()); diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index cf537f05b..1b617804e 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -169,7 +169,7 @@ bool TreeSocket::ProcessLine(std::string &line) Link* lnk = Utils->FindLink(InboundServerName); - Node = new TreeServer(this->Utils, ServerInstance, InboundServerName, InboundDescription, InboundSID, Utils->TreeRoot, this, lnk ? lnk->Hidden : false); + Node = new TreeServer(this->Utils, InboundServerName, InboundDescription, InboundSID, Utils->TreeRoot, this, lnk ? lnk->Hidden : false); Utils->TreeRoot->AddChild(Node); parameterlist sparams; diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp index 0f0e75a1d..f1a4e6256 100644 --- a/src/modules/m_spanningtree/uid.cpp +++ b/src/modules/m_spanningtree/uid.cpp @@ -87,7 +87,7 @@ bool TreeSocket::ParseUID(const std::string &source, parameterlist ¶ms) User* _new = NULL; try { - _new = new User(ServerInstance, params[0]); + _new = new User(params[0]); } catch (...) { @@ -173,7 +173,7 @@ bool TreeSocket::ParseUID(const std::string &source, parameterlist ¶ms) params[params.size() - 1] = ":" + params[params.size() - 1]; Utils->DoOneToAllButSender(source, "UID", params, source); - FOREACH_MOD_I(ServerInstance,I_OnPostConnect,OnPostConnect(_new)); + FOREACH_MOD(I_OnPostConnect,OnPostConnect(_new)); return true; } diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 8d3c55758..729f6d4ee 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -147,12 +147,12 @@ bool SpanningTreeUtilities::IsServer(const std::string &ServerName) return (FindServer(ServerName) != NULL); } -SpanningTreeUtilities::SpanningTreeUtilities(InspIRCd* Instance, ModuleSpanningTree* C) : ServerInstance(Instance), Creator(C) +SpanningTreeUtilities::SpanningTreeUtilities(ModuleSpanningTree* C) : Creator(C) { ServerInstance->Logs->Log("m_spanningtree",DEBUG,"***** Using SID for hash: %s *****", ServerInstance->Config->GetSID().c_str()); - this->TreeRoot = new TreeServer(this, ServerInstance, ServerInstance->Config->ServerName, ServerInstance->Config->ServerDesc, ServerInstance->Config->GetSID()); - ServerUser = new FakeUser(ServerInstance, TreeRoot->GetID()); + this->TreeRoot = new TreeServer(this, ServerInstance->Config->ServerName, ServerInstance->Config->ServerDesc, ServerInstance->Config->GetSID()); + ServerUser = new FakeUser(TreeRoot->GetID()); this->ReadConfiguration(true); } @@ -418,7 +418,7 @@ void SpanningTreeUtilities::RefreshIPCache() try { bool cached; - SecurityIPResolver* sr = new SecurityIPResolver((Module*)this->Creator, this, ServerInstance, L->IPAddr, *L, cached, start_type); + SecurityIPResolver* sr = new SecurityIPResolver(Creator, this, L->IPAddr, *L, cached, start_type); ServerInstance->AddResolver(sr, cached); } catch (...) @@ -430,7 +430,7 @@ void SpanningTreeUtilities::RefreshIPCache() void SpanningTreeUtilities::ReadConfiguration(bool rebind) { - ConfigReader* Conf = new ConfigReader(ServerInstance); + ConfigReader* Conf = new ConfigReader; /* We don't need to worry about these being *unloaded* on the fly, only loaded, * because we 'use' the interface locking the module in memory. @@ -485,7 +485,7 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind) break; } - ServerSocketListener *listener = new ServerSocketListener(ServerInstance, this, portno, (char *)IP.c_str()); + ServerSocketListener *listener = new ServerSocketListener(this, portno, (char *)IP.c_str()); if (listener->GetFd() == -1) { delete listener; @@ -577,7 +577,7 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind) try { bool cached; - SecurityIPResolver* sr = new SecurityIPResolver((Module*)this->Creator, this, ServerInstance, L.IPAddr, L, cached, start_type); + SecurityIPResolver* sr = new SecurityIPResolver(Creator, this, L.IPAddr, L, cached, start_type); ServerInstance->AddResolver(sr, cached); } catch (...) diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h index 1bdf127d8..2f8fc75db 100644 --- a/src/modules/m_spanningtree/utils.h +++ b/src/modules/m_spanningtree/utils.h @@ -44,7 +44,7 @@ class ServerSocketListener : public ListenSocketBase SpanningTreeUtilities *Utils; public: - ServerSocketListener(InspIRCd* Instance, SpanningTreeUtilities *u, int port, char* addr) : ListenSocketBase(Instance, port, addr) + ServerSocketListener(SpanningTreeUtilities *u, int port, char* addr) : ListenSocketBase(port, addr) { this->Utils = u; Hook = NULL; @@ -82,10 +82,6 @@ class Autoconnect : public classbase */ class SpanningTreeUtilities : public classbase { - private: - /** Creator server - */ - InspIRCd* ServerInstance; public: /** Creator module */ @@ -166,7 +162,7 @@ class SpanningTreeUtilities : public classbase /** Initialise utility class */ - SpanningTreeUtilities(InspIRCd* Instance, ModuleSpanningTree* Creator); + SpanningTreeUtilities(ModuleSpanningTree* Creator); /** Destroy class and free listeners etc */ diff --git a/src/modules/m_spy.cpp b/src/modules/m_spy.cpp index 0cc660537..12aa0d347 100644 --- a/src/modules/m_spy.cpp +++ b/src/modules/m_spy.cpp @@ -18,8 +18,7 @@ class ModuleSpy : public Module { public: - ModuleSpy(InspIRCd* Me) : Module(Me) - { + ModuleSpy() { ServerInstance->Modules->Attach(I_OnUserList, this); } diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index cd636c633..1b5a39ba4 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -116,8 +116,8 @@ class ModuleSSLInfo : public Module CommandSSLInfo cmd; public: - ModuleSSLInfo(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleSSLInfo() + : cmd(this) { ServerInstance->AddCommand(&cmd); @@ -164,7 +164,7 @@ class ModuleSSLInfo : public Module if ((pcmd == "OPER") && (validated)) { - ConfigReader cf(ServerInstance); + ConfigReader cf; char TheHost[MAXBUF]; char TheIP[MAXBUF]; std::string LoginName; diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp index 52e506f07..0538f9f62 100644 --- a/src/modules/m_sslmodes.cpp +++ b/src/modules/m_sslmodes.cpp @@ -21,7 +21,7 @@ class SSLMode : public ModeHandler { public: - SSLMode(InspIRCd* Instance, Module* Creator) : ModeHandler(Creator, 'z', PARAM_NONE, MODETYPE_CHANNEL) { } + SSLMode(Module* Creator) : ModeHandler(Creator, 'z', PARAM_NONE, MODETYPE_CHANNEL) { } ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding) { @@ -70,8 +70,8 @@ class ModuleSSLModes : public Module SSLMode sslm; public: - ModuleSSLModes(InspIRCd* Me) - : Module(Me), sslm(Me, this) + ModuleSSLModes() + : sslm(this) { if (!ServerInstance->Modes->AddMode(&sslm)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp index 34db0c9e5..34662c45b 100644 --- a/src/modules/m_stripcolor.cpp +++ b/src/modules/m_stripcolor.cpp @@ -20,7 +20,7 @@ class ChannelStripColor : public SimpleChannelModeHandler { public: - ChannelStripColor(InspIRCd* Instance, Module* Creator) : SimpleChannelModeHandler(Instance, Creator, 'S') { } + ChannelStripColor(Module* Creator) : SimpleChannelModeHandler(Creator, 'S') { } }; /** Handles user mode +S @@ -28,7 +28,7 @@ class ChannelStripColor : public SimpleChannelModeHandler class UserStripColor : public SimpleUserModeHandler { public: - UserStripColor(InspIRCd* Instance, Module* Creator) : SimpleUserModeHandler(Creator, 'S') { } + UserStripColor(Module* Creator) : SimpleUserModeHandler(Creator, 'S') { } }; @@ -39,7 +39,7 @@ class ModuleStripColor : public Module UserStripColor usc; public: - ModuleStripColor(InspIRCd* Me) : Module(Me), csc(Me, this), usc(Me, this) + ModuleStripColor() : csc(this), usc(this) { if (!ServerInstance->Modes->AddMode(&usc) || !ServerInstance->Modes->AddMode(&csc)) throw ModuleException("Could not add new modes!"); @@ -115,7 +115,7 @@ class ModuleStripColor : public Module // check if we allow ops to bypass filtering, if we do, check if they're opped accordingly. // note: short circut logic here, don't wreck it. -- w00t - if (CHANOPS_EXEMPT(ServerInstance, 'S') && t->GetPrefixValue(user) == OP_VALUE) + if (CHANOPS_EXEMPT('S') && t->GetPrefixValue(user) == OP_VALUE) { return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp index e99adcaec..26f9cac1a 100644 --- a/src/modules/m_svshold.cpp +++ b/src/modules/m_svshold.cpp @@ -23,8 +23,8 @@ class SVSHold : public XLine public: irc::string nickname; - SVSHold(InspIRCd* Instance, time_t s_time, long d, std::string src, std::string re, std::string nick) - : XLine(Instance, s_time, d, src, re, "SVSHOLD") + SVSHold(time_t s_time, long d, std::string src, std::string re, std::string nick) + : XLine(s_time, d, src, re, "SVSHOLD") { this->nickname = nick.c_str(); } @@ -64,13 +64,13 @@ public: class SVSHoldFactory : public XLineFactory { public: - SVSHoldFactory(InspIRCd* Instance) : XLineFactory(Instance, "SVSHOLD") { } + SVSHoldFactory() : XLineFactory("SVSHOLD") { } /** Generate a shun */ XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask) { - return new SVSHold(ServerInstance, set_time, duration, source, reason, xline_specific_mask); + return new SVSHold(set_time, duration, source, reason, xline_specific_mask); } }; @@ -117,7 +117,7 @@ class CommandSvshold : public Command try { - r = new SVSHold(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), parameters[0].c_str()); + r = new SVSHold(ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), parameters[0].c_str()); } catch (...) { @@ -163,7 +163,7 @@ class ModuleSVSHold : public Module public: - ModuleSVSHold(InspIRCd* Me) : Module(Me), cmd(this), s(Me) + ModuleSVSHold() : cmd(this) { ServerInstance->XLines->RegisterFactory(&s); ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index 0c84764a2..4465b0c89 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -75,7 +75,7 @@ class ModuleSWhois : public Module CommandSwhois cmd; public: - ModuleSWhois(InspIRCd* Me) : Module(Me), cmd(this) + ModuleSWhois() : cmd(this) { ServerInstance->AddCommand(&cmd); Implementation eventlist[] = { I_OnWhoisLine, I_OnPostCommand }; @@ -104,7 +104,7 @@ class ModuleSWhois : public Module { if ((command != "OPER") || (result != CMD_SUCCESS)) return; - ConfigReader Conf(ServerInstance); + ConfigReader Conf; std::string swhois; diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 7bbeb13a6..c0816419f 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -118,8 +118,8 @@ class ModuleTimedBans : public Module { CommandTban cmd; public: - ModuleTimedBans(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleTimedBans() + : cmd(this) { ServerInstance->AddCommand(&cmd); TimedBanList.clear(); diff --git a/src/modules/m_tline.cpp b/src/modules/m_tline.cpp index d3c8641d1..e39064ca7 100644 --- a/src/modules/m_tline.cpp +++ b/src/modules/m_tline.cpp @@ -63,8 +63,8 @@ class ModuleTLine : public Module { CommandTline cmd; public: - ModuleTLine(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleTLine() + : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_uhnames.cpp b/src/modules/m_uhnames.cpp index f9cd4c596..be199208d 100644 --- a/src/modules/m_uhnames.cpp +++ b/src/modules/m_uhnames.cpp @@ -21,7 +21,7 @@ class ModuleUHNames : public Module public: GenericCap cap; - ModuleUHNames(InspIRCd* Me) : Module(Me), cap(this, "userhost-in-names") + ModuleUHNames() : cap(this, "userhost-in-names") { Implementation eventlist[] = { I_OnEvent, I_OnPreCommand, I_OnNamesListItem, I_On005Numeric }; ServerInstance->Modules->Attach(eventlist, this, 4); diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp index 38b344f5a..c44e15511 100644 --- a/src/modules/m_uninvite.cpp +++ b/src/modules/m_uninvite.cpp @@ -87,7 +87,7 @@ class ModuleUninvite : public Module public: - ModuleUninvite(InspIRCd* Me) : Module(Me), cmd(this) + ModuleUninvite() : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index 14a92e068..b229aa39b 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -57,8 +57,8 @@ class ModuleUserIP : public Module { CommandUserip cmd; public: - ModuleUserIP(InspIRCd* Me) - : Module(Me), cmd(this) + ModuleUserIP() + : cmd(this) { ServerInstance->AddCommand(&cmd); Implementation eventlist[] = { I_On005Numeric }; diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp index 72b5d669c..f1a074aec 100644 --- a/src/modules/m_vhost.cpp +++ b/src/modules/m_vhost.cpp @@ -27,7 +27,7 @@ class CommandVhost : public Command CmdResult Handle (const std::vector<std::string> ¶meters, User *user) { - ConfigReader *Conf = new ConfigReader(ServerInstance); + ConfigReader *Conf = new ConfigReader; for (int index = 0; index < Conf->Enumerate("vhost"); index++) { @@ -60,7 +60,7 @@ class ModuleVHost : public Module CommandVhost cmd; public: - ModuleVHost(InspIRCd* Me) : Module(Me), cmd(this) + ModuleVHost() : cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index 8c237a8eb..24b4edc09 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -367,8 +367,8 @@ class Modulewatch : public Module CommandSVSWatch sw; public: - Modulewatch(InspIRCd* Me) - : Module(Me), maxwatch(32), cmdw(this, maxwatch), sw(this) + Modulewatch() + : maxwatch(32), cmdw(this, maxwatch), sw(this) { OnRehash(NULL); whos_watching_me = new watchentries(); @@ -381,7 +381,7 @@ class Modulewatch : public Module virtual void OnRehash(User* user) { - ConfigReader Conf(ServerInstance); + ConfigReader Conf; maxwatch = Conf.ReadInteger("watch", "maxentries", 0, true); if (!maxwatch) maxwatch = 32; diff --git a/src/modules/m_xline_db.cpp b/src/modules/m_xline_db.cpp index efd6a9c1d..991d803d6 100644 --- a/src/modules/m_xline_db.cpp +++ b/src/modules/m_xline_db.cpp @@ -22,8 +22,7 @@ class ModuleXLineDB : public Module bool reading_db; // If this is true, addlines are as a result of db reading, so don't bother flushing the db to disk. // DO REMEMBER TO SET IT, otherwise it's annoying :P public: - ModuleXLineDB(InspIRCd* Me) : Module(Me) - { + ModuleXLineDB() { Implementation eventlist[] = { I_OnAddLine, I_OnDelLine, I_OnExpireLine }; ServerInstance->Modules->Attach(eventlist, this, 3); |