summaryrefslogtreecommitdiff
path: root/modules/nickserv
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2017-01-23 12:35:14 -0500
committerAdam <Adam@anope.org>2017-01-23 12:35:14 -0500
commit16ca76c2e7ab287e480185fbb03a0bb438351eda (patch)
treedfb25534afa2352b65b2ee707086cb5eecc96fbb /modules/nickserv
parentff030c1eb7c3764f9add2a689479e84d616cabcb (diff)
Make log system use newer format strings
Also allow log messages to be translatable
Diffstat (limited to 'modules/nickserv')
-rw-r--r--modules/nickserv/access.cpp8
-rw-r--r--modules/nickserv/ajoin.cpp4
-rw-r--r--modules/nickserv/cert.cpp12
-rw-r--r--modules/nickserv/drop.cpp5
-rw-r--r--modules/nickserv/getemail.cpp2
-rw-r--r--modules/nickserv/group.cpp10
-rw-r--r--modules/nickserv/identify.cpp13
-rw-r--r--modules/nickserv/info.cpp10
-rw-r--r--modules/nickserv/list.cpp8
-rw-r--r--modules/nickserv/logout.cpp4
-rw-r--r--modules/nickserv/main/account.cpp2
-rw-r--r--modules/nickserv/main/nickserv.cpp11
-rw-r--r--modules/nickserv/maxemail.cpp2
-rw-r--r--modules/nickserv/recover.cpp8
-rw-r--r--modules/nickserv/register.cpp11
-rw-r--r--modules/nickserv/resetpass.cpp5
-rw-r--r--modules/nickserv/set.cpp67
-rw-r--r--modules/nickserv/suspend.cpp11
18 files changed, 127 insertions, 66 deletions
diff --git a/modules/nickserv/access.cpp b/modules/nickserv/access.cpp
index e20d81037..8c6ac0343 100644
--- a/modules/nickserv/access.cpp
+++ b/modules/nickserv/access.cpp
@@ -107,7 +107,7 @@ class CommandNSAccess : public Command
a->SetAccount(nc);
a->SetMask(mask);
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to ADD mask " << mask << " to " << nc->GetDisplay();
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to add mask {0} to {1}"), mask, nc->GetDisplay());
source.Reply(_("\002{0}\002 added to the access list of \002{1}\002."), mask, nc->GetDisplay());
}
@@ -129,7 +129,9 @@ class CommandNSAccess : public Command
if (a->GetMask().equals_ci(mask))
{
a->Delete();
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to DELETE mask " << mask << " from " << nc->GetDisplay();
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source,
+ _("{source} used {command} to delete mask {0} from {1}"),
+ mask, nc->GetDisplay());
source.Reply(_("\002{0}\002 deleted from the access list of \002{1}\002."), mask, nc->GetDisplay());
return;
}
@@ -264,7 +266,7 @@ class NSAccess : public Module
{
NickAccess *a = Serialize::New<NickAccess *>();
a->SetAccount(na->GetAccount());
- a->SetMask(u->Mask());
+ a->SetMask(u->WildMask());
u->SendMessage(Config->GetClient("NickServ"),
_("\002{0}\002 has been registered under your hostmask: \002{1}\002"), na->GetNick(), a->GetMask());
diff --git a/modules/nickserv/ajoin.cpp b/modules/nickserv/ajoin.cpp
index 0d708143c..bdb6c0522 100644
--- a/modules/nickserv/ajoin.cpp
+++ b/modules/nickserv/ajoin.cpp
@@ -181,7 +181,7 @@ class CommandNSAJoin : public Command
return;
addedchans = addedchans.substr(0, addedchans.length() - 2);
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to ADD channel " << addedchans << " to " << nc->GetDisplay();
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to add channel {2} from {3}"), addedchans, nc->GetDisplay());
source.Reply(_("\002{0}\002 added to the auto join list of \002{1}\002."), addedchans, nc->GetDisplay());
}
@@ -218,7 +218,7 @@ class CommandNSAJoin : public Command
return;
delchans = delchans.substr(0, delchans.length() - 2);
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to DELETE channel " << delchans << " from " << nc->GetDisplay();
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to delete channel {2} from {3}"), delchans, nc->GetDisplay());
source.Reply(_("\002{0}\002 was removed from the auto join list of \002{1}\002."), delchans, nc->GetDisplay());
}
diff --git a/modules/nickserv/cert.cpp b/modules/nickserv/cert.cpp
index 51eae0fb0..d2e91bce6 100644
--- a/modules/nickserv/cert.cpp
+++ b/modules/nickserv/cert.cpp
@@ -187,8 +187,8 @@ class CommandNSCert : public Command
e->SetCert(certfp);
#warning "events?"
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to add certificate fingerprint {0} to {1}"), certfp, nc->GetDisplay());
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to ADD certificate fingerprint " << certfp << " to " << nc->GetDisplay();
source.Reply(_("\002{0}\002 added to the certificate list of \002{1}\002."), certfp, nc->GetDisplay());
}
@@ -218,7 +218,7 @@ class CommandNSCert : public Command
cert->Delete();
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to DELETE certificate fingerprint " << certfp << " from " << nc->GetDisplay();
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to delete certificate fingerprint {0} from {1}"), certfp, nc->GetDisplay());
source.Reply(_("\002{0}\002 deleted from the access list of \002{1}\002."), certfp, nc->GetDisplay());
}
@@ -354,8 +354,9 @@ class NSCert : public Module
else
u->Login(nc);
- u->SendMessage(NickServ, _("SSL certificate fingerprint accepted, you are now identified to \002%s\002."), nc->GetDisplay().c_str());
- Log(NickServ) << u->GetMask() << " automatically identified for account " << nc->GetDisplay() << " via SSL certificate fingerprint";
+ u->SendMessage(NickServ, _("SSL certificate fingerprint accepted, you are now identified to \002{0}\002."), nc->GetDisplay());
+ NickServ->logger.Log(_("{0} automatically identified for account {1} via SSL certificate fingerprint"),
+ u->GetMask(), nc->GetDisplay());
}
EventReturn OnNickValidate(User *u, NickServ::Nick *na) override
@@ -376,7 +377,8 @@ class NSCert : public Module
u->Identify(na);
u->SendMessage(NickServ, _("SSL certificate fingerprint accepted, you are now identified."));
- Log(NickServ) << u->GetMask() << " automatically identified for account " << na->GetAccount()->GetDisplay() << " via SSL certificate fingerprint";
+ NickServ->logger.Log(_("{0} automatically identified for account {1} via SSL certificate fingerprint"),
+ u->GetMask(), na->GetAccount()->GetDisplay());
return EVENT_ALLOW;
}
diff --git a/modules/nickserv/drop.cpp b/modules/nickserv/drop.cpp
index 426e3115e..d5a3f77b7 100644
--- a/modules/nickserv/drop.cpp
+++ b/modules/nickserv/drop.cpp
@@ -63,7 +63,10 @@ class CommandNSDrop : public Command
EventManager::Get()->Dispatch(&Event::NickDrop::OnNickDrop, source, na);
- Log(!is_mine ? LOG_ADMIN : LOG_COMMAND, source, this) << "to drop nickname " << na->GetNick() << " (group: " << na->GetAccount()->GetDisplay() << ") (email: " << (!na->GetAccount()->GetEmail().empty() ? na->GetAccount()->GetEmail() : "none") << ")";
+ logger.Command(!is_mine ? LogType::ADMIN : LogType::COMMAND, source, _("{source} used {command} to drop nickname {0} (account: {1}) (e-mail: {2})"),
+ na->GetNick(), na->GetAccount()->GetDisplay(),
+ !na->GetAccount()->GetEmail().empty() ? na->GetAccount()->GetEmail() : "none");
+
na->Delete();
source.Reply(_("\002{0}\002 has been dropped."), nick);
diff --git a/modules/nickserv/getemail.cpp b/modules/nickserv/getemail.cpp
index 0a996e7b0..ff7f9e8c1 100644
--- a/modules/nickserv/getemail.cpp
+++ b/modules/nickserv/getemail.cpp
@@ -33,7 +33,7 @@ class CommandNSGetEMail : public Command
const Anope::string &email = params[0];
int j = 0;
- Log(LOG_ADMIN, source, this) << "on " << email;
+ logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0}"), email);
for (NickServ::Account *nc : NickServ::service->GetAccountList())
if (!nc->GetEmail().empty() && Anope::Match(nc->GetEmail(), email))
diff --git a/modules/nickserv/group.cpp b/modules/nickserv/group.cpp
index f5afb272e..cff53d320 100644
--- a/modules/nickserv/group.cpp
+++ b/modules/nickserv/group.cpp
@@ -56,7 +56,10 @@ class NSGroupRequestListener : public NickServ::IdentifyRequestListener
u->Login(target->GetAccount());
EventManager::Get()->Dispatch(&Event::NickGroup::OnNickGroup, u, target);
- Log(LOG_COMMAND, source, cmd) << "to make " << nick << " join group of " << target->GetNick() << " (" << target->GetAccount()->GetDisplay() << ") (email: " << (!target->GetAccount()->GetEmail().empty() ? target->GetAccount()->GetEmail() : "none") << ")";
+ cmd->logger.Command(LogType::COMMAND, source, _("{source} used {command} to make {2} join group of {3} ({4}) (email: {5})"),
+ source.GetSource(), source.GetCommand(), nick, target->GetNick(), target->GetAccount()->GetDisplay(),
+ !target->GetAccount()->GetEmail().empty() ? target->GetAccount()->GetEmail() : "none");
+
source.Reply(_("You are now in the group of \002{0}\002."), target->GetNick());
u->lastnickreg = Anope::CurTime;
@@ -68,7 +71,7 @@ class NSGroupRequestListener : public NickServ::IdentifyRequestListener
if (!source.GetUser())
return;
- Log(LOG_COMMAND, source, cmd) << "and failed to group to " << target->GetNick();
+ cmd->logger.Command(LogType::COMMAND, source, _("{source} used {command} and failed to group to {0}"), target->GetNick());
source.Reply(_("Password incorrect."));
source.GetUser()->BadPassword();
}
@@ -149,7 +152,8 @@ class CommandNSGroup : public Command
if (target->GetAccount()->HasFieldS("NS_SUSPENDED"))
{
- Log(LOG_COMMAND, source, this) << "and tried to group to suspended nick " << target->GetNick();
+ logger.Command(LogType::COMMAND, source, _("{source} used {command} and tried to group to suspended nickname {0}"), target->GetNick());
+
source.Reply(_("\002{0}\002 is suspended."), target->GetNick());
return;
}
diff --git a/modules/nickserv/identify.cpp b/modules/nickserv/identify.cpp
index 13e578b69..a88c9c90b 100644
--- a/modules/nickserv/identify.cpp
+++ b/modules/nickserv/identify.cpp
@@ -42,9 +42,10 @@ class NSIdentifyRequestListener : public NickServ::IdentifyRequestListener
}
if (u->IsIdentified())
- Log(LOG_COMMAND, source, cmd) << "to log out of account " << u->Account()->GetDisplay();
+ cmd->logger.Command(LogType::COMMAND, source, _("{source} used {command} to log out of account {0}"), u->Account()->GetDisplay());
+
+ cmd->logger.Command(LogType::COMMAND, source, _("{source} used {command} and identified for account {0}"), na->GetAccount()->GetDisplay());
- Log(LOG_COMMAND, source, cmd) << "and identified for account " << na->GetAccount()->GetDisplay();
source.Reply(_("Password accepted - you are now recognized as \002{0}\002."), na->GetAccount()->GetDisplay());
u->Identify(na);
}
@@ -55,14 +56,20 @@ class NSIdentifyRequestListener : public NickServ::IdentifyRequestListener
return;
bool accountexists = NickServ::FindNick(req->GetAccount()) != NULL;
- Log(LOG_COMMAND, source, cmd) << "and failed to identify to" << (accountexists ? " " : " nonexistent ") << "account " << req->GetAccount();
+ if (!accountexists)
+ cmd->logger.Command(LogType::COMMAND, source, _("{source} used {command} and failed to identify to nonexistent account {0}"), req->GetAccount());
+ else
+ cmd->logger.Command(LogType::COMMAND, source, _("{source} used {command} and failed to identify to account {0}"), req->GetAccount());
+
if (accountexists)
{
source.Reply(_("Password incorrect."));
source.GetUser()->BadPassword();
}
else
+ {
source.Reply("\002{0}\002 isn't registered.", req->GetAccount());
+ }
}
};
diff --git a/modules/nickserv/info.cpp b/modules/nickserv/info.cpp
index 0fd4169e9..eb9b103fa 100644
--- a/modules/nickserv/info.cpp
+++ b/modules/nickserv/info.cpp
@@ -194,13 +194,19 @@ class CommandNSSetHide : public Command
if (arg.equals_ci("ON"))
{
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change hide " << param.upper() << " to " << arg.upper() << " for " << nc->GetDisplay();
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source,
+ _("{source} used {command} to change hide {0} to {1} for {2}"),
+ param.upper(), arg.upper(), nc->GetDisplay());
+
nc->SetS<bool>(flag, true);
source.Reply(onmsg, nc->GetDisplay(), source.service->nick);
}
else if (arg.equals_ci("OFF"))
{
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change hide " << param.upper() << " to " << arg.upper() << " for " << nc->GetDisplay();
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source,
+ _("{source} used {command} to change hide {0} to {1} for {2}"),
+ param.upper(), arg.upper(), nc->GetDisplay());
+
nc->UnsetS<bool>(flag);
source.Reply(offmsg, nc->GetDisplay(), source.service->nick);
}
diff --git a/modules/nickserv/list.cpp b/modules/nickserv/list.cpp
index 735df7d7d..e8d340683 100644
--- a/modules/nickserv/list.cpp
+++ b/modules/nickserv/list.cpp
@@ -213,13 +213,17 @@ class CommandNSSetPrivate : public Command
if (param.equals_ci("ON"))
{
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable private for " << nc->GetDisplay();
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source,
+ _("{source} used {command} to enable private for {0}"), nc->GetDisplay());
+
nc->SetPrivate(true);
source.Reply(_("Private option is now \002on\002 for \002{0}\002."), nc->GetDisplay());
}
else if (param.equals_ci("OFF"))
{
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable private for " << nc->GetDisplay();
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source,
+ _("{source} used {command} to disable private for {0}"), nc->GetDisplay());
+
nc->SetPrivate(true);
source.Reply(_("Private option is now \002off\002 for \002{0}\002."), nc->GetDisplay());
}
diff --git a/modules/nickserv/logout.cpp b/modules/nickserv/logout.cpp
index 0e6cdb46a..3cff5e9e8 100644
--- a/modules/nickserv/logout.cpp
+++ b/modules/nickserv/logout.cpp
@@ -61,7 +61,9 @@ class CommandNSLogout : public Command
#endif
u2->super_admin = false; /* Dont let people logout and remain a SuperAdmin */
- Log(LOG_COMMAND, source, this) << "to logout " << u2->nick;
+
+ // XXX show account name here?
+ logger.Command(LogType::COMMAND, source, _("{source} used {command} to logout {0}"), u2->nick);
if (!nick.empty())
source.Reply(_("\002{0}\002 has been logged out."), nick);
diff --git a/modules/nickserv/main/account.cpp b/modules/nickserv/main/account.cpp
index a6fa19adf..86c96b14f 100644
--- a/modules/nickserv/main/account.cpp
+++ b/modules/nickserv/main/account.cpp
@@ -283,7 +283,7 @@ void AccountImpl::SetDisplay(NickServ::Nick *na)
NickServ::Account* &nc = map[this->GetDisplay()];
if (nc)
- Log(LOG_DEBUG) << "Duplicate account " << this->GetDisplay() << " in nickcore table?";
+ Anope::Logger.Debug("Duplicate account {0} in nickcore table?", this->GetDisplay());
nc = this;
}
diff --git a/modules/nickserv/main/nickserv.cpp b/modules/nickserv/main/nickserv.cpp
index 3741d119b..3921534c9 100644
--- a/modules/nickserv/main/nickserv.cpp
+++ b/modules/nickserv/main/nickserv.cpp
@@ -426,7 +426,7 @@ class NickServCore : public Module, public NickServ::NickServService
void OnDelCore(NickServ::Account *nc) override
{
- Log(NickServ, "nick") << "Deleting nickname group " << nc->GetDisplay();
+ NickServ->logger.Category("nick").Log(_("Deleting nickname group {0}"), nc->GetDisplay());
/* Clean up this nick core from any users online */
for (unsigned int i = nc->users.size(); i > 0; --i)
@@ -441,7 +441,7 @@ class NickServCore : public Module, public NickServ::NickServService
void OnChangeCoreDisplay(NickServ::Account *nc, const Anope::string &newdisplay) override
{
- Log(LOG_NORMAL, "nick", NickServ) << "Changing " << nc->GetDisplay() << " nickname group display to " << newdisplay;
+ Anope::Logger.Bot(NickServ).Category("nick").Log(_("Changing {0} nickname group display to {1}"), nc->GetDisplay(), newdisplay);
}
void OnNickIdentify(User *u) override
@@ -555,7 +555,7 @@ class NickServCore : public Module, public NickServ::NickServService
IRCD->Send<messages::Login>(u, na);
if (!Config->GetModule("nickserv/main")->Get<bool>("nonicknameownership") && na->GetAccount() == u->Account() && !na->GetAccount()->IsUnconfirmed())
u->SetMode(NickServ, "REGISTERED");
- Log(u, "", NickServ) << u->GetMask() << " automatically identified for group " << u->Account()->GetDisplay();
+ u->logger.Bot(NickServ).Log(_("{0} automatically identified for account {1}"), u->GetMask(), u->Account()->GetDisplay());
}
if (!u->nick.equals_ci(oldnick) && old_na)
@@ -655,9 +655,10 @@ class NickServCore : public Module, public NickServ::NickServService
if (expire)
{
- Log(LOG_NORMAL, "nickserv/expire", NickServ) << "Expiring nickname " << na->GetNick() << " (group: " << na->GetAccount()->GetDisplay() << ") (e-mail: " << (na->GetAccount()->GetEmail().empty() ? "none" : na->GetAccount()->GetEmail()) << ")";
+ Anope::Logger.Bot(NickServ).Category("nickserv/expire").Log(_("Expiring nickname {0} (account: {1}) (e-mail: {2})"),
+ na->GetNick(), na->GetAccount()->GetDisplay(), na->GetAccount()->GetEmail().empty() ? "none" : na->GetAccount()->GetEmail());
EventManager::Get()->Dispatch(&NickServ::Event::NickExpire::OnNickExpire, na);
- delete na;
+ na->Delete();
}
}
}
diff --git a/modules/nickserv/maxemail.cpp b/modules/nickserv/maxemail.cpp
index 0660e7b92..b7924d2c2 100644
--- a/modules/nickserv/maxemail.cpp
+++ b/modules/nickserv/maxemail.cpp
@@ -39,7 +39,7 @@ class NSMaxEmail : public Module
username = username.substr(0, sz);
Anope::string cleaned = username + email.substr(host);
- Log(LOG_DEBUG) << "cleaned " << email << " to " << cleaned;
+ logger.Debug("cleaned {0} to {1}", email, cleaned);
return cleaned;
}
diff --git a/modules/nickserv/recover.cpp b/modules/nickserv/recover.cpp
index 60a0bee2f..191e6e019 100644
--- a/modules/nickserv/recover.cpp
+++ b/modules/nickserv/recover.cpp
@@ -50,7 +50,7 @@ class NSRecoverRequestListener : public NickServ::IdentifyRequestListener
if (!na)
return;
- Log(LOG_COMMAND, source, cmd) << "for " << na->GetNick();
+ cmd->logger.Command(LogType::COMMAND, source, _("{source} used {command} for {0}"), na->GetNick());
/* Nick is being held by us, release it */
if (na->HasFieldS("HELD"))
@@ -69,7 +69,7 @@ class NSRecoverRequestListener : public NickServ::IdentifyRequestListener
if (!source.GetAccount() && na->GetAccount()->IsSecure())
{
source.GetUser()->Login(u->Account());
- Log(LOG_COMMAND, source, cmd) << "and was automatically identified to " << u->Account()->GetDisplay();
+ cmd->logger.Command(LogType::COMMAND, source, _("{source} used {command} and was automatically identified to {0}"), u->Account()->GetDisplay());
}
if (Config->GetModule("nickserv/recover")->Get<bool>("restoreonrecover"))
@@ -100,7 +100,7 @@ class NSRecoverRequestListener : public NickServ::IdentifyRequestListener
if (!source.GetAccount() && na->GetAccount()->IsSecure())
{
source.GetUser()->Login(na->GetAccount()); // Identify the user using the command if they arent identified
- Log(LOG_COMMAND, source, cmd) << "and was automatically identified to " << na->GetNick() << " (" << na->GetAccount()->GetDisplay() << ")";
+ cmd->logger.Command(LogType::COMMAND, source, _("{source} used {command} and was automatically identified to {0} ({1})"), na->GetNick(), na->GetAccount()->GetDisplay());
source.Reply(_("You have been logged in as \002{0}\002."), na->GetAccount()->GetDisplay());
}
@@ -139,7 +139,7 @@ class NSRecoverRequestListener : public NickServ::IdentifyRequestListener
source.Reply(_("Access denied."));
if (!pass.empty())
{
- Log(LOG_COMMAND, source, cmd) << "with an invalid password for " << user;
+ cmd->logger.Command(LogType::COMMAND, source, _("{source} used {command} with an invalid password for {0}"), user);
if (source.GetUser())
source.GetUser()->BadPassword();
}
diff --git a/modules/nickserv/register.cpp b/modules/nickserv/register.cpp
index b06e08075..1554c0033 100644
--- a/modules/nickserv/register.cpp
+++ b/modules/nickserv/register.cpp
@@ -53,7 +53,7 @@ class CommandNSConfirm : public Command
na->GetAccount()->SetUnconfirmed(false);
EventManager::Get()->Dispatch(&NickServ::Event::NickConfirm::OnNickConfirm, source.GetUser(), na->GetAccount());
- Log(LOG_ADMIN, source, this) << "to confirm nick " << na->GetNick() << " (" << na->GetAccount()->GetDisplay() << ")";
+ logger.Command(LogType::ADMIN, source, _("{source} used {command} to confirm nickname {0} ({1})"), na->GetNick(), na->GetAccount()->GetDisplay());
source.Reply(_("\002{0}\002 has been confirmed."), na->GetNick());
/* Login the users online already */
@@ -79,7 +79,7 @@ class CommandNSConfirm : public Command
NickServ::Account *nc = source.nc;
nc->Shrink<Anope::string>("passcode");
- Log(LOG_COMMAND, source, this) << "to confirm their email";
+ logger.Command(LogType::COMMAND, source, _("{source} used {command} to confirm their email"), source.nc->GetEmail());
source.Reply(_("Your email address of \002{0}\002 has been confirmed."), source.nc->GetEmail());
nc->SetUnconfirmed(false);
@@ -257,7 +257,8 @@ class CommandNSRegister : public Command
na->SetLastRealname(source.GetNick());
}
- Log(LOG_COMMAND, source, this) << "to register " << na->GetNick() << " (email: " << (!na->GetAccount()->GetEmail().empty() ? na->GetAccount()->GetEmail() : "none") << ")";
+ logger.Command(LogType::COMMAND, source, _("{source} used {command} to register {0} (email: {1})"),
+ na->GetNick(), !na->GetAccount()->GetEmail().empty() ? na->GetAccount()->GetEmail() : "none");
source.Reply(_("\002{0}\002 has been registered."), u_nick);
@@ -346,13 +347,13 @@ class CommandNSResend : public Command
if (!SendRegmail(source.GetUser(), na, source.service))
{
- Log(this->GetOwner()) << "Unable to resend registration verification code for " << source.GetNick();
+ logger.Log("Unable to resend registration verificiation code for {0}", source.GetNick());
return;
}
na->GetAccount()->lastmail = Anope::CurTime;
source.Reply(_("Your passcode has been re-sent to \002{0}\002."), na->GetAccount()->GetEmail());
- Log(LOG_COMMAND, source, this) << "to resend registration verification code";
+ logger.Command(LogType::COMMAND, source, _("{source} used {command} to resend registration verification code"));
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/nickserv/resetpass.cpp b/modules/nickserv/resetpass.cpp
index 2a3a8c418..5361ed091 100644
--- a/modules/nickserv/resetpass.cpp
+++ b/modules/nickserv/resetpass.cpp
@@ -49,7 +49,8 @@ class CommandNSResetPass : public Command
if (SendResetEmail(source.GetUser(), na, source.service))
{
- Log(LOG_COMMAND, source, this) << "for " << na->GetNick() << " (group: " << na->GetAccount()->GetDisplay() << ")";
+ logger.Command(LogType::COMMAND, source, _("{source} used {command} for {0} (account: {1})"), na->GetNick(), na->GetAccount()->GetDisplay());
+
source.Reply(_("Password reset email for \002{0}\002 has been sent."), na->GetNick());
}
}
@@ -109,7 +110,7 @@ class NSResetPass : public Module
reset.Unset(nc);
nc->SetUnconfirmed(false);
- Log(LOG_COMMAND, source, &commandnsresetpass) << "confirmed RESETPASS to forcefully identify as " << na->GetNick();
+ command->logger.Command(LogType::COMMAND, source, _("{source} used {command} and confirmed password reset to forcefully identify as {0}"), na->GetNick());
if (source.GetUser())
{
diff --git a/modules/nickserv/set.cpp b/modules/nickserv/set.cpp
index c7d03f8d2..df6696fbf 100644
--- a/modules/nickserv/set.cpp
+++ b/modules/nickserv/set.cpp
@@ -155,7 +155,7 @@ class CommandNSSetPassword : public Command
return;
}
- Log(LOG_COMMAND, source, this) << "to change their password";
+ logger.Command(LogType::COMMAND, source, _("{source} used {command} to change their password"));
Anope::string tmp_pass;
Anope::Encrypt(param, tmp_pass);
@@ -216,7 +216,7 @@ class CommandNSSASetPassword : public Command
return;
}
- Log(LOG_ADMIN, source, this) << "to change the password of " << nc->GetDisplay();
+ logger.Command(LogType::ADMIN, source, _("{source} used {command} to change the password of {0}"), nc->GetDisplay());
Anope::string tmp_pass;
Anope::Encrypt(params[1], tmp_pass);
@@ -263,13 +263,13 @@ class CommandNSSetAutoOp : public Command
if (param.equals_ci("ON"))
{
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable autoop for " << na->GetAccount()->GetDisplay();
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to enable autoop for {0}"), na->GetAccount()->GetDisplay());
nc->SetAutoOp(true);
source.Reply(_("Services will from now on set status modes on \002{0}\002 in channels."), nc->GetDisplay());
}
else if (param.equals_ci("OFF"))
{
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable autoop for " << na->GetAccount()->GetDisplay();
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to disable autoop for {0}"), na->GetAccount()->GetDisplay());
nc->SetAutoOp(false);
source.Reply(_("Services will no longer set status modes on \002{0}\002 in channels."), nc->GetDisplay());
}
@@ -356,7 +356,9 @@ class CommandNSSetDisplay : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- Log(user_na->GetAccount() == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the display of " << user_na->GetAccount()->GetDisplay() << " to " << na->GetNick();
+ logger.Command(user_na->GetAccount() == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source,
+ _("{source} used {command} to change the display of {0} to {1}"),
+ user_na->GetAccount()->GetDisplay(), na->GetNick());
user_na->GetAccount()->SetDisplay(na);
@@ -483,7 +485,7 @@ class CommandNSSetEmail : public Command
if (param.empty())
{
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to unset the email of " << nc->GetDisplay();
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to unset the email of {0}"), nc->GetDisplay());
nc->SetEmail("");
source.Reply(_("E-mail address for \002{0}\002 unset."), nc->GetDisplay());
}
@@ -494,7 +496,8 @@ class CommandNSSetEmail : public Command
}
else
{
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the email of " << nc->GetDisplay() << " to " << param;
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to change the email of {0} to {1}"),
+ nc->GetDisplay(), param);
nc->SetEmail(param);
source.Reply(_("E-mail address for \002{0}\002 changed to \002{1}\002."), nc->GetDisplay(), param);
}
@@ -565,13 +568,13 @@ class CommandNSSetKeepModes : public Command
if (param.equals_ci("ON"))
{
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable keepmodes for " << nc->GetDisplay();
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to enable keepmodes for {0}"), nc->GetDisplay());
nc->SetKeepModes(true);
source.Reply(_("Keep modes for \002{0}\002 is now \002on\002."), nc->GetDisplay());
}
else if (param.equals_ci("OFF"))
{
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable keepmodes for " << nc->GetDisplay();
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to disable keepmodes for {2}"), nc->GetDisplay());
nc->SetKeepModes(false);
source.Reply(_("Keep modes for \002{0}\002 is now \002off\002."), nc->GetDisplay());
}
@@ -655,7 +658,10 @@ class CommandNSSetKill : public Command
nc->SetKillProtect(true);
nc->SetKillQuick(false);
nc->SetKillImmed(false);
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to set kill on for " << nc->GetDisplay();
+
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to set kill to {0} for {1}"),
+ "ON", nc->GetDisplay());
+
source.Reply(_("Protection is now \002on\002 for \002{0}\002."), nc->GetDisplay());
}
else if (param.equals_ci("QUICK"))
@@ -663,7 +669,10 @@ class CommandNSSetKill : public Command
nc->SetKillProtect(true);
nc->SetKillQuick(true);
nc->SetKillImmed(false);
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to set kill quick for " << nc->GetDisplay();
+
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to set kill to {0} for {1}"),
+ "QUICK", nc->GetDisplay());
+
source.Reply(_("Protection is now \002on\002 for \002{0}\002, with a reduced delay."), nc->GetDisplay());
}
else if (param.equals_ci("IMMED"))
@@ -673,7 +682,10 @@ class CommandNSSetKill : public Command
nc->SetKillProtect(true);
nc->SetKillQuick(false);
nc->SetKillImmed(true);
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to set kill immed for " << nc->GetDisplay();
+
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to set kill to {0} for {1}"),
+ "IMMED", nc->GetDisplay());
+
source.Reply(_("Protection is now \002on\002 for \002{0}\002, with no delay."), nc->GetDisplay());
}
else
@@ -684,7 +696,9 @@ class CommandNSSetKill : public Command
nc->SetKillProtect(true);
nc->SetKillQuick(false);
nc->SetKillImmed(false);
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable kill for " << nc->GetDisplay();
+
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to disable kill for {0}"), nc->GetDisplay());
+
source.Reply(_("Protection is now \002off\002 for \002{0}\002."), nc->GetDisplay());
}
else
@@ -778,7 +792,8 @@ class CommandNSSetLanguage : public Command
}
}
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the language of " << nc->GetDisplay() << " to " << param;
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to change the language of {0} to {1}"),
+ nc->GetDisplay(), param);
nc->SetLanguage(param);
@@ -877,13 +892,17 @@ class CommandNSSetMessage : public Command
if (param.equals_ci("ON"))
{
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable " << source.command << " for " << nc->GetDisplay();
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to enable {0} for {1}"),
+ "MSG", nc->GetDisplay());
+
nc->SetMsg(true);
source.Reply(_("Services will now reply to \002{0}\002 with \002messages\002."), nc->GetDisplay());
}
else if (param.equals_ci("OFF"))
{
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable " << source.command << " for " << nc->GetDisplay();
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to disable {0} for {1}"),
+ "MSG", nc->GetDisplay());
+
nc->SetMsg(false);
source.Reply(_("Services will now reply to \002{0}\002 with \002notices\002."), nc->GetDisplay());
}
@@ -974,13 +993,15 @@ class CommandNSSetSecure : public Command
if (param.equals_ci("ON"))
{
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable secure for " << nc->GetDisplay();
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to enable {0} for {1}"),
+ "SECURE", nc->GetDisplay());
nc->SetSecure(true);
source.Reply(_("Secure option is now \002on\002 for \002{0}\002."), nc->GetDisplay());
}
else if (param.equals_ci("OFF"))
{
- Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable secure for " << nc->GetDisplay();
+ logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to disable {0} for {1}"),
+ "SECURE", nc->GetDisplay());
nc->SetSecure(false);
source.Reply(_("Secure option is now \002off\002 for \002{0}\002."), nc->GetDisplay());
}
@@ -1058,13 +1079,17 @@ class CommandNSSASetNoexpire : public Command
if (param.equals_ci("ON"))
{
- Log(LOG_ADMIN, source, this) << "to enable noexpire for " << na->GetAccount()->GetDisplay();
+ logger.Command(LogType::ADMIN, source, _("{source} used {command} to enable {0} for {1}"),
+ "NOEXPIRE", na->GetAccount()->GetDisplay());
+
na->SetNoExpire(true);
source.Reply(_("\002{0}\002 \002will not\002 expire."), na->GetNick());
}
else if (param.equals_ci("OFF"))
{
- Log(LOG_ADMIN, source, this) << "to disable noexpire for " << na->GetAccount()->GetDisplay();
+ logger.Command(LogType::ADMIN, source, _("{source} used {command} to disable {0} for {1}"),
+ "NOEXPIRE", na->GetAccount()->GetDisplay());
+
na->SetNoExpire(false);
source.Reply(_("\002{0}\002 \002will\002 expire."), na->GetNick());
}
@@ -1174,7 +1199,7 @@ class NSSet : public Module
if (params[0] == n->second)
{
uac->SetEmail(n->first);
- Log(LOG_COMMAND, source, command) << "to confirm their email address change to " << uac->GetEmail();
+ command->logger.Command(LogType::COMMAND, source, _("{source} used {command} to confirm their email address change to {0}"), uac->GetEmail());
source.Reply(_("Your email address has been changed to \002%s\002."), uac->GetEmail().c_str());
ns_set_email.Unset(uac);
return EVENT_STOP;
diff --git a/modules/nickserv/suspend.cpp b/modules/nickserv/suspend.cpp
index 90362bcf2..c630dcd92 100644
--- a/modules/nickserv/suspend.cpp
+++ b/modules/nickserv/suspend.cpp
@@ -194,7 +194,8 @@ class CommandNSSuspend : public Command
}
}
- Log(LOG_ADMIN, source, this) << "for " << nick << " (" << (!reason.empty() ? reason : "No reason") << "), expires on " << (expiry_secs ? Anope::strftime(Anope::CurTime + expiry_secs) : "never");
+ logger.Command(LogType::ADMIN, source, _("{source} used {command} for {0} ({1}), expires on {2}"),
+ nick, !reason.empty() ? reason : "No reason", expiry_secs ? Anope::strftime(Anope::CurTime + expiry_secs) : "never");
source.Reply(_("\002{0}\002 is now suspended."), na->GetNick());
EventManager::Get()->Dispatch(&Event::NickSuspend::OnNickSuspend, na);
@@ -202,8 +203,9 @@ class CommandNSSuspend : public Command
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
{
+#warning "show expiry"
source.Reply(_("Suspends \037account\037, which prevents it from being used while keeping all the data for it."
- " If an expiry is given the account will be unsuspended after that period of time, otherwise the default expiry from the configuration is used.")); // XXX
+ " If an expiry is given the account will be unsuspended after that period of time, otherwise the default expiry from the configuration is used."));
return true;
}
};
@@ -238,7 +240,8 @@ class CommandNSUnSuspend : public Command
return;
}
- Log(LOG_ADMIN, source, this) << "for " << na->GetNick() << " which was suspended by " << (!si->GetBy().empty() ? si->GetBy() : "(none)") << " for: " << (!si->GetReason().empty() ? si->GetReason() : "No reason");
+ logger.Command(LogType::ADMIN, source, _("{source} used {command} for {0}, which was suspended by {1} for: {2}"),
+ !si->GetBy().empty() ? si->GetBy() : "(noone)", !si->GetReason().empty() ? si->GetReason() : "no reason");
si->Delete();
@@ -329,7 +332,7 @@ class NSSuspend : public Module
na->SetLastSeen(Anope::CurTime);
s->Delete();
- Log(LOG_NORMAL, "nickserv/expire", Config->GetClient("NickServ")) << "Expiring suspend for " << na->GetNick();
+ logger.Category("nickserv/expire").Bot("NickServ").Log(_("Expiring suspend for {0}"), na->GetNick());
}
}