]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_sqllog.cpp
Add Base64 encode/decode functions to the core
[user/henk/code/inspircd.git] / src / modules / m_sqllog.cpp
index 9b019f931fbf1a2c6872b46174e3430922a08ce3..30f0c6b1039c1f1208f9ffbcf1cb8ba67584c62c 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
  * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
@@ -156,32 +156,25 @@ class ModuleSQLLog : public Module
 
  public:
        ModuleSQLLog()
-               {
-               ServerInstance->Modules->UseInterface("SQLutils");
-               ServerInstance->Modules->UseInterface("SQL");
-
+       {
                Module* SQLutils = ServerInstance->Modules->Find("m_sqlutils.so");
                if (!SQLutils)
                        throw ModuleException("Can't find m_sqlutils.so. Please load m_sqlutils.so before m_sqlauth.so.");
 
-               SQLModule = ServerInstance->Modules->FindFeature("SQL");
+               ServiceProvider* prov = ServerInstance->Modules->FindService(SERVICE_DATA, "SQL");
+               if (!prov)
+                       throw ModuleException("Can't find an SQL provider module. Please load one before attempting to load m_sqlauth.");
+               SQLModule = prov->creator;
 
                OnRehash(NULL);
                MyMod = this;
                active_queries.clear();
 
                Implementation eventlist[] = { I_OnRehash, I_OnOper, I_OnGlobalOper, I_OnKill,
-                       I_OnPreCommand, I_OnUserConnect, I_OnUserQuit, I_OnLoadModule };
+                       I_OnPreCommand, I_OnUserRegister, I_OnUserQuit, I_OnLoadModule };
                ServerInstance->Modules->Attach(eventlist, this, 8);
        }
 
-       virtual ~ModuleSQLLog()
-       {
-               ServerInstance->Modules->DoneWithInterface("SQL");
-               ServerInstance->Modules->DoneWithInterface("SQLutils");
-       }
-
-
        void ReadConfig()
        {
                ConfigReader Conf;
@@ -239,7 +232,7 @@ class ModuleSQLLog : public Module
                return MOD_RES_PASSTHRU;
        }
 
-       virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
+       virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, LocalUser *user, bool validated, const std::string &original_line)
        {
                if ((command == "GLINE" || command == "KLINE" || command == "ELINE" || command == "ZLINE") && validated)
                {
@@ -248,9 +241,10 @@ class ModuleSQLLog : public Module
                return MOD_RES_PASSTHRU;
        }
 
-       virtual void OnUserConnect(User* user)
+       virtual ModResult OnUserRegister(LocalUser* user)
        {
                AddLogEntry(LT_CONNECT,user->nick,user->host,user->server);
+               return MOD_RES_PASSTHRU;
        }
 
        virtual void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message)
@@ -265,7 +259,7 @@ class ModuleSQLLog : public Module
 
        virtual Version GetVersion()
        {
-               return Version("Logs network-wide data to an SQL database", VF_VENDOR, API_VERSION);
+               return Version("Logs network-wide data to an SQL database", VF_VENDOR);
        }
 
 };