From: peavey Date: Fri, 29 Dec 2006 01:44:14 +0000 (+0000) Subject: Forgot to init it, clean up mem leakage too and log X-Lines proper. X-Git-Tag: v2.0.23~6234 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=bca5d9a8024fcdc3c6dcb94e16a39b506b8f6bcb;p=user%2Fhenk%2Fcode%2Finspircd.git Forgot to init it, clean up mem leakage too and log X-Lines proper. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6151 e03df62e-2008-0410-955e-edbf42e46eb7 --- diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index 867e07ff6..ca3c80a96 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -238,6 +238,7 @@ class QueryInfo } break; case DONE: + delete active_queries[req.id]; active_queries[req.id] = NULL; break; } @@ -262,7 +263,9 @@ class ModuleSQLLog : public Module if (!SQLutils) throw ModuleException("Can't find m_sqlutils.so. Please load m_sqlutils.so before m_sqlauth.so."); - ReadConfig(); + SQLModule = Srv->FindFeature("SQL"); + + OnRehash(""); MyMod = this; active_queries.clear(); } @@ -273,12 +276,6 @@ class ModuleSQLLog : public Module 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; @@ -286,6 +283,12 @@ class ModuleSQLLog : public Module List[I_OnUserQuit] = List[I_OnLoadModule] = List[I_OnRequest] = 1; } + void ReadConfig() + { + ConfigReader Conf(Srv); + dbid = Conf.ReadValue("sqllog","dbid",0); // database id of a database configured in sql module + } + virtual void OnRehash(const std::string ¶meter) { ReadConfig(); @@ -293,7 +296,6 @@ class ModuleSQLLog : public Module virtual char* OnRequest(Request* request) { - ServerInstance->Log(DEBUG,"OnRequest in m_sqllog.so"); if(strcmp(SQLRESID, request->GetId()) == 0) { SQLresult* res; @@ -312,8 +314,13 @@ class ModuleSQLLog : public Module std::map::iterator n = active_queries.find(res->id); active_queries.erase(n); } + + return SQLSUCCESS; } - return SQLSUCCESS; + + ServerInstance->Log(DEBUG, "Got unsupported API version string: %s", request->GetId()); + + return NULL; } void AddLogEntry(int category, const std::string &nick, const std::string &host, const std::string &source) @@ -359,7 +366,7 @@ class ModuleSQLLog : public Module virtual int OnPreCommand(const std::string &command, const char** parameters, int pcnt, userrec *user, bool validated, const std::string &original_line) { - if ((command == "GLINE") || (command == "KLINE") || (command == "ELINE") || (command == "ZLINE")) + if ((command == "GLINE" || command == "KLINE" || command == "ELINE" || command == "ZLINE") && validated) { AddLogEntry(LT_XLINE,user->nick,command[0]+std::string(":")+std::string(parameters[0]),user->server); }