X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fextra%2Fm_sqlauth.cpp;h=7130439e0537ad93e4e3d5a21486b6bb68c425fd;hb=c662a37341e9787ca8c5e553b3d641a19e3b81c8;hp=1aba468d4fc1ac5156d77a8ee4abfb418973f8f1;hpb=bcac49dca78631687975771c6d0a76b595171664;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp index 1aba468d4..7130439e0 100644 --- a/src/modules/extra/m_sqlauth.cpp +++ b/src/modules/extra/m_sqlauth.cpp @@ -2,13 +2,9 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd is copyright (C) 2002-2004 ChatSpike-Dev. - * E-mail: - * - * - * - * - * Written by Craig Edwards, Craig McLure, and others. + * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * See: http://www.inspircd.org/wiki/index.php/Credits + * * This program is free but copyrighted software; see * the file COPYING for details. * @@ -16,7 +12,6 @@ */ #include - #include "users.h" #include "channels.h" #include "modules.h" @@ -32,6 +27,7 @@ class ModuleSQLAuth : public Module { InspIRCd* Srv; Module* SQLutils; + Module* SQLprovider; std::string usertable; std::string userfield; @@ -47,19 +43,20 @@ public: ModuleSQLAuth(InspIRCd* Me) : Module::Module(Me), Srv(Me) { - SQLutils = Srv->FindFeature("SQLutils"); - - if(SQLutils) - { - ServerInstance->Log(DEBUG, "Successfully got SQLutils pointer"); - } - else - { - ServerInstance->Log(DEFAULT, "ERROR: This module requires a module offering the 'SQLutils' feature (usually m_sqlutils.so). Please load it and try again."); - throw ModuleException("This module requires a module offering the 'SQLutils' feature (usually m_sqlutils.so). Please load it and try again."); - } - - OnRehash(""); + ServerInstance->UseInterface("SQLutils"); + ServerInstance->UseInterface("SQL"); + + SQLutils = ServerInstance->FindModule("m_sqlutils.so"); + if (!SQLutils) + throw ModuleException("Can't find m_sqlutils.so. Please load m_sqlutils.so before m_sqlauth.so."); + + OnRehash(NULL,""); + } + + virtual ~ModuleSQLAuth() + { + ServerInstance->DoneWithInterface("SQL"); + ServerInstance->DoneWithInterface("SQLutils"); } void Implements(char* List) @@ -67,7 +64,7 @@ public: List[I_OnUserDisconnect] = List[I_OnCheckReady] = List[I_OnRequest] = List[I_OnRehash] = List[I_OnUserRegister] = 1; } - virtual void OnRehash(const std::string ¶meter) + virtual void OnRehash(userrec* user, const std::string ¶meter) { ConfigReader Conf(Srv); @@ -214,10 +211,6 @@ public: return user->GetExt("sqlauthed"); } - virtual ~ModuleSQLAuth() - { - } - virtual Version GetVersion() { return Version(1,1,1,0,VF_VENDOR,API_VERSION);