* | 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.
*/
#include "inspircd.h"
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
-#include "configreader.h"
#include "m_sqlv2.h"
static Module* SQLModule;
class QueryInfo
{
+private:
+ InspIRCd* ServerInstance;
public:
QueryState qs;
unsigned long id;
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;
id = i;
category = cat;
sourceid = nickid = hostid = -1;
- date = time(NULL);
+ date = ServerInstance->Time();
insert = false;
}
public:
ModuleSQLLog(InspIRCd* Me)
- : Module::Module(Me)
+ : Module(Me)
{
ServerInstance->Modules->UseInterface("SQLutils");
ServerInstance->Modules->UseInterface("SQL");
SQLModule = ServerInstance->Modules->FindFeature("SQL");
- OnRehash(NULL,"");
+ OnRehash(NULL);
MyMod = this;
active_queries.clear();
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();
}
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;
}
return 0;
}
- virtual int OnPreCommand(const std::string &command, const char* const* parameters, int pcnt, User *user, bool validated, const std::string &original_line)
+ virtual int OnPreCommand(std::string &command, std::vector<std::string> ¶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(":")+std::string(parameters[0]),user->server);
+ AddLogEntry(LT_XLINE,user->nick,command[0]+std::string(":")+parameters[0],user->server);
}
return 0;
}
virtual Version GetVersion()
{
- return Version(1,1,0,1,VF_VENDOR,API_VERSION);
+ return Version("$Id$", VF_VENDOR, API_VERSION);
}
-
+
};
MODULE_INIT(ModuleSQLLog)