]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_sqlauth.cpp
pgsql should now work thx to added posibility to force a fd out of the socketengine...
[user/henk/code/inspircd.git] / src / modules / extra / m_sqlauth.cpp
index 8b02bed69a9bdebe2b7f0cab1b2360f12c9e2f1b..7130439e0537ad93e4e3d5a21486b6bb68c425fd 100644 (file)
@@ -12,7 +12,6 @@
  */
 
 #include <string>
-
 #include "users.h"
 #include "channels.h"
 #include "modules.h"
@@ -28,6 +27,7 @@ class ModuleSQLAuth : public Module
 {
        InspIRCd* Srv;
        Module* SQLutils;
+       Module* SQLprovider;
 
        std::string usertable;
        std::string userfield;
@@ -43,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)
@@ -63,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 &parameter)
+       virtual void OnRehash(userrec* user, const std::string &parameter)
        {
                ConfigReader Conf(Srv);
                
@@ -210,10 +211,6 @@ public:
                return user->GetExt("sqlauthed");
        }
 
-       virtual ~ModuleSQLAuth()
-       {
-       }
-       
        virtual Version GetVersion()
        {
                return Version(1,1,1,0,VF_VENDOR,API_VERSION);