X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fextra%2Fm_sqllog.cpp;h=556cc8b31c33f04bd2ee806571b67213de21b392;hb=7d93921aabd9c608821baec8a871aff844dfae49;hp=e57e40354da514d0c1a24d50e2aac07f96acd4d4;hpb=fa933d7bdcb3e5fecce260f5456a00dda80f21e2;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index e57e40354..556cc8b31 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -2,8 +2,8 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2008 InspIRCd Development Team - * See: http://www.inspircd.org/wiki/index.php/Credits + * InspIRCd: (C) 2002-2009 InspIRCd Development Team + * See: http://wiki.inspircd.org/Credits * * This program is free but copyrighted software; see * the file COPYING for details. @@ -28,6 +28,8 @@ std::map active_queries; class QueryInfo { +private: + InspIRCd* ServerInstance; public: QueryState qs; unsigned long id; @@ -41,8 +43,9 @@ public: time_t date; bool insert; - QueryInfo(const std::string &n, const std::string &s, const std::string &h, unsigned long i, int cat) + QueryInfo(InspIRCd* Instance, const std::string &n, const std::string &s, const std::string &h, unsigned long i, int cat) { + ServerInstance = Instance; qs = FIND_SOURCE; nick = n; source = s; @@ -50,7 +53,7 @@ public: id = i; category = cat; sourceid = nickid = hostid = -1; - date = time(NULL); + date = ServerInstance->Time(); insert = false; } @@ -192,7 +195,7 @@ class ModuleSQLLog : public Module SQLModule = ServerInstance->Modules->FindFeature("SQL"); - OnRehash(NULL,""); + OnRehash(NULL); MyMod = this; active_queries.clear(); @@ -214,7 +217,7 @@ class ModuleSQLLog : public Module dbid = Conf.ReadValue("sqllog","dbid",0); // database id of a database configured in sql module } - virtual void OnRehash(User* user, const std::string ¶meter) + virtual void OnRehash(User* user) { ReadConfig(); } @@ -250,7 +253,7 @@ class ModuleSQLLog : public Module SQLrequest req = SQLrequest(this, SQLModule, dbid, SQLquery("SELECT id,actor FROM ircd_log_actors WHERE actor='?'") % source); if(req.Send()) { - QueryInfo* i = new QueryInfo(nick, source, host, req.id, category); + QueryInfo* i = new QueryInfo(ServerInstance, nick, source, host, req.id, category); i->qs = FIND_SOURCE; active_queries[req.id] = i; } @@ -266,19 +269,19 @@ class ModuleSQLLog : public Module AddLogEntry(LT_OPER,user->nick,user->host,user->server); } - virtual int OnKill(User* source, User* dest, const std::string &reason) + virtual ModResult OnKill(User* source, User* dest, const std::string &reason) { AddLogEntry(LT_KILL,dest->nick,dest->host,source->nick); - return 0; + return MOD_RES_PASSTHRU; } - virtual int 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, User *user, bool validated, const std::string &original_line) { if ((command == "GLINE" || command == "KLINE" || command == "ELINE" || command == "ZLINE") && validated) { AddLogEntry(LT_XLINE,user->nick,command[0]+std::string(":")+parameters[0],user->server); } - return 0; + return MOD_RES_PASSTHRU; } virtual void OnUserConnect(User* user) @@ -298,7 +301,7 @@ class ModuleSQLLog : public Module virtual Version GetVersion() { - return Version("$Id$", VF_VENDOR, API_VERSION); + return Version("Logs network-wide data to an SQL database", VF_VENDOR, API_VERSION); } };