diff options
author | Adam <Adam@anope.org> | 2017-12-03 16:43:41 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2017-12-03 16:43:41 -0500 |
commit | defddcd152b9d1dfa728c3a88e887bc8ffe889d4 (patch) | |
tree | 13e80dfff90f52f5c01afb93c250fccb49aa8149 /modules/extra/sql_log.cpp | |
parent | e66c00a316875e3ee4f4f3abca3f21db319c7a63 (diff) |
sql_log: fix build
Diffstat (limited to 'modules/extra/sql_log.cpp')
-rw-r--r-- | modules/extra/sql_log.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/modules/extra/sql_log.cpp b/modules/extra/sql_log.cpp index a02d63b8c..11c8ebd1a 100644 --- a/modules/extra/sql_log.cpp +++ b/modules/extra/sql_log.cpp @@ -28,6 +28,7 @@ class SQLLog : public Module public: SQLLog(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR | EXTRA) + , EventHook<Event::LogMessage>(this) { } @@ -37,7 +38,7 @@ class SQLLog : public Module this->table = config->Get<Anope::string>("table", "logs"); } - void OnLogMessage(LogInfo *li, const Log *l, const Anope::string &msg) override + void OnLogMessage(LogInfo *li, const Logger *l, const Anope::string &msg) override { Anope::string ref_name; ServiceReference<SQL::Provider> SQL; @@ -49,7 +50,7 @@ class SQLLog : public Module if (!sz) { ref_name = target.substr(8); - SQL = ServiceReference<SQL::Provider>("SQL::Provider", ref_name); + SQL = ServiceReference<SQL::Provider>(ref_name); break; } } @@ -77,7 +78,7 @@ class SQLLog : public Module SQL::Query insert("INSERT INTO `" + table + "` (`type`,`user`,`acc`,`command`,`channel`,`msg`)" "VALUES (@type@, @user@, @acc@, @command@, @channel@, @msg@)"); - switch (l->type) + switch (l->GetType()) { case LogType::ADMIN: insert.SetValue("type", "ADMIN"); @@ -107,10 +108,18 @@ class SQLLog : public Module return; } - insert.SetValue("user", l->u ? l->u->nick : ""); - insert.SetValue("acc", l->nc ? l->nc->GetDisplay() : ""); - insert.SetValue("command", l->c ? l->c->name : ""); - insert.SetValue("channel", l->ci ? l->ci->GetName() : ""); + User *u = l->GetUser(); + insert.SetValue("user", u ? u->nick : ""); + + NickServ::Account *acc = l->GetAccount(); + insert.SetValue("acc", acc ? acc->GetDisplay() : ""); + + Command *cmd = l->GetCommand(); + insert.SetValue("command", cmd ? cmd->GetName() : ""); + + ChanServ::Channel *ci = l->GetCi(); + insert.SetValue("channel", ci ? ci->GetName() : ""); + insert.SetValue("msg", msg); SQL->Run(NULL, insert); |