diff options
author | om <om@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-11 08:58:36 +0000 |
---|---|---|
committer | om <om@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-11 08:58:36 +0000 |
commit | b6e38f0c4ac668369f775fb87739c580d4eb0c28 (patch) | |
tree | f10a838577a330f9559e1265808af51597e6f60b /src/modules | |
parent | 85ed944a30024f3a71b37381054771ad9da92f91 (diff) |
New API update
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4870 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/extra/m_sqlauth.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp index 17d4f69ac..a5c7d5395 100644 --- a/src/modules/extra/m_sqlauth.cpp +++ b/src/modules/extra/m_sqlauth.cpp @@ -27,11 +27,9 @@ /* $ModDesc: Allow/Deny connections based upon an arbitary SQL table */ -extern InspIRCd* ServerInstance; - class ModuleSQLAuth : public Module { - Server* Srv; + InspIRCd* Srv; Module* SQLutils; std::string usertable; @@ -46,9 +44,9 @@ class ModuleSQLAuth : public Module public: ModuleSQLAuth(InspIRCd* Me) - : Module::Module(Me) + : Module::Module(Me), Srv(Me) { - SQLutils = ServerInstance->FindFeature("SQLutils"); + SQLutils = Srv->FindFeature("SQLutils"); if(SQLutils) { @@ -70,7 +68,7 @@ public: virtual void OnRehash(const std::string ¶meter) { - ConfigReader Conf; + ConfigReader Conf(Srv); usertable = Conf.ReadValue("sqlauth", "usertable", 0); /* User table name */ databaseid = Conf.ReadValue("sqlauth", "dbid", 0); /* Database ID, given to the SQL service provider */ @@ -96,7 +94,7 @@ public: if (!CheckCredentials(user)) { - userrec::QuitUser(ServerInstance,user,killreason); + userrec::QuitUser(Srv,user,killreason); } } @@ -104,7 +102,7 @@ public: { Module* target; - target = ServerInstance->FindFeature("SQL"); + target = Srv->FindFeature("SQL"); if(target) { @@ -130,7 +128,7 @@ public: log(DEBUG, "SQLrequest failed: %s", req.error.Str()); if (verbose) - ServerInstance->WriteOpers("Forbidden connection from %s!%s@%s (SQL query failed: %s)", user->nick, user->ident, user->host, req.error.Str()); + Srv->WriteOpers("Forbidden connection from %s!%s@%s (SQL query failed: %s)", user->nick, user->ident, user->host, req.error.Str()); return false; } @@ -170,14 +168,14 @@ public: else if (verbose) { /* No rows in result, this means there was no record matching the user */ - ServerInstance->WriteOpers("Forbidden connection from %s!%s@%s (SQL query returned no matches)", user->nick, user->ident, user->host); + Srv->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) { log(DEBUG, "Query failed: %s", res->error.Str()); - ServerInstance->WriteOpers("Forbidden connection from %s!%s@%s (SQL query failed: %s)", user->nick, user->ident, user->host, res->error.Str()); + Srv->WriteOpers("Forbidden connection from %s!%s@%s (SQL query failed: %s)", user->nick, user->ident, user->host, res->error.Str()); user->Extend("sqlauth_failed"); } } @@ -204,7 +202,7 @@ public: { if(user->GetExt("sqlauth_failed")) { - userrec::QuitUser(ServerInstance,user,killreason); + userrec::QuitUser(Srv,user,killreason); return false; } |