diff options
author | om <om@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-11 09:08:23 +0000 |
---|---|---|
committer | om <om@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-11 09:08:23 +0000 |
commit | 488932d457b16a778d75cf2a8213dd9a94058403 (patch) | |
tree | 95c493380e27300194dd62ce7d3eb8ece3d5aa4f | |
parent | 6a9fbfda45b80ab953e15cb7e5f883b7f6f970af (diff) |
New API update
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4872 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/modules/extra/m_sqloper.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index 9a2422aa8..e0cba9160 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -28,19 +28,17 @@ /* $ModDesc: Allows storage of oper credentials in an SQL table */ -extern InspIRCd* ServerInstance; - class ModuleSQLOper : public Module { - Server* Srv; + InspIRCd* Srv; Module* SQLutils; std::string databaseid; public: ModuleSQLOper(InspIRCd* Me) - : Module::Module(Me) + : Module::Module(Me), Srv(Me) { - SQLutils = ServerInstance->FindFeature("SQLutils"); + SQLutils = Srv->FindFeature("SQLutils"); if (SQLutils) { @@ -57,7 +55,7 @@ public: virtual void OnRehash(const std::string ¶meter) { - ConfigReader Conf; + ConfigReader Conf(Srv); databaseid = Conf.ReadValue("sqloper", "dbid", 0); /* Database ID of a database configured for the service provider module */ } @@ -87,7 +85,7 @@ public: { Module* target; - target = ServerInstance->FindFeature("SQL"); + target = Srv->FindFeature("SQL"); if (target) { @@ -176,7 +174,7 @@ public: */ user->WriteServ( "491 %s :Invalid oper credentials", user->nick); - ServerInstance->WriteOpers("*** WARNING! Failed oper attempt by %s!%s@%s!", user->nick, user->ident, user->host); + Srv->WriteOpers("*** WARNING! Failed oper attempt by %s!%s@%s!", user->nick, user->ident, user->host); log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: user, host or password did not match.", user->nick, user->ident, user->host); } } @@ -189,7 +187,7 @@ public: log(DEBUG, "Query failed: %s", res->error.Str()); user->WriteServ( "491 %s :Invalid oper credentials", user->nick); - ServerInstance->WriteOpers("*** WARNING! Failed oper attempt by %s!%s@%s! (SQL query failed: %s)", user->nick, user->ident, user->host, res->error.Str()); + Srv->WriteOpers("*** WARNING! Failed oper attempt by %s!%s@%s! (SQL query failed: %s)", user->nick, user->ident, user->host, res->error.Str()); log(DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: user, host or password did not match.", user->nick, user->ident, user->host); } } @@ -208,7 +206,7 @@ public: bool OperUser(userrec* user, const std::string &username, const std::string &password, const std::string &pattern, const std::string &type) { - ConfigReader Conf; + ConfigReader Conf(Srv); for (int j = 0; j < Conf.Enumerate("type"); j++) { @@ -229,7 +227,7 @@ public: if (operhost.size()) user->ChangeDisplayedHost(operhost.c_str()); - ServerInstance->WriteOpers("*** %s (%s@%s) is now an IRC operator of type %s", user->nick, user->ident, user->host, type.c_str()); + Srv->WriteOpers("*** %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]) |