diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/extra/m_sqlauth.cpp | 19 | ||||
-rw-r--r-- | src/modules/extra/m_sqllog.cpp | 9 | ||||
-rw-r--r-- | src/modules/extra/m_sqloper.cpp | 11 | ||||
-rw-r--r-- | src/modules/m_banredirect.cpp | 19 |
4 files changed, 27 insertions, 31 deletions
diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp index 8b8073f2d..530d84c57 100644 --- a/src/modules/extra/m_sqlauth.cpp +++ b/src/modules/extra/m_sqlauth.cpp @@ -23,7 +23,6 @@ class ModuleSQLAuth : public Module { - InspIRCd* Srv; Module* SQLutils; Module* SQLprovider; @@ -39,7 +38,7 @@ class ModuleSQLAuth : public Module public: ModuleSQLAuth(InspIRCd* Me) - : Module::Module(Me), Srv(Me) + : Module::Module(Me) { ServerInstance->UseInterface("SQLutils"); ServerInstance->UseInterface("SQL"); @@ -48,7 +47,7 @@ public: if (!SQLutils) throw ModuleException("Can't find m_sqlutils.so. Please load m_sqlutils.so before m_sqlauth.so."); - SQLprovider = Srv->FindFeature("SQL"); + SQLprovider = ServerInstance->FindFeature("SQL"); if (!SQLprovider) throw ModuleException("Can't find an SQL provider module. Please load one before attempting to load m_sqlauth."); @@ -68,7 +67,7 @@ public: virtual void OnRehash(userrec* user, const std::string ¶meter) { - ConfigReader Conf(Srv); + ConfigReader Conf(ServerInstance); usertable = Conf.ReadValue("sqlauth", "usertable", 0); /* User table name */ databaseid = Conf.ReadValue("sqlauth", "dbid", 0); /* Database ID, given to the SQL service provider */ @@ -89,7 +88,7 @@ public: virtual int OnUserRegister(userrec* user) { - if ((allowpattern != "") && (Srv->MatchText(user->nick,allowpattern))) + if ((allowpattern != "") && (ServerInstance->MatchText(user->nick,allowpattern))) { user->Extend("sqlauthed"); return 0; @@ -97,7 +96,7 @@ public: if (!CheckCredentials(user)) { - userrec::QuitUser(Srv,user,killreason); + userrec::QuitUser(ServerInstance,user,killreason); return 1; } return 0; @@ -123,7 +122,7 @@ public: else { if (verbose) - Srv->WriteOpers("Forbidden connection from %s!%s@%s (SQL query failed: %s)", user->nick, user->ident, user->host, req.error.Str()); + ServerInstance->WriteOpers("Forbidden connection from %s!%s@%s (SQL query failed: %s)", user->nick, user->ident, user->host, req.error.Str()); return false; } } @@ -149,13 +148,13 @@ public: else if (verbose) { /* No rows in result, this means there was no record matching the user */ - Srv->WriteOpers("Forbidden connection from %s!%s@%s (SQL query returned no matches)", user->nick, user->ident, user->host); + ServerInstance->WriteOpers("Forbidden connection from %s!%s@%s (SQL query returned no matches)", user->nick, user->ident, user->host); user->Extend("sqlauth_failed"); } } else if (verbose) { - Srv->WriteOpers("Forbidden connection from %s!%s@%s (SQL query failed: %s)", user->nick, user->ident, user->host, res->error.Str()); + ServerInstance->WriteOpers("Forbidden connection from %s!%s@%s (SQL query failed: %s)", user->nick, user->ident, user->host, res->error.Str()); user->Extend("sqlauth_failed"); } } @@ -166,7 +165,7 @@ public: if (!user->GetExt("sqlauthed")) { - userrec::QuitUser(Srv,user,killreason); + userrec::QuitUser(ServerInstance,user,killreason); } return SQLSUCCESS; } diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index b4e5d2331..d48da1703 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -177,12 +177,11 @@ public: class ModuleSQLLog : public Module { - InspIRCd* Srv; ConfigReader* Conf; public: ModuleSQLLog(InspIRCd* Me) - : Module::Module(Me), Srv(Me) + : Module::Module(Me) { ServerInstance->UseInterface("SQLutils"); ServerInstance->UseInterface("SQL"); @@ -191,7 +190,7 @@ class ModuleSQLLog : public Module if (!SQLutils) throw ModuleException("Can't find m_sqlutils.so. Please load m_sqlutils.so before m_sqlauth.so."); - SQLModule = Srv->FindFeature("SQL"); + SQLModule = ServerInstance->FindFeature("SQL"); OnRehash(NULL,""); MyMod = this; @@ -213,7 +212,7 @@ class ModuleSQLLog : public Module void ReadConfig() { - ConfigReader Conf(Srv); + ConfigReader Conf(ServerInstance); dbid = Conf.ReadValue("sqllog","dbid",0); // database id of a database configured in sql module } @@ -297,7 +296,7 @@ class ModuleSQLLog : public Module virtual void OnLoadModule(Module* mod, const std::string &name) { - AddLogEntry(LT_LOADMODULE,name,Srv->Config->ServerName, Srv->Config->ServerName); + AddLogEntry(LT_LOADMODULE,name,ServerInstance->Config->ServerName, ServerInstance->Config->ServerName); } virtual Version GetVersion() diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index 53f3c56c7..c6ce500e6 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -27,14 +27,13 @@ class ModuleSQLOper : public Module { - InspIRCd* Srv; Module* SQLutils; Module* HashModule; std::string databaseid; public: ModuleSQLOper(InspIRCd* Me) - : Module::Module(Me), Srv(Me) + : Module::Module(Me) { ServerInstance->UseInterface("SQLutils"); ServerInstance->UseInterface("SQL"); @@ -66,7 +65,7 @@ public: virtual void OnRehash(userrec* user, const std::string ¶meter) { - ConfigReader Conf(Srv); + ConfigReader Conf(ServerInstance); databaseid = Conf.ReadValue("sqloper", "dbid", 0); /* Database ID of a database configured for the service provider module */ } @@ -92,7 +91,7 @@ public: { Module* target; - target = Srv->FindFeature("SQL"); + target = ServerInstance->FindFeature("SQL"); if (target) { @@ -243,7 +242,7 @@ public: bool OperUser(userrec* user, const std::string &username, const std::string &password, const std::string &pattern, const std::string &type) { - ConfigReader Conf(Srv); + ConfigReader Conf(ServerInstance); for (int j = 0; j < Conf.Enumerate("type"); j++) { @@ -260,7 +259,7 @@ public: if (operhost.size()) user->ChangeDisplayedHost(operhost.c_str()); - Srv->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s", user->nick, user->ident, user->host, type.c_str()); + ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s", user->nick, user->ident, user->host, type.c_str()); user->WriteServ("381 %s :You are now an IRC operator of type %s", user->nick, type.c_str()); if (!user->modes[UM_OPERATOR]) diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index 19a34bb27..3a5acfb34 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -186,17 +186,16 @@ class BanRedirect : public ModeWatcher class ModuleBanRedirect : public Module { BanRedirect* re; - InspIRCd* Srv; bool nofollow; public: ModuleBanRedirect(InspIRCd* Me) - : Module(Me), Srv(Me) + : Module(Me) { re = new BanRedirect(Me); nofollow = false; - if(!Srv->AddModeWatcher(re)) + if(!ServerInstance->AddModeWatcher(re)) throw ModuleException("Could not add mode watcher"); } @@ -222,7 +221,7 @@ class ModuleBanRedirect : public Module irc::modestacker modestack(false); StringDeque stackresult; const char* mode_junk[MAXMODES+1]; - userrec* myhorriblefakeuser = new userrec(Srv); + userrec* myhorriblefakeuser = new userrec(ServerInstance); myhorriblefakeuser->SetFd(FD_MAGIC_NUMBER); mode_junk[0] = chan->name; @@ -245,7 +244,7 @@ class ModuleBanRedirect : public Module mode_junk[i+1] = stackresult[i].c_str(); } - Srv->SendMode(mode_junk, stackresult.size() + 1, myhorriblefakeuser); + ServerInstance->SendMode(mode_junk, stackresult.size() + 1, myhorriblefakeuser); } DELETE(myhorriblefakeuser); @@ -280,12 +279,12 @@ class ModuleBanRedirect : public Module for(BanRedirectList::iterator redir = redirects->begin(); redir != redirects->end(); redir++) { - if(Srv->MatchText(user->GetFullRealHost(), redir->banmask) || Srv->MatchText(user->GetFullHost(), redir->banmask) || Srv->MatchText(ipmask, redir->banmask)) + if(ServerInstance->MatchText(user->GetFullRealHost(), redir->banmask) || ServerInstance->MatchText(user->GetFullHost(), redir->banmask) || ServerInstance->MatchText(ipmask, redir->banmask)) { /* tell them they're banned and are being transferred */ - chanrec* destchan = Srv->FindChan(redir->targetchan); + chanrec* destchan = ServerInstance->FindChan(redir->targetchan); - if(destchan && Srv->FindModule("m_redirect.so") && destchan->IsModeSet('L') && destchan->limit && (destchan->GetUserCounter() >= destchan->limit)) + if(destchan && ServerInstance->FindModule("m_redirect.so") && destchan->IsModeSet('L') && destchan->limit && (destchan->GetUserCounter() >= destchan->limit)) { user->WriteServ("474 %s %s :Cannot join channel (You are banned)", user->nick, chan->name); return 1; @@ -294,7 +293,7 @@ class ModuleBanRedirect : public Module { user->WriteServ("470 %s :You are banned from %s. You are being automatically redirected to %s", user->nick, chan->name, redir->targetchan.c_str()); nofollow = true; - chanrec::JoinUser(Srv, user, redir->targetchan.c_str(), false, "", ServerInstance->Time(true)); + chanrec::JoinUser(ServerInstance, user, redir->targetchan.c_str(), false, "", ServerInstance->Time(true)); nofollow = false; return 1; } @@ -307,7 +306,7 @@ class ModuleBanRedirect : public Module virtual ~ModuleBanRedirect() { - Srv->Modes->DelModeWatcher(re); + ServerInstance->Modes->DelModeWatcher(re); DELETE(re); } |