From 2a5e8f1890ecc3a390d814cf24cbc9451a938840 Mon Sep 17 00:00:00 2001 From: Robby- Date: Sat, 28 Sep 2013 20:44:57 +0200 Subject: [PATCH] cs_akick: Make the default autokick reason translatable. os_forbid: It is required to specify a reason. --- modules/commands/cs_akick.cpp | 11 ++++++----- modules/commands/os_forbid.cpp | 17 ++++------------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/modules/commands/cs_akick.cpp b/modules/commands/cs_akick.cpp index ecad59142..17b95e176 100644 --- a/modules/commands/cs_akick.cpp +++ b/modules/commands/cs_akick.cpp @@ -464,6 +464,7 @@ class CommandCSAKick : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override { + BotInfo *bi = Config->GetClient("NickServ"); this->SendSyntax(source); source.Reply(" "); source.Reply(_("Maintains the \002AutoKick list\002 for a channel. If a user\n" @@ -474,12 +475,12 @@ class CommandCSAKick : public Command "The \002AKICK ADD\002 command adds the given nick or usermask\n" "to the AutoKick list. If a \037reason\037 is given with\n" "the command, that reason will be used when the user is\n" - "kicked; if not, the default reason is \"You have been\n" + "kicked; if not, the default reason is \"User has been\n" "banned from the channel\".\n" - "When akicking a \037registered nick\037 the nickserv account\n" + "When akicking a \037registered nick\037 the %s account\n" "will be added to the akick list instead of the mask.\n" "All users within that nickgroup will then be akicked.\n"), - source.service->nick.c_str()); + source.service->nick.c_str(), bi ? bi->nick.c_str() : "NickServ"); source.Reply(_( " \n" "The \002AKICK DEL\002 command removes the given nick or mask\n" @@ -542,9 +543,9 @@ class CSAKick : public Module mask = autokick->mask; reason = autokick->reason; if (reason.empty()) - reason = Config->GetModule(this)->Get("autokickreason"); + reason = Language::Translate(u, Config->GetModule(this)->Get("autokickreason").c_str()); if (reason.empty()) - reason = "User has been banned from the channel"; + reason = Language::Translate(u, _("User has been banned from the channel")); return EVENT_STOP; } } diff --git a/modules/commands/os_forbid.cpp b/modules/commands/os_forbid.cpp index 0e8c34e78..485f66ee7 100644 --- a/modules/commands/os_forbid.cpp +++ b/modules/commands/os_forbid.cpp @@ -92,7 +92,7 @@ class CommandOSForbid : public Command CommandOSForbid(Module *creator) : Command(creator, "operserv/forbid", 1, 5), fs("ForbidService", "forbid") { this->SetDesc(_("Forbid usage of nicknames, channels, and emails")); - this->SetSyntax(_("ADD {NICK|CHAN|EMAIL|REGISTER} [+\037expiry\037] \037entry\037 [\037reason\037]")); + this->SetSyntax(_("ADD {NICK|CHAN|EMAIL|REGISTER} [+\037expiry\037] \037entry\037 \037reason\037")); this->SetSyntax(_("DEL {NICK|CHAN|EMAIL|REGISTER} \037entry\037")); this->SetSyntax("LIST [NICK|CHAN|EMAIL|REGISTER]"); } @@ -236,10 +236,7 @@ class CommandOSForbid : public Command if (u->server == Me || u->HasMode("OPER")) continue; - if (d->reason.empty()) - reason = Language::Translate(u, _("This channel has been forbidden.")); - else - reason = Anope::printf(Language::Translate(u, _("This channel has been forbidden: %s")), d->reason.c_str()); + reason = Anope::printf(Language::Translate(u, _("This channel has been forbidden: %s")), d->reason.c_str()); c->Kick(source.service, u, "%s", reason.c_str()); } @@ -400,10 +397,7 @@ class OSForbid : public Module BotInfo *OperServ = Config->GetClient("OperServ"); if (OperServ) { - if (d->reason.empty()) - u->SendMessage(OperServ, _("This nickname has been forbidden.")); - else - u->SendMessage(OperServ, _("This nickname has been forbidden: %s"), d->reason.c_str()); + u->SendMessage(OperServ, _("This nickname has been forbidden: %s"), d->reason.c_str()); } if (nickserv) nickserv->Collide(u, NULL); @@ -431,10 +425,7 @@ class OSForbid : public Module chanserv->Hold(c); } - if (d->reason.empty()) - reason = Language::Translate(u, _("This channel has been forbidden.")); - else - reason = Anope::printf(Language::Translate(u, _("This channel has been forbidden: %s")), d->reason.c_str()); + reason = Anope::printf(Language::Translate(u, _("This channel has been forbidden: %s")), d->reason.c_str()); return EVENT_STOP; }