summaryrefslogtreecommitdiff
path: root/modules/chanserv
diff options
context:
space:
mode:
Diffstat (limited to 'modules/chanserv')
-rw-r--r--modules/chanserv/access.cpp15
-rw-r--r--modules/chanserv/akick.cpp36
-rw-r--r--modules/chanserv/ban.cpp4
-rw-r--r--modules/chanserv/clone.cpp3
-rw-r--r--modules/chanserv/drop.cpp3
-rw-r--r--modules/chanserv/enforce.cpp12
-rw-r--r--modules/chanserv/entrymsg.cpp13
-rw-r--r--modules/chanserv/flags.cpp18
-rw-r--r--modules/chanserv/getkey.cpp2
-rw-r--r--modules/chanserv/invite.cpp4
-rw-r--r--modules/chanserv/kick.cpp4
-rw-r--r--modules/chanserv/list.cpp6
-rw-r--r--modules/chanserv/log.cpp32
-rw-r--r--modules/chanserv/main/channel.cpp10
-rw-r--r--modules/chanserv/main/chanserv.cpp20
-rw-r--r--modules/chanserv/mode.cpp12
-rw-r--r--modules/chanserv/register.cpp3
-rw-r--r--modules/chanserv/seen.cpp8
-rw-r--r--modules/chanserv/set.cpp85
-rw-r--r--modules/chanserv/set_misc.cpp8
-rw-r--r--modules/chanserv/suspend.cpp11
-rw-r--r--modules/chanserv/sync.cpp2
-rw-r--r--modules/chanserv/topic.cpp11
-rw-r--r--modules/chanserv/unban.cpp10
-rw-r--r--modules/chanserv/updown.cpp11
-rw-r--r--modules/chanserv/xop.cpp46
26 files changed, 242 insertions, 147 deletions
diff --git a/modules/chanserv/access.cpp b/modules/chanserv/access.cpp
index 967df9025..6ad67733e 100644
--- a/modules/chanserv/access.cpp
+++ b/modules/chanserv/access.cpp
@@ -213,7 +213,8 @@ class CommandCSAccess : public Command
EventManager::Get()->Dispatch(&Event::AccessAdd::OnAccessAdd, ci, source, access);
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to add " << mask << " with level " << level;
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to add {0} with level {1}"), mask, level);
+
if (p != NULL)
source.Reply(_("\002{0}\002 added to the access list of \002{1}\002 with privilege \002{2}\002 (level \002{3}\002)."), access->Mask(), ci->GetName(), p->name, level);
else
@@ -283,7 +284,7 @@ class CommandCSAccess : public Command
source.Reply(_("There are no entries matching \002{0}\002 on the access list of \002{1}\002."), mask, ci->GetName());
else
{
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << nicks;
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to delete {0}"), mask);
if (deleted == 1)
source.Reply(_("Deleted \0021\002 entry from the access list of \002{0}\002."), ci->GetName());
@@ -308,7 +309,7 @@ class CommandCSAccess : public Command
{
source.Reply(_("\002{0}\002 deleted from the access list of \002{1}\002."), access->Mask(), ci->GetName());
bool override = !u_access.founder && !u_access.HasPriv("ACCESS_CHANGE") && !access->Mask().equals_ci(source.nc->GetDisplay());
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << access->Mask();
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to delete {3}"), access->Mask());
EventManager::Get()->Dispatch(&Event::AccessDel::OnAccessDel, ci, source, access);
delete access;
@@ -458,7 +459,7 @@ class CommandCSAccess : public Command
source.Reply(_("The access list of \002{0}\002 has been cleared."), ci->GetName());
bool override = !source.IsFounder(ci);
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to clear the access list";
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to clear the access list"));
}
public:
@@ -672,7 +673,7 @@ class CommandCSLevels : public Command
else
{
bool override = !source.AccessFor(ci).HasPriv("FOUNDER");
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to set " << p->name << " to level " << level;
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to set {0} to level {1}"), p->name, level);
ci->SetLevel(p->name, level);
EventManager::Get()->Dispatch(&Event::LevelChange::OnLevelChange, source, ci, p->name, level);
@@ -699,7 +700,7 @@ class CommandCSLevels : public Command
if (p != NULL)
{
bool override = !source.AccessFor(ci).HasPriv("FOUNDER");
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable " << p->name;
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to disable {0}"), p->name);
ci->SetLevel(p->name, ChanServ::ACCESS_INVALID);
EventManager::Get()->Dispatch(&Event::LevelChange::OnLevelChange, source, ci, p->name, ChanServ::ACCESS_INVALID);
@@ -754,7 +755,7 @@ class CommandCSLevels : public Command
void DoReset(CommandSource &source, ChanServ::Channel *ci)
{
bool override = !source.AccessFor(ci).HasPriv("FOUNDER");
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to reset all levels";
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to reset all levels"));
ci->ClearLevels();
EventManager::Get()->Dispatch(&Event::LevelChange::OnLevelChange, source, ci, "ALL", 0);
diff --git a/modules/chanserv/akick.cpp b/modules/chanserv/akick.cpp
index 9338a4dd7..35bca6818 100644
--- a/modules/chanserv/akick.cpp
+++ b/modules/chanserv/akick.cpp
@@ -302,7 +302,10 @@ class CommandCSAKick : public Command
else
ak = ci->AddAkick(source.GetNick(), mask, reason);
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to add " << mask << (reason == "" ? "" : ": ") << reason;
+ if (reason.empty())
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to add {0}"), mask);
+ else
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to add {0} ({1})"), mask, reason);
EventManager::Get()->Dispatch(&Event::Akick::OnAkickAdd, source, ci, ak);
@@ -337,10 +340,11 @@ class CommandCSAKick : public Command
EventManager::Get()->Dispatch(&Event::Akick::OnAkickDel, source, ci, ak);
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << (ak->GetAccount() ? ak->GetAccount()->GetDisplay() : ak->GetMask());
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to delete {0}"),
+ ak->GetAccount() ? ak->GetAccount()->GetDisplay() : ak->GetMask());
++deleted;
- delete ak;
+ ak->Delete();
},
[&]()
{
@@ -357,29 +361,33 @@ class CommandCSAKick : public Command
{
NickServ::Nick *na = NickServ::FindNick(mask);
NickServ::Account *nc = na ? na->GetAccount() : nullptr;
+ AutoKick *match = nullptr;
- unsigned int i, end;
- for (i = 0, end = ci->GetAkickCount(); i < end; ++i)
+ for (unsigned int i = 0; i < ci->GetAkickCount(); ++i)
{
AutoKick *ak = ci->GetAkick(i);
if (ak->GetAccount() ? ak->GetAccount() == nc : mask.equals_ci(ak->GetMask()))
+ {
+ match = ak;
break;
+ }
}
- if (i == ci->GetAkickCount())
+ if (match == nullptr)
{
source.Reply(_("\002{0}\002 was not found on the auto kick list of \002{1}\002."), mask, ci->GetName());
return;
}
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << mask;
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to delete {0}"),
+ match->GetAccount() ? match->GetAccount()->GetDisplay() : match->GetMask());
- EventManager::Get()->Dispatch(&Event::Akick::OnAkickDel, source, ci, ci->GetAkick(i));
+ EventManager::Get()->Dispatch(&Event::Akick::OnAkickDel, source, ci, match);
- delete ci->GetAkick(i);
+ source.Reply(_("\002{0}\002 deleted from the auto kick list of \002{1}\002."), match->GetAccount() ? match->GetAccount()->GetDisplay() : match->GetMask(), ci->GetName());
- source.Reply(_("\002{0}\002 deleted from the auto kick list of \002{1}\002."), mask, ci->GetName());
+ match->Delete();
}
}
@@ -523,7 +531,8 @@ class CommandCSAKick : public Command
}
bool override = !source.AccessFor(ci).HasPriv("AKICK");
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "ENFORCE, affects " << count << " users";
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci,
+ _("{source} used {command} on {channel} to enforce the akick list, affects {0} users"), count);
source.Reply(_("Autokick enforce for \002{0}\002 complete; \002{1}\002 users were affected."), ci->GetName(), count);
}
@@ -531,7 +540,7 @@ class CommandCSAKick : public Command
void DoClear(CommandSource &source, ChanServ::Channel *ci)
{
bool override = !source.AccessFor(ci).HasPriv("AKICK");
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to clear the akick list";
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to clear the akick list"));
ci->ClearAkick();
source.Reply(_("The autokick list of \002{0}\002 has been cleared."), ci->GetName());
@@ -712,7 +721,8 @@ class CSAKick : public Module
if (kick)
{
- Log(LOG_DEBUG_2) << u->nick << " matched akick " << (ak->GetAccount() ? ak->GetAccount()->GetDisplay() : ak->GetMask());
+ logger.Debug2("{0} matched akick {1}", u->nick, ak->GetAccount() ? ak->GetAccount()->GetDisplay() : ak->GetMask());
+
ak->SetLastUsed(Anope::CurTime);
if (!ak->GetAccount() && ak->GetMask().find('#') == Anope::string::npos)
mask = ak->GetMask();
diff --git a/modules/chanserv/ban.cpp b/modules/chanserv/ban.cpp
index 2b73df8fb..d79afe071 100644
--- a/modules/chanserv/ban.cpp
+++ b/modules/chanserv/ban.cpp
@@ -152,7 +152,7 @@ class CommandCSBan : public Command
Anope::string mask = ci->GetIdealBan(u2);
bool override = !u_access.HasPriv("BAN") || (u != u2 && ci->IsPeace() && u2_access >= u_access);
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << mask;
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} for {0}"), mask);
if (!c->HasMode(mode, mask))
{
@@ -188,7 +188,7 @@ class CommandCSBan : public Command
Anope::string mask = IRCD->NormalizeMask(target);
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << mask;
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} for {0}"), mask);
if (!c->HasMode(mode, mask))
{
diff --git a/modules/chanserv/clone.cpp b/modules/chanserv/clone.cpp
index 8d0c1ce3a..343e6c5b2 100644
--- a/modules/chanserv/clone.cpp
+++ b/modules/chanserv/clone.cpp
@@ -209,7 +209,8 @@ public:
return;
}
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to clone " << (what.empty() ? "everything from it" : what) << " to " << target_ci->GetName();
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to clone {0} to {1}"),
+ what.empty() ? "everything from it" : what, target_ci->GetName());
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/chanserv/drop.cpp b/modules/chanserv/drop.cpp
index 77ab7e55e..122ac96b8 100644
--- a/modules/chanserv/drop.cpp
+++ b/modules/chanserv/drop.cpp
@@ -63,7 +63,8 @@ class CommandCSDrop : public Command
return;
bool override = (ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER"));
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "(founder was: " << (ci->GetFounder() ? ci->GetFounder()->GetDisplay() : "none") << ")";
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} (founder was: {0})"),
+ ci->GetFounder() ? ci->GetFounder()->GetDisplay() : "none");
Reference<Channel> c = ci->c;
ci->Delete();
diff --git a/modules/chanserv/enforce.cpp b/modules/chanserv/enforce.cpp
index e1d084075..8d41c7af3 100644
--- a/modules/chanserv/enforce.cpp
+++ b/modules/chanserv/enforce.cpp
@@ -25,7 +25,7 @@ class CommandCSEnforce : public Command
void DoSecureOps(CommandSource &source, ChanServ::Channel *ci)
{
bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify");
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enforce secureops";
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enforce secureops"));
/* Dirty hack to allow Channel::SetCorrectModes to work ok.
* We pretend like SECUREOPS is on so it doesn't ignore that
@@ -51,7 +51,7 @@ class CommandCSEnforce : public Command
void DoRestricted(CommandSource &source, ChanServ::Channel *ci)
{
bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify");
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enforce restricted";
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enforce restricted"));
std::vector<User *> users;
for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
@@ -82,7 +82,7 @@ class CommandCSEnforce : public Command
void DoRegOnly(CommandSource &source, ChanServ::Channel *ci)
{
bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify");
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enforce registered only";
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enforce registered only"));
std::vector<User *> users;
for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
@@ -114,7 +114,7 @@ class CommandCSEnforce : public Command
void DoSSLOnly(CommandSource &source, ChanServ::Channel *ci)
{
bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify");
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enforce SSL only";
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enforce SSL only"));
std::vector<User *> users;
for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
@@ -146,7 +146,7 @@ class CommandCSEnforce : public Command
void DoBans(CommandSource &source, ChanServ::Channel *ci)
{
bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify");
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enforce bans";
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enforce bans"));
std::vector<User *> users;
for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
@@ -175,7 +175,7 @@ class CommandCSEnforce : public Command
void DoLimit(CommandSource &source, ChanServ::Channel *ci)
{
bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify");
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enforce limit";
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enforce limit"));
Anope::string l_str;
if (!ci->c->GetParam("LIMIT", l_str))
diff --git a/modules/chanserv/entrymsg.cpp b/modules/chanserv/entrymsg.cpp
index c739ba46a..b2edbc56f 100644
--- a/modules/chanserv/entrymsg.cpp
+++ b/modules/chanserv/entrymsg.cpp
@@ -151,7 +151,9 @@ class CommandEntryMessage : public Command
msg->SetChannel(ci);
msg->SetCreator(source.GetNick());
msg->SetMessage(message);
- Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to add a message";
+
+ logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to add a message"));
+
source.Reply(_("Entry message added to \002{0}\002"), ci->GetName());
}
@@ -177,7 +179,9 @@ class CommandEntryMessage : public Command
if (i > 0 && i <= messages.size())
{
messages[i - 1]->Delete();
- Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to remove a message";
+
+ logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to remove a message"));
+
source.Reply(_("Entry message \002{0}\002 for \002{1]\002 deleted."), i, ci->GetName());
}
else
@@ -192,9 +196,10 @@ class CommandEntryMessage : public Command
void DoClear(CommandSource &source, ChanServ::Channel *ci)
{
for (EntryMsg *e : ci->GetRefs<EntryMsg *>())
- delete e;
+ e->Delete();
+
+ logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to remove all messages"));
- Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to remove all messages";
source.Reply(_("Entry messages for \002{0}\002 have been cleared."), ci->GetName());
}
diff --git a/modules/chanserv/flags.cpp b/modules/chanserv/flags.cpp
index 4732aff5b..d87863be0 100644
--- a/modules/chanserv/flags.cpp
+++ b/modules/chanserv/flags.cpp
@@ -266,9 +266,12 @@ class CommandCSFlags : public Command
if (current != NULL)
{
EventManager::Get()->Dispatch(&Event::AccessDel::OnAccessDel, ci, source, current);
- delete current;
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << mask;
- source.Reply(_("\002{0}\002 removed from the access list of \002{1}\002."), mask, ci->GetName());
+
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to delete {0}"), current->Mask());
+
+ source.Reply(_("\002{0}\002 removed from the access list of \002{1}\002."), current->Mask(), ci->GetName());
+
+ current->Delete();
}
else
{
@@ -290,11 +293,12 @@ class CommandCSFlags : public Command
access->SetFlags(Anope::string(current_flags.begin(), current_flags.end()));
if (current != NULL)
- delete current;
+ current->Delete();
EventManager::Get()->Dispatch(&Event::AccessAdd::OnAccessAdd, ci, source, access);
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to modify " << mask << "'s flags to " << access->AccessSerialize();
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to modify flags of {0} to {1}"), access->Mask(), access->AccessSerialize());
+
if (p != NULL)
{
if (add)
@@ -303,7 +307,9 @@ class CommandCSFlags : public Command
source.Reply(_("Privilege \002{0}\002 removed from \002{1}\002 on \002{2}\002, new flags are +\002{3}\002"), p->name, access->Mask(), ci->GetName(), access->AccessSerialize());
}
else
+ {
source.Reply(_("Flags for \002{0}\002 on \002{1}\002 set to +\002{2}\002"), access->Mask(), ci->GetName(), access->AccessSerialize());
+ }
}
void DoList(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
@@ -383,7 +389,7 @@ class CommandCSFlags : public Command
source.Reply(_("The access list of \002{0}\002 has been cleared."), ci->GetName());
bool override = !source.IsFounder(ci);
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to clear the access list";
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to clear the access list"));
}
public:
diff --git a/modules/chanserv/getkey.cpp b/modules/chanserv/getkey.cpp
index cbcc66720..2e6835672 100644
--- a/modules/chanserv/getkey.cpp
+++ b/modules/chanserv/getkey.cpp
@@ -53,7 +53,7 @@ class CommandCSGetKey : public Command
}
bool override = !source.AccessFor(ci).HasPriv("GETKEY");
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci);
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel}"));
source.Reply(_("Key for channel \002{0}\002 is \002{1}\002."), ci->GetName(), key);
}
diff --git a/modules/chanserv/invite.cpp b/modules/chanserv/invite.cpp
index 9c21bc704..ae6cee04d 100644
--- a/modules/chanserv/invite.cpp
+++ b/modules/chanserv/invite.cpp
@@ -83,12 +83,12 @@ class CommandCSInvite : public Command
{
source.Reply(_("\002{0}\002 has been invited to \002{1}\002."), u2->nick, c->name);
u2->SendMessage(ci->WhoSends(), _("You have been invited to \002{0}\002 by \002{1}\002."), c->name, source.GetNick());
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << u2->nick;
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to invite {0}"), u2->nick);
}
else
{
u2->SendMessage(ci->WhoSends(), _("You have been invited to \002{0}\002."), c->name);
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci);
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel}"));
}
}
diff --git a/modules/chanserv/kick.cpp b/modules/chanserv/kick.cpp
index 505f74893..fad7b9158 100644
--- a/modules/chanserv/kick.cpp
+++ b/modules/chanserv/kick.cpp
@@ -79,7 +79,7 @@ class CommandCSKick : public Command
else
{
bool override = !u_access.HasPriv("KICK") || (u != u2 && ci->IsPeace() && u2_access >= u_access);
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << u2->nick;
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} for {0}"), u2->nick);
if (ci->IsSignKick() || (ci->IsSignKickLevel() && !u_access.HasPriv("SIGNKICK")))
{
@@ -96,7 +96,7 @@ class CommandCSKick : public Command
{
Anope::string mask = IRCD->NormalizeMask(target);
- Log(LOG_COMMAND, source, this, ci) << "for " << mask;
+ logger.Command(LogType::COMMAND, source, ci, _("{source} used {command} on {channel} for {0}"), mask);
int matched = 0, kicked = 0;
for (Channel::ChanUserList::iterator it = c->users.begin(), it_end = c->users.end(); it != it_end;)
diff --git a/modules/chanserv/list.cpp b/modules/chanserv/list.cpp
index a60ae786c..cd855a0b3 100644
--- a/modules/chanserv/list.cpp
+++ b/modules/chanserv/list.cpp
@@ -215,13 +215,15 @@ class CommandCSSetPrivate : public Command
if (params[1].equals_ci("ON"))
{
- Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable private";
+ logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enable private"));
+
ci->SetPrivate(true);
source.Reply(_("Private option for \002{0}\002 is now \002on\002."), ci->GetName());
}
else if (params[1].equals_ci("OFF"))
{
- Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable private";
+ logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to disable private"));
+
ci->SetPrivate(false);
source.Reply(_("Private option for \002{0}\002 is now \002off\002."), ci->GetName());
}
diff --git a/modules/chanserv/log.cpp b/modules/chanserv/log.cpp
index 4cbc66c7e..52724a57b 100644
--- a/modules/chanserv/log.cpp
+++ b/modules/chanserv/log.cpp
@@ -285,15 +285,24 @@ public:
{
if (log->GetExtra() == extra)
{
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to remove logging for " << command << " with method " << method << (extra == "" ? "" : " ") << extra;
- source.Reply(_("Logging for command \002{0}\002 on \002{1}\002 with log method \002{2}{3}{4}\002 has been removed."), !log->GetCommandName().empty() ? log->GetCommandName() : log->GetServiceName(), !log->GetCommandService().empty() ? log->GetCommandService() : "any service", method, extra.empty() ? "" : " ", extra);
- delete log;
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to remove logging for {0} with method {1}"),
+ command, method + (extra.empty() ? "" : (" " + extra)));
+
+ source.Reply(_("Logging for command \002{0}\002 on \002{1}\002 with log method \002{2}{3}{4}\002 has been removed."),
+ !log->GetCommandName().empty() ? log->GetCommandName() : log->GetServiceName(),
+ !log->GetCommandService().empty() ? log->GetCommandService() : "any service", method, extra.empty() ? "" : " ", extra);
+ log->Delete();
}
else
{
log->SetExtra(extra);
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to change logging for " << command << " to method " << method << (extra == "" ? "" : " ") << extra;
- source.Reply(_("Logging changed for command \002{0}\002 on \002{1}\002, now using log method \002{2}{3}{4]\002."), !log->GetCommandName().empty() ? log->GetCommandName() : log->GetServiceName(), !log->GetCommandService().empty() ? log->GetCommandService() : "any service", method, extra.empty() ? "" : " ", extra);
+
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to change logging for {0} to method {1}"),
+ command, method + (extra.empty() ? "" : (" " + extra)));
+
+ source.Reply(_("Logging changed for command \002{0}\002 on \002{1}\002, now using log method \002{2}{3}{4]\002."),
+ !log->GetCommandName().empty() ? log->GetCommandName() : log->GetServiceName(),
+ !log->GetCommandService().empty() ? log->GetCommandService() : "any service", method, extra.empty() ? "" : " ", extra);
}
return;
}
@@ -310,9 +319,11 @@ public:
log->SetCreated(Anope::CurTime);
log->SetCreator(source.GetNick());
- Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to log " << command << " with method " << method << (extra == "" ? "" : " ") << extra;
+ logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci,
+ _("{source} used {command} on {channel} to log {0} to method {1}"), command, method + (extra.empty() ? "" : (" " + extra)));
- source.Reply(_("Logging is now active for command \002{0}\002 on \002{1}\002, using log method \002{2}{3}{4}\002."), !command_name.empty() ? command_name : service_name, bi ? bi->nick : "any service", method, extra.empty() ? "" : " ", extra);
+ source.Reply(_("Logging is now active for command \002{0}\002 on \002{1}\002, using log method \002{2}{3}{4}\002."),
+ !command_name.empty() ? command_name : service_name, bi ? bi->nick : "any service", method, extra.empty() ? "" : " ", extra);
}
else
{
@@ -423,9 +434,11 @@ class CSLog : public Module
}
}
- void OnLog(::Log *l) override
+ void OnLog(Logger *l) override
{
- if (l->type != LOG_COMMAND || l->u == NULL || l->c == NULL || l->ci == NULL || !Me || !Me->IsSynced())
+#warning "fix log"
+#if 0
+ if (l->type != LogType::COMMAND || l->u == NULL || l->c == NULL || l->ci == NULL || !Me || !Me->IsSynced())
return;
std::vector<LogSetting *> ls = l->ci->GetRefs<LogSetting *>();
@@ -463,6 +476,7 @@ class CSLog : public Module
else if (log->GetMethod().equals_ci("NOTICE") && l->ci->c)
IRCD->SendNotice(l->ci->WhoSends(), log->GetExtra() + l->ci->c->name, buffer);
}
+#endif
}
};
diff --git a/modules/chanserv/main/channel.cpp b/modules/chanserv/main/channel.cpp
index a35c80901..d10abbc0d 100644
--- a/modules/chanserv/main/channel.cpp
+++ b/modules/chanserv/main/channel.cpp
@@ -30,7 +30,7 @@ void ChannelImpl::Delete()
{
EventManager::Get()->Dispatch(&Event::DelChan::OnDelChan, this);
- Log(LOG_DEBUG) << "Deleting channel " << this->GetName();
+ Anope::Logger.Debug("Deleting channel {0}", this->GetName());
if (this->c)
{
@@ -361,7 +361,7 @@ ChanServ::AccessGroup ChannelImpl::AccessFor(const User *u, bool updateLastUsed)
return group;
NickServ::Account *nc = u->Account();
- if (nc == NULL && !nc->IsSecure() && u->IsRecognized())
+ if (nc == NULL && !this->IsSecure() && u->IsRecognized())
{
NickServ::Nick *na = NickServ::FindNick(u->nick);
if (na != NULL)
@@ -480,7 +480,7 @@ int16_t ChannelImpl::GetLevel(const Anope::string &priv)
ChanServ::Privilege *p = ChanServ::service ? ChanServ::service->FindPrivilege(priv) : nullptr;
if (!p)
{
- Log(LOG_DEBUG) << "Unknown privilege " + priv;
+ Anope::Logger.Debug("Unknown privilege {0}", priv);
return ChanServ::ACCESS_INVALID;
}
@@ -499,7 +499,7 @@ void ChannelImpl::SetLevel(const Anope::string &priv, int16_t level)
ChanServ::Privilege *p = ChanServ::service ? ChanServ::service->FindPrivilege(priv) : nullptr;
if (!p)
{
- Log(LOG_DEBUG) << "Unknown privilege " + priv;
+ Anope::Logger.Debug("Unknown privilege {0}", priv);
return;
}
@@ -538,7 +538,7 @@ Anope::string ChannelImpl::GetIdealBan(User *u)
else
return "*!" + u->GetVIdent() + "@" + u->GetDisplayedHost();
case 3:
- return "*!" + u->Mask();
+ return "*!" + u->WildMask();
case 2:
default:
return "*!*@" + u->GetDisplayedHost();
diff --git a/modules/chanserv/main/chanserv.cpp b/modules/chanserv/main/chanserv.cpp
index 492f64459..62d1e81ba 100644
--- a/modules/chanserv/main/chanserv.cpp
+++ b/modules/chanserv/main/chanserv.cpp
@@ -309,7 +309,9 @@ class ChanServCore : public Module
if (newowner)
{
- ::Log(LOG_NORMAL, "chanserv/drop", ChanServ) << "Transferring foundership of " << ci->GetName() << " from deleted account " << nc->GetDisplay() << " to " << newowner->GetDisplay();
+ ChanServ->logger.Category("chanserv/drop").Log(_("Transferring foundership of {0} from deleted account {1} to {2}"),
+ ci->GetName(), nc->GetDisplay(), newowner->GetDisplay());
+
ci->SetFounder(newowner);
// Can't be both founder and successor
@@ -318,7 +320,8 @@ class ChanServCore : public Module
}
else
{
- ::Log(LOG_NORMAL, "chanserv/drop", ChanServ) << "Deleting channel " << ci->GetName() << " owned by deleted account " << nc->GetDisplay();
+ ChanServ->logger.Category("chanserv/drop").Log(_("Deleting channel {0} owned by deleted account {1}"),
+ ci->GetName(), nc->GetDisplay());
ci->Delete();
continue;
@@ -408,10 +411,13 @@ class ChanServCore : public Module
}
}
- void OnLog(::Log *l) override
+ void OnLog(Logger *l) override
{
- if (l->type == LOG_CHANNEL)
+#warning ""
+#if 0
+ if (l->type == LogType::CHANNEL)
l->bi = ChanServ;
+#endif
}
void OnExpireTick() override
@@ -442,7 +448,9 @@ class ChanServCore : public Module
if (expire)
{
- ::Log(LOG_NORMAL, "chanserv/expire", ChanServ) << "Expiring channel " << ci->GetName() << " (founder: " << (ci->GetFounder() ? ci->GetFounder()->GetDisplay() : "(none)") << ")";
+ ChanServ->logger.Category("chanserv/expire").Log(_("Expiring channel {0} (founder: {1})"),
+ ci->GetName(), ci->GetFounder() ? ci->GetFounder()->GetDisplay() : "(none)");
+
EventManager::Get()->Dispatch(&ChanServ::Event::ChanExpire::OnChanExpire, ci);
ci->Delete();
}
@@ -511,7 +519,7 @@ class ChanServCore : public Module
{
if (always_lower && c->ci && c->creation_time > c->ci->GetTimeRegistered())
{
- ::Log(LOG_DEBUG) << "Changing TS of " << c->name << " from " << c->creation_time << " to " << c->ci->GetTimeRegistered();
+ logger.Debug("Changing TS of {0} from {1} to {2}", c->name, c->creation_time, c->ci->GetTimeRegistered());
c->creation_time = c->ci->GetTimeRegistered();
IRCD->Send<messages::MessageChannel>(c);
c->Reset();
diff --git a/modules/chanserv/mode.c