From 4700c1df2dfd616a0e8dba06144224c6e0aa52ac Mon Sep 17 00:00:00 2001 From: peavey Date: Fri, 29 Dec 2006 00:05:19 +0000 Subject: Also using new interface methods, and maybe less crashage. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6150 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/extra/m_sqllog.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'src/modules/extra') diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index b284e10cf..867e07ff6 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -252,26 +252,33 @@ class ModuleSQLLog : public Module ConfigReader* Conf; public: - bool ReadConfig() - { - ConfigReader Conf(Srv); - - dbid = Conf.ReadValue("sqllog","dbid",0); // database id of a database configured in sql module - - SQLModule = Srv->FindFeature("SQL"); - if (!SQLModule) - ServerInstance->Log(DEFAULT,"WARNING: m_sqllog.so could not initialize because an SQL module is not loaded. Load the module and rehash your server."); - return (SQLModule); - } - ModuleSQLLog(InspIRCd* Me) : Module::Module(Me), Srv(Me) { + ServerInstance->UseInterface("SQLutils"); + ServerInstance->UseInterface("SQL"); + + Module* 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."); + ReadConfig(); MyMod = this; active_queries.clear(); } + virtual ~ModuleSQLLog() + { + ServerInstance->DoneWithInterface("SQL"); + ServerInstance->DoneWithInterface("SQLutils"); + } + + void ReadConfig() + { + ConfigReader Conf(Srv); + dbid = Conf.ReadValue("sqllog","dbid",0); // database id of a database configured in sql module + } + void Implements(char* List) { List[I_OnRehash] = List[I_OnOper] = List[I_OnGlobalOper] = List[I_OnKill] = 1; @@ -374,10 +381,6 @@ class ModuleSQLLog : public Module AddLogEntry(LT_LOADMODULE,name,Srv->Config->ServerName, Srv->Config->ServerName); } - virtual ~ModuleSQLLog() - { - } - virtual Version GetVersion() { return Version(1,1,0,1,VF_VENDOR,API_VERSION); -- cgit v1.2.3