X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmodules%2Fm_sqllog.cpp;h=30f0c6b1039c1f1208f9ffbcf1cb8ba67584c62c;hb=f91a61fa22b239384c31526fd11da1e3030aaa96;hp=9b019f931fbf1a2c6872b46174e3430922a08ce3;hpb=dbf4d595433ecefeb61f1267ffa515a91c3ab548;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_sqllog.cpp b/src/modules/m_sqllog.cpp index 9b019f931..30f0c6b10 100644 --- a/src/modules/m_sqllog.cpp +++ b/src/modules/m_sqllog.cpp @@ -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 ¶meters, User *user, bool validated, const std::string &original_line) + virtual ModResult OnPreCommand(std::string &command, std::vector ¶meters, 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); } };