diff options
Diffstat (limited to 'modules/commands/cs_log.cpp')
-rw-r--r-- | modules/commands/cs_log.cpp | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/modules/commands/cs_log.cpp b/modules/commands/cs_log.cpp index 03342ebcf..39e6a31b5 100644 --- a/modules/commands/cs_log.cpp +++ b/modules/commands/cs_log.cpp @@ -11,6 +11,7 @@ #include "module.h" #include "modules/cs_log.h" +#include "modules/memoserv.h" struct LogSettingImpl : LogSetting, Serializable { @@ -20,7 +21,7 @@ struct LogSettingImpl : LogSetting, Serializable ~LogSettingImpl() { - ChannelInfo *ci = ChannelInfo::Find(chan); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci) { LogSettings *ls = ci->GetExt<LogSettings>("logsettings"); @@ -33,7 +34,7 @@ struct LogSettingImpl : LogSetting, Serializable } } - void Serialize(Serialize::Data &data) const anope_override + void Serialize(Serialize::Data &data) const override { data["ci"] << chan; data["service_name"] << service_name; @@ -50,10 +51,10 @@ struct LogSettingImpl : LogSetting, Serializable Anope::string sci; data["ci"] >> sci; - ChannelInfo *ci = ChannelInfo::Find(sci); + ChanServ::Channel *ci = ChanServ::Find(sci); if (ci == NULL) return NULL; - + LogSettingImpl *ls; if (obj) ls = anope_dynamic_static_cast<LogSettingImpl *>(obj); @@ -91,7 +92,7 @@ struct LogSettingsImpl : LogSettings } } - LogSetting *Create() anope_override + LogSetting *Create() override { return new LogSettingImpl(); } @@ -107,11 +108,11 @@ public: this->SetSyntax(_("\037channel\037 \037command\037 \037method\037 [\037status\037]")); } - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { const Anope::string &channel = params[0]; - ChannelInfo *ci = ChannelInfo::Find(channel); + ChanServ::Channel *ci = ChanServ::Find(channel); if (ci == NULL) source.Reply(CHAN_X_NOT_REGISTERED, channel.c_str()); else if (!source.AccessFor(ci).HasPriv("SET") && !source.HasPriv("chanserv/administration")) @@ -251,7 +252,7 @@ public: this->OnSyntaxError(source, ""); } - bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override + bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { this->SendSyntax(source); source.Reply(" "); @@ -280,8 +281,9 @@ public: }; class CSLog : public Module + , public EventHook<Event::ChanRegistered> + , public EventHook<Event::Log> { - ServiceReference<MemoServService> MSService; CommandCSLog commandcslog; ExtensibleItem<LogSettingsImpl> logsettings; Serialize::Type logsetting_type; @@ -294,14 +296,17 @@ class CSLog : public Module std::vector<LogDefault> defaults; public: - CSLog(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), - MSService("MemoServService", "MemoServ"), commandcslog(this), - logsettings(this, "logsettings"), logsetting_type("LogSetting", LogSettingImpl::Unserialize) + CSLog(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR) + , EventHook<Event::ChanRegistered>("OnChanRegistered") + , EventHook<Event::Log>("OnLog") + , commandcslog(this) + , logsettings(this, "logsettings") + , logsetting_type("LogSetting", LogSettingImpl::Unserialize) { } - void OnReload(Configuration::Conf *conf) anope_override + void OnReload(Configuration::Conf *conf) override { Configuration::Block *block = conf->GetModule(this); defaults.clear(); @@ -320,7 +325,7 @@ class CSLog : public Module } } - void OnChanRegistered(ChannelInfo *ci) anope_override + void OnChanRegistered(ChanServ::Channel *ci) override { if (defaults.empty()) return; @@ -353,7 +358,7 @@ class CSLog : public Module } } - void OnLog(Log *l) anope_override + void OnLog(::Log *l) override { if (l->type != LOG_COMMAND || l->u == NULL || l->c == NULL || l->ci == NULL || !Me || !Me->IsSynced()) return; @@ -381,14 +386,14 @@ class CSLog : public Module Anope::string buffer = l->u->nick + " used " + l->source->command.upper() + " " + l->buf.str(); - if (log->method.equals_ci("MEMO") && MSService && l->ci->WhoSends() != NULL) - MSService->Send(l->ci->WhoSends()->nick, l->ci->name, buffer, true); + if (log->method.equals_ci("MEMO") && MemoServ::service && l->ci->WhoSends() != NULL) + MemoServ::service->Send(l->ci->WhoSends()->nick, l->ci->name, buffer, true); else if (l->source->c) /* Sending a channel message or notice in response to a fantasy command */; else if (log->method.equals_ci("MESSAGE") && l->ci->c) { IRCD->SendPrivmsg(l->ci->WhoSends(), log->extra + l->ci->c->name, "%s", buffer.c_str()); - l->ci->WhoSends()->lastmsg = Anope::CurTime; + //l->ci->WhoSends()->lastmsg = Anope::CurTime; } else if (log->method.equals_ci("NOTICE") && l->ci->c) IRCD->SendNotice(l->ci->WhoSends(), log->extra + l->ci->c->name, "%s", buffer.c_str()); |