diff options
author | Robby- <robby@chat.be> | 2013-09-29 08:55:32 +0200 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-09-29 15:42:22 -0400 |
commit | ed06609ae1b100997981a3c91bcf46d7a31bc7bd (patch) | |
tree | 183d41ecc968d0385d3f01b61fc67c5aa492f36a /modules/commands/ns_cert.cpp | |
parent | 32a57150ecddc75b1bfd2efc185575b76431cbff (diff) |
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.
Diffstat (limited to 'modules/commands/ns_cert.cpp')
-rw-r--r-- | modules/commands/ns_cert.cpp | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/modules/commands/ns_cert.cpp b/modules/commands/ns_cert.cpp index 5bb3487b1..ed7140dd5 100644 --- a/modules/commands/ns_cert.cpp +++ b/modules/commands/ns_cert.cpp @@ -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, ""); } |