mirror of
https://github.com/anope/anope.git
synced 2026-07-02 03:46:39 +02:00
NickServ: Change a few log wordings and add missing log calls to some commands.
ns_suspend and cs_suspend: Fix log wording, and correct syntax to show the reason is optional.
This commit is contained in:
@@ -116,7 +116,7 @@ class CommandOSSeen : public Command
|
||||
CommandOSSeen(Module *creator) : Command(creator, "operserv/seen", 1, 2)
|
||||
{
|
||||
this->SetDesc(_("Statistics and maintenance for seen data"));
|
||||
this->SetSyntax(_("STATS"));
|
||||
this->SetSyntax("STATS");
|
||||
this->SetSyntax(_("CLEAR \037time\037"));
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class CommandCSSuspend : public Command
|
||||
CommandCSSuspend(Module *creator) : Command(creator, "chanserv/suspend", 2, 3)
|
||||
{
|
||||
this->SetDesc(_("Prevent a channel from being used preserving channel data and settings"));
|
||||
this->SetSyntax(_("\037channel\037 [+\037expiry\037] \037reason\037"));
|
||||
this->SetSyntax(_("\037channel\037 [+\037expiry\037] [\037reason\037]"));
|
||||
}
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
@@ -121,7 +121,7 @@ class CommandCSSuspend : public Command
|
||||
ci->c->Kick(NULL, users[i], "%s", !reason.empty() ? reason.c_str() : Language::Translate(users[i], _("This channel has been suspended.")));
|
||||
}
|
||||
|
||||
Log(LOG_ADMIN, source, this, ci) << (!reason.empty() ? reason : "No reason") << ", expires in " << (expiry_secs ? Anope::strftime(Anope::CurTime + expiry_secs) : "never");
|
||||
Log(LOG_ADMIN, source, this, ci) << " (" << (!reason.empty() ? reason : "No reason") << "), expires on " << (expiry_secs ? Anope::strftime(Anope::CurTime + expiry_secs) : "never");
|
||||
source.Reply(_("Channel \002%s\002 is now suspended."), ci->name.c_str());
|
||||
|
||||
FOREACH_MOD(OnChanSuspend, (ci));
|
||||
|
||||
@@ -41,6 +41,7 @@ class CommandNSAccess : public Command
|
||||
}
|
||||
|
||||
nc->AddAccess(mask);
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to ADD mask " << mask << " to " << nc->display;
|
||||
source.Reply(_("\002%s\002 added to %s's access list."), mask.c_str(), nc->display.c_str());
|
||||
|
||||
return;
|
||||
@@ -66,8 +67,9 @@ class CommandNSAccess : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
source.Reply(_("\002%s\002 deleted from %s's access list."), mask.c_str(), nc->display.c_str());
|
||||
nc->EraseAccess(mask);
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to DELETE mask " << mask << " from " << nc->display;
|
||||
source.Reply(_("\002%s\002 deleted from %s's access list."), mask.c_str(), nc->display.c_str());
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -76,6 +78,8 @@ class CommandNSAccess : public Command
|
||||
{
|
||||
unsigned i, end;
|
||||
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to view the access list for " << nc->display;
|
||||
|
||||
if (nc->access.empty())
|
||||
{
|
||||
source.Reply(_("%s's access list is empty."), nc->display.c_str());
|
||||
|
||||
@@ -92,6 +92,8 @@ class CommandNSAJoin : public Command
|
||||
{
|
||||
AJoinList *channels = nc->Require<AJoinList>("ajoinlist");
|
||||
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to view the auto join list for " << nc->display;
|
||||
|
||||
if ((*channels)->empty())
|
||||
source.Reply(_("%s's auto join list is empty."), nc->display.c_str());
|
||||
else
|
||||
@@ -140,6 +142,7 @@ class CommandNSAJoin : public Command
|
||||
entry->channel = chan;
|
||||
entry->key = key;
|
||||
(*channels)->push_back(entry);
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to ADD channel " << chan << " to " << nc->display;
|
||||
source.Reply(_("%s added to %s's auto join list."), chan.c_str(), nc->display.c_str());
|
||||
}
|
||||
}
|
||||
@@ -158,6 +161,7 @@ class CommandNSAJoin : public Command
|
||||
else
|
||||
{
|
||||
delete (*channels)->at(i);
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to DELETE channel " << chan << " from " << nc->display;
|
||||
source.Reply(_("%s was removed from %s's auto join list."), chan.c_str(), nc->display.c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,8 @@ class CommandNSAList : public Command
|
||||
nc = na->nc;
|
||||
}
|
||||
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to view the channel access list for " << nc->display;
|
||||
|
||||
ListFormatter list(source.GetAccount());
|
||||
int chan_count = 0;
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ struct NSCertListImpl : NSCertList
|
||||
class CommandNSCert : public Command
|
||||
{
|
||||
private:
|
||||
void DoAdd(CommandSource &source, NickCore *nc, const Anope::string &mask)
|
||||
void DoAdd(CommandSource &source, NickCore *nc, const Anope::string &certfp)
|
||||
{
|
||||
NSCertList *cl = nc->Require<NSCertList>("certificates");
|
||||
|
||||
@@ -144,11 +144,12 @@ class CommandNSCert : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (mask.empty())
|
||||
if (certfp.empty())
|
||||
{
|
||||
if (source.GetUser() && !source.GetUser()->fingerprint.empty() && !cl->FindCert(source.GetUser()->fingerprint))
|
||||
{
|
||||
cl->AddCert(source.GetUser()->fingerprint);
|
||||
Log(LOG_COMMAND, source, this) << "to ADD its current certificate fingerprint " << source.GetUser()->fingerprint;
|
||||
source.Reply(_("\002%s\002 added to your certificate list."), source.GetUser()->fingerprint.c_str());
|
||||
}
|
||||
else
|
||||
@@ -157,25 +158,27 @@ class CommandNSCert : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (cl->FindCert(mask))
|
||||
if (cl->FindCert(certfp))
|
||||
{
|
||||
source.Reply(_("Fingerprint \002%s\002 already present on %s's certificate list."), mask.c_str(), nc->display.c_str());
|
||||
source.Reply(_("Fingerprint \002%s\002 already present on %s's certificate list."), certfp.c_str(), nc->display.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
cl->AddCert(mask);
|
||||
source.Reply(_("\002%s\002 added to %s's certificate list."), mask.c_str(), nc->display.c_str());
|
||||
cl->AddCert(certfp);
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to ADD certificate fingerprint " << certfp << " to " << nc->display;
|
||||
source.Reply(_("\002%s\002 added to %s's certificate list."), certfp.c_str(), nc->display.c_str());
|
||||
}
|
||||
|
||||
void DoDel(CommandSource &source, NickCore *nc, const Anope::string &mask)
|
||||
void DoDel(CommandSource &source, NickCore *nc, const Anope::string &certfp)
|
||||
{
|
||||
NSCertList *cl = nc->Require<NSCertList>("certificates");
|
||||
|
||||
if (mask.empty())
|
||||
if (certfp.empty())
|
||||
{
|
||||
if (source.GetUser() && !source.GetUser()->fingerprint.empty() && cl->FindCert(source.GetUser()->fingerprint))
|
||||
{
|
||||
cl->EraseCert(source.GetUser()->fingerprint);
|
||||
Log(LOG_COMMAND, source, this) << "to DELETE its current certificate fingerprint " << source.GetUser()->fingerprint;
|
||||
source.Reply(_("\002%s\002 deleted from your certificate list."), source.GetUser()->fingerprint.c_str());
|
||||
}
|
||||
else
|
||||
@@ -184,21 +187,24 @@ class CommandNSCert : public Command
|
||||
return;
|
||||
}
|
||||
|
||||
if (!cl->FindCert(mask))
|
||||
if (!cl->FindCert(certfp))
|
||||
{
|
||||
source.Reply(_("\002%s\002 not found on %s's certificate list."), mask.c_str(), nc->display.c_str());
|
||||
source.Reply(_("\002%s\002 not found on %s's certificate list."), certfp.c_str(), nc->display.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
source.Reply(_("\002%s\002 deleted from %s's certificate list."), mask.c_str(), nc->display.c_str());
|
||||
cl->EraseCert(mask);
|
||||
cl->EraseCert(certfp);
|
||||
cl->Check();
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to DELETE certificate fingerprint " << certfp << " from " << nc->display;
|
||||
source.Reply(_("\002%s\002 deleted from %s's certificate list."), certfp.c_str(), nc->display.c_str());
|
||||
}
|
||||
|
||||
void DoList(CommandSource &source, const NickCore *nc)
|
||||
{
|
||||
NSCertList *cl = nc->GetExt<NSCertList>("certificates");
|
||||
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to view the certificate fingerprint list for " << nc->display;
|
||||
|
||||
if (!cl || !cl->GetCertCount())
|
||||
{
|
||||
source.Reply(_("%s's certificate list is empty."), nc->display.c_str());
|
||||
@@ -225,14 +231,14 @@ class CommandNSCert : public Command
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
const Anope::string &cmd = params[0];
|
||||
Anope::string nick, mask;
|
||||
Anope::string nick, certfp;
|
||||
|
||||
if (cmd.equals_ci("LIST"))
|
||||
nick = params.size() > 1 ? params[1] : "";
|
||||
else
|
||||
{
|
||||
nick = params.size() == 3 ? params[1] : "";
|
||||
mask = params.size() > 1 ? params[params.size() - 1] : "";
|
||||
certfp = params.size() > 1 ? params[params.size() - 1] : "";
|
||||
}
|
||||
|
||||
NickCore *nc;
|
||||
@@ -267,9 +273,9 @@ class CommandNSCert : public Command
|
||||
else if (Anope::ReadOnly)
|
||||
source.Reply(READ_ONLY_MODE);
|
||||
else if (cmd.equals_ci("ADD"))
|
||||
return this->DoAdd(source, nc, mask);
|
||||
return this->DoAdd(source, nc, certfp);
|
||||
else if (cmd.equals_ci("DEL"))
|
||||
return this->DoDel(source, nc, mask);
|
||||
return this->DoDel(source, nc, certfp);
|
||||
else
|
||||
this->OnSyntaxError(source, "");
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class NSGroupRequest : public IdentifyRequest
|
||||
u->Login(target->nc);
|
||||
FOREACH_MOD(OnNickGroup, (u, target));
|
||||
|
||||
Log(LOG_COMMAND, source, cmd) << "makes " << nick << " join group of " << target->nick << " (" << target->nc->display << ") (email: " << (!target->nc->email.empty() ? target->nc->email : "none") << ")";
|
||||
Log(LOG_COMMAND, source, cmd) << "to make " << nick << " join group of " << target->nick << " (" << target->nc->display << ") (email: " << (!target->nc->email.empty() ? target->nc->email : "none") << ")";
|
||||
source.Reply(_("You are now in the group of \002%s\002."), target->nick.c_str());
|
||||
|
||||
u->lastnickreg = Anope::CurTime;
|
||||
@@ -120,7 +120,7 @@ class CommandNSGroup : public Command
|
||||
source.Reply(_("Please wait %d seconds before using the GROUP command again."), (reg_delay + u->lastnickreg) - Anope::CurTime);
|
||||
else if (target->nc->HasExt("NS_SUSPENDED"))
|
||||
{
|
||||
Log(LOG_COMMAND, source, this) << "tried to use GROUP for SUSPENDED nick " << target->nick;
|
||||
Log(LOG_COMMAND, source, this) << "and tried to group to SUSPENDED nick " << target->nick;
|
||||
source.Reply(NICK_X_SUSPENDED, target->nick.c_str());
|
||||
}
|
||||
else if (na && *target->nc == *na->nc)
|
||||
|
||||
@@ -182,13 +182,13 @@ class CommandNSSetHide : public Command
|
||||
|
||||
if (arg.equals_ci("ON"))
|
||||
{
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change hide " << param << " to " << arg << " for " << nc->display;
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change hide " << param.upper() << " to " << arg.upper() << " for " << nc->display;
|
||||
nc->Extend<bool>(flag);
|
||||
source.Reply(onmsg.c_str(), nc->display.c_str(), source.service->nick.c_str());
|
||||
}
|
||||
else if (arg.equals_ci("OFF"))
|
||||
{
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change hide " << param << " to " << arg << " for " << nc->display;
|
||||
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change hide " << param.upper() << " to " << arg.upper() << " for " << nc->display;
|
||||
nc->Shrink<bool>(flag);
|
||||
source.Reply(offmsg.c_str(), nc->display.c_str(), source.service->nick.c_str());
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class CommandNSSuspend : public Command
|
||||
CommandNSSuspend(Module *creator) : Command(creator, "nickserv/suspend", 2, 3)
|
||||
{
|
||||
this->SetDesc(_("Suspend a given nick"));
|
||||
this->SetSyntax(_("\037nickname\037 [+\037expiry\037] \037reason\037"));
|
||||
this->SetSyntax(_("\037nickname\037 [+\037expiry\037] [\037reason\037]"));
|
||||
}
|
||||
|
||||
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
@@ -134,7 +134,7 @@ class CommandNSSuspend : public Command
|
||||
}
|
||||
}
|
||||
|
||||
Log(LOG_ADMIN, source, this) << "for " << nick << " (" << (!reason.empty() ? reason : "No reason") << "), expires in " << (expiry_secs ? Anope::strftime(Anope::CurTime + expiry_secs) : "never");
|
||||
Log(LOG_ADMIN, source, this) << "for " << nick << " (" << (!reason.empty() ? reason : "No reason") << "), expires on " << (expiry_secs ? Anope::strftime(Anope::CurTime + expiry_secs) : "never");
|
||||
source.Reply(_("Nick %s is now suspended."), nick.c_str());
|
||||
|
||||
FOREACH_MOD(OnNickSuspend, (na));
|
||||
|
||||
Reference in New Issue
Block a user