diff options
author | Adam <Adam@anope.org> | 2017-10-22 17:16:40 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2017-10-22 17:16:40 -0400 |
commit | b3c052b2fd9e581dd1c3bfebf47c132683659667 (patch) | |
tree | 5c5ab9e2ca4b8b4c3324896fb3d98f84ea196ec3 /modules | |
parent | 14235cf938f1b93211f2d7538c3d3a39a64341e5 (diff) |
chanserv/log: uncomment/fix
Diffstat (limited to 'modules')
-rw-r--r-- | modules/chanserv/log.cpp | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/modules/chanserv/log.cpp b/modules/chanserv/log.cpp index ce6c378d3..af6c1b107 100644 --- a/modules/chanserv/log.cpp +++ b/modules/chanserv/log.cpp @@ -142,9 +142,9 @@ Anope::string LogSettingImpl::GetCreator() return Get(&LogSettingType::creator); } -void LogSettingImpl::SetCreator(const Anope::string &creator) +void LogSettingImpl::SetCreator(const Anope::string &c) { - Set(&LogSettingType::extra, creator); + Set(&LogSettingType::creator, c); } time_t LogSettingImpl::GetCreated() @@ -432,49 +432,50 @@ class CSLog : public Module } } - void OnLog(Logger *l) override + void OnLog(Logger *logger) override { -#warning "fix log" -#if 0 - if (l->type != LogType::COMMAND || l->u == NULL || l->c == NULL || l->ci == NULL || !Me || !Me->IsSynced()) + User *user = logger->GetUser(); + ChanServ::Channel *channel = logger->GetCi(); + Command *command = logger->GetCommand(); + CommandSource *source = logger->GetSource(); + + if (logger->GetType() != LogType::COMMAND || user == nullptr || command == nullptr || channel == nullptr || !Me || !Me->IsSynced()) return; - std::vector<LogSetting *> ls = l->ci->GetRefs<LogSetting *>(); - for (unsigned i = 0; i < ls.size(); ++i) - { - LogSetting *log = ls[i]; + Channel *c = channel->GetChannel(); + for (LogSetting *log : channel->GetRefs<LogSetting *>()) + { /* wrong command */ - if (log->GetServiceName() != l->c->GetName()) + if (log->GetServiceName() != command->GetName()) continue; /* if a command name is given check the service and the command */ if (!log->GetCommandName().empty()) { /* wrong service (only check if not a fantasy command, though) */ - if (!l->source->c && log->GetCommandService() != l->source->service->nick) + if (!source->c && log->GetCommandService() != source->service->nick) continue; - if (!log->GetCommandName().equals_ci(l->source->command)) + if (!log->GetCommandName().equals_ci(source->GetCommand())) continue; } - Anope::string buffer = l->u->nick + " used " + l->source->command.upper() + " " + l->buf.str(); + const Anope::string &buffer = logger->GetMaskedMessage(); - if (log->GetMethod().equals_ci("MEMO") && memoserv && l->ci->WhoSends() != NULL) - memoserv->Send(l->ci->WhoSends()->nick, l->ci->GetName(), buffer, true); - else if (l->source->c) + if (log->GetMethod().equals_ci("MEMO") && memoserv && channel->WhoSends() != NULL) + memoserv->Send(channel->WhoSends()->nick, channel->GetName(), buffer, true); + else if (source->c) /* Sending a channel message or notice in response to a fantasy command */; - else if (log->GetMethod().equals_ci("MESSAGE") && l->ci->c) + else if (log->GetMethod().equals_ci("MESSAGE") && c) { - IRCD->SendPrivmsg(l->ci->WhoSends(), log->GetExtra() + l->ci->c->name, buffer); + IRCD->SendPrivmsg(channel->WhoSends(), log->GetExtra() + c->name, "{0}", buffer); #warning "fix idletimes" //l->ci->WhoSends()->lastmsg = Anope::CurTime; } - else if (log->GetMethod().equals_ci("NOTICE") && l->ci->c) - IRCD->SendNotice(l->ci->WhoSends(), log->GetExtra() + l->ci->c->name, buffer); + else if (log->GetMethod().equals_ci("NOTICE") && c) + IRCD->SendNotice(channel->WhoSends(), log->GetExtra() + c->name, "{0}", buffer); } -#endif } }; |