diff options
| author | Adam <Adam@anope.org> | 2014-06-23 07:12:41 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2014-06-23 07:12:41 -0400 |
| commit | 148b26f687ce85dc01e852a2358b03d493757ada (patch) | |
| tree | f81ea553d0384ec6063eff45cfaff5aa92aaa1c9 | |
| parent | 0dba0692f9f88275b7d89d511bf22124217bc4c6 (diff) | |
Mostly working language string rewrite with new format strings
124 files changed, 3234 insertions, 3616 deletions
diff --git a/include/anope.h b/include/anope.h index 845a2b1fb..839d201cf 100644 --- a/include/anope.h +++ b/include/anope.h @@ -631,7 +631,7 @@ class spacesepstream : public sepstream public: /** Initialize with space seperator */ - spacesepstream(const Anope::string &source) : sepstream(source, ' ') { } + spacesepstream(const Anope::string &source, bool allowempty = false) : sepstream(source, ' ', allowempty) { } }; /** This class can be used on its own to represent an exception, or derived to represent a module-specific exception. @@ -775,3 +775,67 @@ template<typename T, typename O> inline T anope_dynamic_static_cast(O ptr) return static_cast<T>(ptr); } #endif + +struct kwarg +{ + Anope::string name, value; + + template<typename T> + kwarg& operator=(const T& rhs) + { + value = stringify(rhs); + return *this; + } +}; + +inline kwarg operator"" _kw(const char *literal, size_t n) +{ + return kwarg{ literal }; +} + +struct FormatInfo +{ + Anope::string format; + std::vector<kwarg> parameters; + unsigned int pos = 0; + + FormatInfo(const Anope::string &fmt, size_t size) : format(fmt), parameters(size) { } + + template<typename T> + void Add(T& arg) + { + parameters[pos] = kwarg{ stringify(pos).c_str() } = stringify(arg); + ++pos; + } + + template<typename Arg, typename... Args> + void Format(Arg &&arg, Args&&... args) + { + Add(arg); + Format(std::forward<Args>(args)...); + } + + void Format() + { + for (kwarg& arg : parameters) + format = format.replace_all_cs("{" + arg.name + "}", arg.value); + } +}; + +template<> +inline void FormatInfo::Add(kwarg &arg) +{ + parameters[pos++] = arg; +} + +namespace Anope +{ + template<typename... Args> + inline Anope::string Format(const Anope::string &format, Args&&... args) + { + FormatInfo fi(format, sizeof...(Args)); + fi.Format(std::forward<Args>(args)...); + return fi.format; + } +} + diff --git a/include/bots.h b/include/bots.h index 9a2c5d237..ef57d31f3 100644 --- a/include/bots.h +++ b/include/bots.h @@ -124,6 +124,8 @@ class CoreExport BotInfo : public User, public Serializable */ CommandInfo *GetCommand(const Anope::string &cname); + CommandInfo *FindCommand(const Anope::string &service); + /** Find a bot by nick * @param nick The nick * @param nick_only True to only look by nick, and not by UID diff --git a/include/commands.h b/include/commands.h index 359995f8f..6f29aa135 100644 --- a/include/commands.h +++ b/include/commands.h @@ -14,6 +14,7 @@ #include "service.h" #include "anope.h" #include "channels.h" +#include "language.h" struct CommandGroup { @@ -29,6 +30,8 @@ struct CommandInfo /* Service name of the command */ Anope::string name; + /* User visible name */ + Anope::string cname; /* Permission required to execute the command */ Anope::string permission; /* Group this command is in */ @@ -77,7 +80,13 @@ class CoreExport CommandSource ChanServ::AccessGroup AccessFor(ChanServ::Channel *ci); bool IsFounder(ChanServ::Channel *ci); - void Reply(const char *message, ...); + template<typename... Args> + void Reply(const char *message, Args&&... args) + { + const char *translated_message = Language::Translate(this->nc, message); + Reply(Anope::Format(translated_message, std::forward<Args>(args)...)); + } + void Reply(const Anope::string &message); bool HasCommand(const Anope::string &cmd); diff --git a/include/config.h b/include/config.h index 585c681fb..ccb7bcdf1 100644 --- a/include/config.h +++ b/include/config.h @@ -122,6 +122,8 @@ namespace Configuration std::vector<CommandGroup> CommandGroups; /* List of modules to autoload */ std::vector<Anope::string> ModulesAutoLoad; + /* After how many characters do we wrap lines? */ + unsigned int LineWrap; /* module configuration blocks */ std::map<Anope::string, Block *> modules; diff --git a/include/event.h b/include/event.h index 83d5a79e1..381db967b 100644 --- a/include/event.h +++ b/include/event.h @@ -123,7 +123,7 @@ class EventHook : public EventHandler } priority; - EventHook(const Anope::string &name, Priority p = Priority::LAST) : handlers(this, name) + EventHook(const Anope::string &name, Priority p = Priority::LAST) : handlers(this, name), priority(p) { handlers.Check(); } diff --git a/include/language.h b/include/language.h index 0aaa5ac9c..3bb732ddf 100644 --- a/include/language.h +++ b/include/language.h @@ -63,67 +63,3 @@ namespace Language } // namespace Language -/* Commonly used language strings */ -#define MORE_INFO _("\002%s%s HELP %s\002 for more information.") -#define BAD_USERHOST_MASK _("Mask must be in the form \037user\037@\037host\037.") -#define BAD_EXPIRY_TIME _("Invalid expiry time.") -#define USERHOST_MASK_TOO_WIDE _("%s coverage is too wide; Please use a more specific mask.") -#define READ_ONLY_MODE _("Services are in read-only mode!") -#define PASSWORD_INCORRECT _("Password incorrect.") -#define ACCESS_DENIED _("Access denied.") -#define MORE_OBSCURE_PASSWORD _("Please try again with a more obscure password. Passwords should be at least\n" \ - "five characters long, should not be something easily guessed\n" \ - "(e.g. your real name or your nick), and cannot contain the space or tab characters.") -#define PASSWORD_TOO_LONG _("Your password is too long. Please try again with a shorter password.") -#define NICK_NOT_REGISTERED _("Your nick isn't registered.") -#define NICK_X_NOT_REGISTERED _("Nick \002%s\002 isn't registered.") -#define NICK_X_NOT_IN_USE _("Nick \002%s\002 isn't currently in use.") -#define NICK_X_NOT_ON_CHAN _("\002%s\002 is not currently on channel %s.") -#define NICK_X_SUSPENDED _("Nick %s is currently suspended.") -#define CHAN_X_SUSPENDED _("Channel %s is currently suspended.") -#define CHAN_X_NOT_REGISTERED _("Channel \002%s\002 isn't registered.") -#define CHAN_X_NOT_IN_USE _("Channel \002%s\002 doesn't exist.") -#define NICK_IDENTIFY_REQUIRED _("Password authentication required for that command.") -#define MAIL_X_INVALID _("\002%s\002 is not a valid e-mail address.") -#define UNKNOWN _("<unknown>") -#define NO_EXPIRE _("does not expire") -#define LIST_INCORRECT_RANGE _("Incorrect range specified. The correct syntax is \002#\037from\037-\037to\037\002.") -#define NICK_IS_REGISTERED _("This nick is owned by someone else. Please choose another.\n" \ - "(If this is your nick, type \002%s%s IDENTIFY \037password\037\002.)") -#define NICK_IS_SECURE _("This nickname is registered and protected. If it is your\n" \ - "nick, type \002%s%s IDENTIFY \037password\037\002. Otherwise,\n" \ - "please choose a different nick.") -#define FORCENICKCHANGE_NOW _("This nickname has been registered; you may not use it.") -#define NICK_CANNOT_BE_REGISTERED _("Nickname \002%s\002 may not be registered.") -#define NICK_ALREADY_REGISTERED _("Nickname \002%s\002 is already registered!") -#define NICK_SET_DISPLAY_CHANGED _("The new display is now \002%s\002.") -#define NICK_CONFIRM_INVALID _("Invalid passcode has been entered, please check the e-mail again, and retry.") -#define CHAN_NOT_ALLOWED_TO_JOIN _("You are not permitted to be on this channel.") -#define CHAN_X_INVALID _("Channel %s is not a valid channel.") -#define CHAN_REACHED_CHANNEL_LIMIT _("Sorry, you have already reached your limit of \002%d\002 channels.") -#define CHAN_EXCEEDED_CHANNEL_LIMIT _("Sorry, you have already exceeded your limit of \002%d\002 channels.") -#define CHAN_SYMBOL_REQUIRED _("Please use the symbol of \002#\002 when attempting to register.") -#define CHAN_SETTING_CHANGED _("%s for %s set to %s.") -#define CHAN_SETTING_UNSET _("%s for %s unset.") -#define CHAN_ACCESS_LEVEL_RANGE _("Access level must be between %d and %d inclusive.") -#define CHAN_INFO_HEADER _("Information for channel \002%s\002:") -#define CHAN_EXCEPTED _("\002%s\002 matches an except on %s and cannot be banned until the except has been removed.") -#define MEMO_NEW_X_MEMO_ARRIVED _("There is a new memo on channel %s.\n" \ - "Type \002%s%s READ %s %d\002 to read it.") -#define MEMO_NEW_MEMO_ARRIVED _("You have a new memo from %s.\n" \ - "Type \002%s%s READ %d\002 to read it.") -#define MEMO_HAVE_NO_MEMOS _("You have no memos.") -#define MEMO_X_HAS_NO_MEMOS _("%s has no memos.") -#define MEMO_SEND_DISABLED _("Sorry, memo sending is temporarily disabled.") -#define MEMO_HAVE_NO_NEW_MEMOS _("You have no new memos.") -#define MEMO_X_HAS_NO_NEW_MEMOS _("%s has no new memos.") -#define BOT_DOES_NOT_EXIST _("Bot \002%s\002 does not exist.") -#define BOT_NOT_ASSIGNED _("You must assign a bot to the channel before using this command.") -#define BOT_NOT_ON_CHANNEL _("Bot is not on channel \002%s\002.") -#define HOST_SET_ERROR _("A vHost must be in the format of a valid hostname.") -#define HOST_SET_IDENT_ERROR _("A vHost ident must be in the format of a valid ident.") -#define HOST_SET_TOOLONG _("Error! The vHost is too long, please use a hostname shorter than %d characters.") -#define HOST_SET_IDENTTOOLONG _("Error! The vHost ident is too long, please use an ident shorter than %d characters.") -#define HOST_NOT_ASSIGNED _("Please contact an Operator to get a vHost assigned to this nick.") -#define HOST_NO_VIDENT _("Your IRCd does not support vIdent's, if this is incorrect, please report this as a possible bug") - diff --git a/include/users.h b/include/users.h index e89d7c8af..972fa2ac0 100644 --- a/include/users.h +++ b/include/users.h @@ -185,10 +185,15 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe /** * Send a message (notice or privmsg, depending on settings) to a user * @param source Sender - * @param fmt Format of the Message - * @param ... any number of parameters - */ - void SendMessage(const MessageSource &, const char *fmt, ...); + * @param message Format of the Message + * @param args any number of parameters + */ + template<typename... Args> + void SendMessage(const MessageSource &source, const char *message, Args&&... args) + { + const char *translated_message = Language::Translate(this->Account(), message); + SendMessage(source, Anope::Format(translated_message, std::forward<Args>(args)...)); + } void SendMessage(const MessageSource &, const Anope::string &msg) override; /** Identify the user to a nick. diff --git a/modules/commands/bs_assign.cpp b/modules/commands/bs_assign.cpp index fe7938fc8..6fc66f43c 100644 --- a/modules/commands/bs_assign.cpp +++ b/modules/commands/bs_assign.cpp @@ -18,7 +18,7 @@ class CommandBSAssign : public Command CommandBSAssign(Module *creator) : Command(creator, "botserv/assign", 2, 2) { this->SetDesc(_("Assigns a bot to a channel")); - this->SetSyntax(_("\037channel\037 \037nick\037")); + this->SetSyntax(_("\037channel\037 \037nickname\037")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -32,36 +32,42 @@ class CommandBSAssign : public Command return; } - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } BotInfo *bi = BotInfo::Find(nick, true); if (!bi) { - source.Reply(BOT_DOES_NOT_EXIST, nick.c_str()); + source.Reply(_("Bot \002{0}\002 does not exist."), nick); return; } ChanServ::AccessGroup access = source.AccessFor(ci); - if (ci->HasExt("BS_NOBOT") || (!access.HasPriv("ASSIGN") && !source.HasPriv("botserv/administration"))) + if (!access.HasPriv("ASSIGN") && !source.HasPriv("botserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "ASSIGN", ci->name); + return; + } + + if (ci->HasExt("BS_NOBOT")) + { + source.Reply(_("Access denied. \002{0}\002 may not have a bot assigned to it because a Services Operator has disallowed it."), ci->name); return; } if (bi->oper_only && !source.HasPriv("botserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. Bot \002{0}\002 is for operators only."), bi->nick); return; } if (ci->bi == bi) { - source.Reply(_("Bot \002%s\002 is already assigned to channel \002%s\002."), ci->bi->nick.c_str(), chan.c_str()); + source.Reply(_("Bot \002{0}\002 is already assigned to \002{1}\002."), ci->bi->nick, ci->name); return; } @@ -69,16 +75,20 @@ class CommandBSAssign : public Command Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << bi->nick; bi->Assign(source.GetUser(), ci); - source.Reply(_("Bot \002%s\002 has been assigned to %s."), bi->nick.c_str(), ci->name.c_str()); + source.Reply(_("Bot \002{0}\002 has been assigned to \002{1}\002."), bi->nick, ci->name); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Assigns a bot pointed out by nick to a channel. You\n" - "can then configure the bot for the channel so it fits\n" - "your needs.")); + source.Reply(_("Assigns the bot \037nickname\037 to \037channel\037." + " You can then configure the bot for the channel so it fits your needs.\n" + "\n" + "Use of this command requires the \002{0}\002 privilege on \037channel\037." + "\n" + "Example:\n" + " {command} #anope Botox\n" + " Assigns the bot Botox to #anope.\n"), + "ASSIGN", "command"_kw = source.command); return true; } }; @@ -94,29 +104,31 @@ class CommandBSUnassign : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; + if (Anope::ReadOnly) { source.Reply(_("Sorry, bot assignment is temporarily disabled.")); return; } - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } ChanServ::AccessGroup access = source.AccessFor(ci); if (!source.HasPriv("botserv/administration") && !access.HasPriv("ASSIGN")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "ASSIGN", ci->name); return; } if (!ci->bi) { - source.Reply(BOT_NOT_ASSIGNED); + source.Reply(_("There is no bot assigned to \002{0}\002."), ci->name); return; } @@ -129,19 +141,22 @@ class CommandBSUnassign : public Command bool override = !access.HasPriv("ASSIGN"); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << ci->bi->nick; + BotInfo *bi = ci->bi; ci->bi->UnAssign(source.GetUser(), ci); - source.Reply(_("There is no bot assigned to %s anymore."), ci->name.c_str()); + source.Reply(_("Bot \002{0}\002 has been unassigned from \002{1}\002."), bi->nick, ci->name); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Unassigns a bot from a channel. When you use this command,\n" - "the bot won't join the channel anymore. However, bot\n" - "configuration for the channel is kept, so you will always\n" - "be able to reassign a bot later without having to reconfigure\n" - "it entirely.")); + source.Reply(_("Unassigns a bot from \037channel\037." + "Bot configuration is kept, so you will always be able to reassign a bot later without losing your settings.\n" + "\n" + "Use of this command requires the \002{0}\002 privilege on \037channel\037." + "\n" + "Example:\n" + " {command} #anope\n" + " Unassigns the current bot from #anope.\n"), + "ASSIGN", "command"_kw = source.command); return true; } }; @@ -157,18 +172,13 @@ class CommandBSSetNoBot : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { - ChanServ::Channel *ci = ChanServ::Find(params[0]); + const Anope::string &chan = params[0]; const Anope::string &value = params[1]; - if (Anope::ReadOnly) - { - source.Reply(_("Sorry, bot modification is temporarily disabled.")); - return; - } - + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } @@ -179,14 +189,14 @@ class CommandBSSetNoBot : public Command ci->Extend<bool>("BS_NOBOT"); if (ci->bi) ci->bi->UnAssign(source.GetUser(), ci); - source.Reply(_("No-bot mode is now \002on\002 on channel %s."), ci->name.c_str()); + source.Reply(_("No-bot mode is now \002on\002 for \002{0}\002."), ci->name); } else if (value.equals_ci("OFF")) { Log(LOG_ADMIN, source, this, ci) << "to disable nobot"; ci->Shrink<bool>("BS_NOBOT"); - source.Reply(_("No-bot mode is now \002off\002 on channel %s."), ci->name.c_str()); + source.Reply(_("No-bot mode is now \002off\002 for \002{0}\002."), ci->name); } else this->OnSyntaxError(source, source.command); @@ -194,11 +204,13 @@ class CommandBSSetNoBot : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(_(" \n" - "This option makes a channel be unassignable. If a bot\n" - "is already assigned to the channel, it is unassigned\n" - "automatically when you enable the option.")); + source.Reply(_("If no-bot is set on a channel, then the channel will be unabled to have a bot assigned to it." + " If a bot is already assigned to the channel, it is unassigned automatically when no-bot is enabled." + "\n" + "Example:\n" + " {command} #anope on\n" + " Prevents a service bot from being assigned to #anope.\n"), + "command"_kw = source.command); return true; } }; @@ -217,7 +229,9 @@ class BSAssign : public Module BSAssign(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR) , EventHook<Event::Invite>("OnInvite") , EventHook<Event::BotInfoEvent>("OnBotInfoEvent") + , nobot(this, "BS_NOBOT") + , commandbsassign(this) , commandbsunassign(this) , commandbssetnobot(this) @@ -227,30 +241,36 @@ class BSAssign : public Module void OnInvite(User *source, Channel *c, User *targ) override { BotInfo *bi; - if (Anope::ReadOnly || !c->ci || targ->server != Me || !(bi = dynamic_cast<BotInfo *>(targ))) + if (Anope::ReadOnly || !c->ci || targ->server != Me || !(bi = BotInfo::Find(targ->nick, true))) return; ChanServ::AccessGroup access = c->ci->AccessFor(source); - if (nobot.HasExt(c->ci) || (!access.HasPriv("ASSIGN") && !source->HasPriv("botserv/administration"))) + if (!access.HasPriv("ASSIGN") && !source->HasPriv("botserv/administration")) + { + targ->SendMessage(bi, _("Access denied. You do not have privilege \002ASSIGN\002 on \002{0}\002."), c->ci->name); + return; + } + + if (nobot.HasExt(c->ci)) { - targ->SendMessage(bi, ACCESS_DENIED); + targ->SendMessage(bi, _("Access denied. \002{0}\002 may not have a bot assigned to it because a Services Operator has disallowed it."), c->ci->name); return; } if (bi->oper_only && !source->HasPriv("botserv/administration")) { - targ->SendMessage(bi, ACCESS_DENIED); + targ->SendMessage(bi, _("Access denied. Bot \002{0}\002 is for operators only."), bi->nick); return; } if (c->ci->bi == bi) { - targ->SendMessage(bi, _("Bot \002%s\002 is already assigned to channel \002%s\002."), c->ci->bi->nick.c_str(), c->name.c_str()); + targ->SendMessage(bi, _("Bot \002{0}\002 is already assigned to \002{1}\002."), bi->nick, c->ci->name); return; } bi->Assign(source, c->ci); - targ->SendMessage(bi, _("Bot \002%s\002 has been assigned to %s."), bi->nick.c_str(), c->name.c_str()); + targ->SendMessage(bi, _("Bot \002{0}\002 has been assigned to \002{1}\002."), bi->nick, c->ci->name); } void OnBotInfo(CommandSource &source, BotInfo *bi, ChanServ::Channel *ci, InfoFormatter &info) override diff --git a/modules/commands/bs_badwords.cpp b/modules/commands/bs_badwords.cpp index b410aced2..5e9dd363a 100644 --- a/modules/commands/bs_badwords.cpp +++ b/modules/commands/bs_badwords.cpp @@ -164,11 +164,11 @@ class BadwordsDelCallback : public NumberList ~BadwordsDelCallback() { if (!deleted) - source.Reply(_("No matching entries on %s bad words list."), ci->name.c_str()); + source.Reply(_("No matching entries on the bad word list of \002{0}\002."), ci->name); else if (deleted == 1) - source.Reply(_("Deleted 1 entry from %s bad words list."), ci->name.c_str()); + source.Reply(_("Deleted \0021\002 entry from bad word list of \002{0}\002."), ci->name); else - source.Reply(_("Deleted %d entries from %s bad words list."), deleted, ci->name.c_str()); + source.Reply(_("Deleted \002{0}\002 entries from the bad word list of \002{1}\002."), deleted, ci->name); } void HandleNumber(unsigned Number) override @@ -196,10 +196,11 @@ class CommandBSBadwords : public Command if (!bw || !bw->GetBadWordCount()) { - source.Reply(_("%s bad words list is empty."), ci->name.c_str()); + source.Reply(_("The bad word list of \002{0}\002 is empty."), ci->name); return; } - else if (!word.empty() && word.find_first_not_of("1234567890,-") == Anope::string::npos) + + if (!word.empty() && word.find_first_not_of("1234567890,-") == Anope::string::npos) { class BadwordsListCallback : public NumberList { @@ -244,13 +245,13 @@ class CommandBSBadwords : public Command } if (list.IsEmpty()) - source.Reply(_("No matching entries on %s bad words list."), ci->name.c_str()); + source.Reply(_("No matching entries on the bad word list of \002{0}\002."), ci->name); else { std::vector<Anope::string> replies; list.Process(replies); - source.Reply(_("Bad words list for %s:"), ci->name.c_str()); + source.Reply(_("Bad words list for \002{0}\002:"), ci->name); for (unsigned i = 0; i < replies.size(); ++i) source.Reply(replies[i]); @@ -284,7 +285,7 @@ class CommandBSBadwords : public Command unsigned badwordsmax = Config->GetModule(this->module)->Get<unsigned>("badwordsmax"); if (badwords->GetBadWordCount() >= badwordsmax) { - source.Reply(_("Sorry, you can only have %d bad words entries on a channel."), badwordsmax); + source.Reply(_("Sorry, you can only have \002{0}\002 bad words entries on a channel."), badwordsmax); return; } @@ -296,7 +297,7 @@ class CommandBSBadwords : public Command if ((casesensitive && realword.equals_cs(bw->word)) || (!casesensitive && realword.equals_ci(bw->word))) { - source.Reply(_("\002%s\002 already exists in %s bad words list."), bw->word.c_str(), ci->name.c_str()); + source.Reply(_("\002{0}\002 already exists in \002{1}\002 bad words list."), bw->word, ci->name); return; } } @@ -305,7 +306,7 @@ class CommandBSBadwords : public Command Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "ADD " << realword; badwords->AddBadWord(realword, bwtype); - source.Reply(_("\002%s\002 added to %s bad words list."), realword.c_str(), ci->name.c_str()); + source.Reply(_("\002{0}\002 added to \002{1}\002 bad words list."), realword, ci->name); } void DoDelete(CommandSource &source, ChanServ::Channel *ci, const Anope::string &word) @@ -314,7 +315,7 @@ class CommandBSBadwords : public Command if (!badwords || !badwords->GetBadWordCount()) { - source.Reply(_("%s bad words list is empty."), ci->name.c_str()); + source.Reply(_("Bad word list for \002{0}\002 is empty."), ci->name); return; } @@ -339,14 +340,14 @@ class CommandBSBadwords : public Command if (i == end) { - source.Reply(_("\002%s\002 not found on %s bad words list."), word.c_str(), ci->name.c_str()); + source.Reply(_("\002{0}\002 was not found on the bad word list of \002{1}\002."), word, ci->name); return; } bool override = !source.AccessFor(ci).HasPriv("BADWORDS"); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "DEL " << badword->word; - source.Reply(_("\002%s\002 deleted from %s bad words list."), badword->word.c_str(), ci->name.c_str()); + source.Reply(_("\002{0}\002 deleted from \002{1}\002 bad words list."), badword->word, ci->name); badwords->EraseBadWord(i); } @@ -377,6 +378,7 @@ class CommandBSBadwords : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; const Anope::string &cmd = params[1]; const Anope::string &word = params.size() > 2 ? params[2] : ""; bool need_args = cmd.equals_ci("LIST") || cmd.equals_ci("CLEAR"); @@ -387,16 +389,16 @@ class CommandBSBadwords : public Command return; } - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } if (!source.AccessFor(ci).HasPriv("BADWORDS") && (!need_args || !source.HasPriv("botserv/administration"))) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "BADWORDS", ci->name); return; } @@ -407,49 +409,91 @@ class CommandBSBadwords : public Command } if (cmd.equals_ci("ADD")) - return this->DoAdd(source, ci, word); + this->DoAdd(source, ci, word); else if (cmd.equals_ci("DEL")) - return this->DoDelete(source, ci, word); + this->DoDelete(source, ci, word); else if (cmd.equals_ci("LIST")) - return this->DoList(source, ci, word); + this->DoList(source, ci, word); else if (cmd.equals_ci("CLEAR")) - return this->DoClear(source, ci); + this->DoClear(source, ci); else this->OnSyntaxError(source, ""); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Maintains the \002bad words list\002 for a channel. The bad\n" - "words list determines which words are to be kicked\n" - "when the bad words kicker is enabled. For more information,\n" - "type \002%s%s HELP KICK %s\002.\n" - " \n" - "The \002ADD\002 command adds the given word to the\n" - "bad words list. If SINGLE is specified, a kick will be\n" - "done only if a user says the entire word. If START is\n" - "specified, a kick will be done if a user says a word\n" - "that starts with \037word\037. If END is specified, a kick\n" - "will be done if a user says a word that ends with\n" - "\037word\037. If you don't specify anything, a kick will\n" - "be issued every time \037word\037 is said by a user.\n" - " \n"), Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), source.command.c_str()); - source.Reply(_("The \002DEL\002 command removes the given word from the\n" - "bad words list. If a list of entry numbers is given, those\n" - "entries are deleted. (See the example for LIST below.)\n" - " \n" - "The \002LIST\002 command displays the bad words list. If\n" - "a wildcard mask is given, only those entries matching the\n" - "mask are displayed. If a list of entry numbers is given,\n" - "only those entries are shown; for example:\n" - " \002#channel LIST 2-5,7-9\002\n" - " Lists bad words entries numbered 2 through 5 and\n" - " 7 through 9.\n" - " \n" - "The \002CLEAR\002 command clears all entries of the\n" - "bad words list.")); + if (subcommand.equals_ci("ADD")) + { + source.Reply(_("Adds \037word\037 to the bad words list for \037channel\037. If \002SINGLE\002 is specified then the user must say the enire word for it to be considered a match." + " If \002START\002 is specified then the user only must say a word that starts with \037word\037." + " Likewise if \002END\002 is specified then the user must only say a word that ends with \037word\037." + " If no argument is specified, then any word which contains \037word\037 will be considered a match.\n" + "\n" + "Examples:\n" + " {command} #anope ADD raw SINGLE\n" + " Adds the bad word \"raw\" to the bad word list of #anope."), + "command"_kw = source.command); + } + else if (subcommand.equals_ci("DEL")) + { + source.Reply(_("Removes \037word\037 from the bad words list for \037channel\037. If a number or list of numbers is given, those entries are deleted.\n" + "\n" + "Examples:\n" + " {command} #anope DEL raw\n" + " Removes the bad word \"raw\" from the bad word list of #anope.\n" + "\n" + " {command} #anope DEL 2-5,7-9\n" + " Removes bad words entries numbered 2 through 5 and 7 through 9 on #anope."), + "command"_kw = source.command); + + } + else if (subcommand.equals_ci("LIST")) + { + source.Reply(_("Lists the badwords for \037channel\037." + " If a wildcard mask is given, only those entries matching the mask are displayed." + " If a list of entry numbers is given, only those entries are shown.\n" + "\n" + "Examples:\n" + " {command} #anope LIST\n" + " Lists the bad words for #anope.\n" + "\n" + " {command} #anope LIST 2-5,7-9\n" + " Lists bad words entries numbered 2 thorough 5 and 7 through 9 on #anope."), + "command"_kw = source.command); + } + else if (subcommand.equals_ci("CLEAR")) + { + source.Reply(_("Clears the bad words for \037channel\037." + "\n" + "\n" + "Example:\n" + " {command} #anope CLEAR\n" + " Clears the bad word list for #anope."), + "command"_kw = source.command); + } + else + { + source.Reply(_("Maintains the bad words list for a channel." + " When a word on the bad words list is said, action may be taken against the offending user.\n" + "\n" + "Use of this command requires the \002{0}\002 privilege on \037channel\037."), + "BADWORDS"); + + CommandInfo *help = source.service->FindCommand("generic/help"); + if (help) + source.Reply(_("\n" + "For help configuring the bad word kicker use \002{msg}{service} HELP KICK BADWORDS\002.\n"//XXX + "\n" + "The \002ADD\002 command adds \037word\037 to the badwords list.\n" + "\002{msg}{service} {help} {command} ADD\002 for more information.\n" + "\n" + "The \002DEL\002 command removes \037word\037 from the badwords list.\n" + "\002{msg}{service} {help} {command} DEL\002 for more information.\n" + "\n" + "The \002LIST\002 and \002CLEAR\002 commands show and clear the bad words list, respectively.\n" + "\002{msg}{service} {help} {command} LIST\002 and \002{msg}{service} {help} {command} CLEAR\002 for more information.\n"), + "msg"_kw = Config->StrictPrivmsg, "service"_kw = source.service->nick, "command"_kw = source.command, "help"_kw = help->cname); + } return true; } }; diff --git a/modules/commands/bs_bot.cpp b/modules/commands/bs_bot.cpp index 977d4b72f..2413e6b6d 100644 --- a/modules/commands/bs_bot.cpp +++ b/modules/commands/bs_bot.cpp @@ -27,7 +27,7 @@ class CommandBSBot : public Command if (BotInfo::Find(nick, true)) { - source.Reply(_("Bot \002%s\002 already exists."), nick.c_str()); + source.Reply(_("Bot \002{0}\002 already exists."), nick); return; } @@ -35,19 +35,19 @@ class CommandBSBot : public Command if (nick.length() > networkinfo->Get<unsigned>("nicklen")) { - source.Reply(_("Bot nicks may only be %d characters long."), networkinfo->Get<unsigned>("nicklen")); + source.Reply(_("Bot nicks may only be \002{0}\002 characters long."), networkinfo->Get<unsigned>("nicklen")); return; } if (user.length() > networkinfo->Get<unsigned>("userlen")) { - source.Reply(_("Bot idents may only be %d characters long."), networkinfo->Get<unsigned>("userlen")); + source.Reply(_("Bot idents may only be \002{0}\002 characters long."), networkinfo->Get<unsigned>("userlen")); return; } if (host.length() > networkinfo->Get<unsigned>("hostlen")) { - source.Reply(_("Bot hosts may only be %d characters long."), networkinfo->Get<unsigned>("hostlen")); + source.Reply(_("Bot hosts may only be \002{0}\002 characters long."), networkinfo->Get<unsigned>("hostlen")); return; } @@ -73,17 +73,22 @@ class CommandBSBot : public Command * if so. You need to drop the nick manually before you can use * it as a bot nick from now on -GD */ - if (NickServ::FindNick(nick)) + NickServ::Nick *na = NickServ::FindNick(nick); + if (na) { - source.Reply(NICK_ALREADY_REGISTERED, nick.c_str()); + source.Reply(_("Nickname \002{0}\002 is already registered!"), na->nick); return; } + User *targ = User::Find(nick, true); + if (targ) + targ->Kill(Me, "Nickname is reserved for services"); + BotInfo *bi = new BotInfo(nick, user, host, real); Log(LOG_ADMIN, source, this) << "ADD " << bi->GetMask() << " " << bi->realname; - source.Reply(_("%s!%s@%s (%s) added to the bot list."), bi->nick.c_str(), bi->GetIdent().c_str(), bi->host.c_str(), bi->realname.c_str()); + source.Reply(_("\002{0}!{1}@{2}\002 (\002{3}\002) added to the bot list."), bi->nick, bi->GetIdent(), bi->host, bi->realname); this->OnBotCreate(&Event::BotCreate::OnBotCreate, bi); } @@ -105,13 +110,13 @@ class CommandBSBot : public Command BotInfo *bi = BotInfo::Find(oldnick, true); if (!bi) { - source.Reply(BOT_DOES_NOT_EXIST, oldnick.c_str()); + source.Reply(_("Bot \002{0}\002 does not exist."), oldnick); return; } if (bi->conf) { - source.Reply(_("Bot %s is not changeable."), bi->nick.c_str()); + source.Reply(_("Bot \002{0}\002 is not changeable because it is configured in services configuration."), bi->nick.c_str()); return; } @@ -119,19 +124,19 @@ class CommandBSBot : public Command if (nick.length() > networkinfo->Get<unsigned>("nicklen")) { - source.Reply(_("Bot nicks may only be %d characters long."), networkinfo->Get<unsigned>("nicklen")); + source.Reply(_("Bot nicknames may only be \002{0}\002 characters long."), networkinfo->Get<unsigned>("nicklen")); return; } if (user.length() > networkinfo->Get<unsigned>("userlen")) { - source.Reply(_("Bot idents may only be %d characters long."), networkinfo->Get<unsigned>("userlen")); + source.Reply(_("Bot usernames may only be \002{0}\002 characters long."), networkinfo->Get<unsigned>("userlen")); return; } if (host.length() > networkinfo->Get<unsigned>("hostlen")) { - source.Reply(_("Bot hosts may only be %d characters long."), networkinfo->Get<unsigned>("hostlen")); + source.Reply(_("Bot hostnames may only be \002{0}\002 characters long."), networkinfo->Get<unsigned>("hostlen")); return; } @@ -140,33 +145,37 @@ class CommandBSBot : public Command * And we must finally check that the nick is not already * taken by another bot. */ - if (nick.equals_cs(bi->nick) && (!user.empty() ? user.equals_cs(bi->GetIdent()) : 1) && (!host.empty() ? host.equals_cs(bi->host) : 1) && (!real.empty() ? real.equals_cs(bi->realname) : 1)) + if (nick.equals_cs(bi->nick) + && (user.empty() || user.equals_cs(bi->GetIdent())) + && (host.empty() || host.equals_cs(bi->host)) + && (real.empty() || real.equals_cs(bi->realname))) { - source.Reply(_("Old info is equal to the new one.")); + source.Reply(_("There is no difference between the current settings and the new settings.")); return; } if (!IRCD->IsNickValid(nick)) { - source.Reply(_("Bot nicks may only contain valid nick characters.")); + source.Reply(_("Bot nicknames may only contain valid nickname characters.")); return; } if (!user.empty() && !IRCD->IsIdentValid(user)) { - source.Reply(_("Bot idents may only contain valid ident characters.")); + source.Reply(_("Bot uesrnames may only contain valid username characters.")); return; } if (!host.empty() && !IRCD->IsHostValid(host)) { - source.Reply(_("Bot hosts may only contain valid host characters.")); + source.Reply(_("Bot hostnames may only contain valid hostname characters.")); return; } - if (!nick.equals_ci(bi->nick) && BotInfo::Find(nick, true)) + BotInfo *newbi = BotInfo::Find(nick, true); + if (newbi && bi != newbi) { - source.Reply(_("Bot \002%s\002 already exists."), nick.c_str()); + source.Reply(_("Bot \002{0}\002 already exists."), newbi->nick); return; } @@ -176,9 +185,10 @@ class CommandBSBot : public Command * if so. You need to drop the nick manually before you can use * it as a bot nick from now on -GD */ - if (NickServ::FindNick(nick)) + NickServ::Nick *na = NickServ::FindNick(nick); + if (na) { - source.Reply(NICK_ALREADY_REGISTERED, nick.c_str()); + source.Reply(_("Nickname \002{0}\002 is already registered."), na->nick); return; } @@ -199,11 +209,11 @@ class CommandBSBot : public Command if (!nick.equals_cs(bi->nick)) bi->SetNewNick(nick); - if (!user.empty() && !user.equals_cs(bi->GetIdent())) + if (!user.equals_cs(bi->GetIdent())) bi->SetIdent(user); - if (!host.empty() && !host.equals_cs(bi->host)) + if (!host.equals_cs(bi->host)) bi->host = host; - if (!real.empty() && !real.equals_cs(bi->realname)) + if (real.equals_cs(bi->realname)) bi->realname = real; if (!user.empty()) @@ -220,7 +230,7 @@ class CommandBSBot : public Command } } - source.Reply(_("Bot \002%s\002 has been changed to %s!%s@%s (%s)."), oldnick.c_str(), bi->nick.c_str(), bi->GetIdent().c_str(), bi->host.c_str(), bi->realname.c_str()); + source.Reply(_("Bot \002{0}\002 has been changed to \002{1}!{2}@{3}\002 (\002{4}\002)."), oldnick, bi->nick, bi->GetIdent(), bi->host, bi->realname); Log(LOG_ADMIN, source, this) << "CHANGE " << oldnick << " to " << bi->GetMask() << " " << bi->realname; this->OnBotChange(&Event::BotChange::OnBotChange, bi); @@ -239,13 +249,13 @@ class CommandBSBot : public Command BotInfo *bi = BotInfo::Find(nick, true); if (!bi) { - source.Reply(BOT_DOES_NOT_EXIST, nick.c_str()); + source.Reply(_("Bot \002{0}\002 does not exist."), nick); return; } if (bi->conf) { - source.Reply(_("Bot %s is not deletable."), bi->nick.c_str()); + source.Reply(_("Bot \002{0}\002 is can not be deleted because it is configured in services configuration."), bi->nick); return; } @@ -253,7 +263,7 @@ class CommandBSBot : public Command Log(LOG_ADMIN, source, this) << "DEL " << bi->nick; - source.Reply(_("Bot \002%s\002 has been deleted."), nick.c_str()); + source.Reply(_("Bot \002{0}\002 has been deleted."), bi->nick); delete bi; } @@ -261,9 +271,9 @@ class CommandBSBot : public Command CommandBSBot(Module *creator) : Command(creator, "botserv/bot", 1, 6), OnBotCreate(creator, "OnBotCreate"), OnBotChange(creator, "OnBotChange"), OnBotDelete(creator, "OnBotDelete") { this->SetDesc(_("Maintains network bot list")); - this->SetSyntax(_("\002ADD \037nick\037 \037user\037 \037host\037 \037real\037\002")); - this->SetSyntax(_("\002CHANGE \037oldnick\037 \037newnick\037 [\037user\037 [\037host\037 [\037real\037]]]\002")); - this->SetSyntax(_("\002DEL \037nick\037\002")); + this->SetSyntax(_("\002ADD \037nicknae\037 \037username\037 \037hostname\037 \037realname\037\002")); + this->SetSyntax(_("\002CHANGE \037oldnickname\037 \037newnickname\037 [\037username\037 [\037hostname\037 [\037realname\037]]]\002")); + this->SetSyntax(_("\002DEL \037nickname\037\002")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -271,20 +281,17 @@ class CommandBSBot : public Command const Anope::string &cmd = params[0]; if (Anope::ReadOnly) - { - source.Reply(_("Sorry, bot modification is temporarily disabled.")); - return; - } + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); if (cmd.equals_ci("ADD")) { - // ADD nick user host real - 5 if (!source.HasCommand("botserv/bot/add")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have access to the operator command \002{0}\002."), "botserv/bot/add"); return; } + // ADD nick user host real - 5 if (params.size() < 5) { this->OnSyntaxError(source, "ADD"); @@ -296,7 +303,7 @@ class CommandBSBot : public Command if (tempparams.size() >= 6) tempparams[4] = tempparams[4] + " " + tempparams[5]; - return this->DoAdd(source, tempparams); + this->DoAdd(source, tempparams); } else if (cmd.equals_ci("CHANGE")) { @@ -304,7 +311,7 @@ class CommandBSBot : public Command // but only oldn and newn are required if (!source.HasCommand("botserv/bot/change")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have access to the operator command \002{0}\002."), "botserv/bot/change"); return; } @@ -314,14 +321,14 @@ class CommandBSBot : public Command return; } - return this->DoChange(source, params); + this->DoChange(source, params); } else if (cmd.equals_ci("DEL")) { // DEL nick if (!source.HasCommand("botserv/bot/del")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have access to the operator command \002{0}\002."), "botserv/bot/del"); return; } @@ -331,35 +338,58 @@ class CommandBSBot : public Command return; } - return this->DoDel(source, params); + this->DoDel(source, params); } else this->OnSyntaxError(source, ""); - - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Allows Services Operators to create, modify, and delete\n" - "bots that users will be able to use on their own\n" - "channels.\n" - " \n" - "\002BOT ADD\002 adds a bot with the given nickname, username,\n" - "hostname and realname. Since no integrity checks are done\n" - "for these settings, be really careful.\n" - " \n" - "\002BOT CHANGE\002 allows to change the nickname, username, hostname\n" - "or realname of a bot without actually having to delete it (and\n" - "all the data associated with it).\n" - " \n" - "\002BOT DEL\002 removes the given bot from the bot list.\n" - " \n" - "\002Note\002: you cannot create a bot that has a nick that is\n" - "currently registered. If an unregistered user is currently\n" - "using the nick, they will be killed.")); + if (subcommand.equals_ci("ADD")) + source.Reply(_("\002{command} ADD\002 adds a bot with the given \037nickname\037, \037username\037, \037hostname\037 and \037realname\037." + " You can not create a bot with a nickname that is currently registered. If an unregistered user is currently using the nick, they will be killed.\n" + " Once a bot is created, users will be able to assign the bot to their channels. This command requires the opererator privilege for command \002{0}\002." + "\n" + "Example:\n" + " {command} ADD Botox Botox services.anope.org Botox\n" + " Adds a service bot with nickname \"Botox\", username \"Botox\", hostname \"services.anope.org\", and realname \"Botox\" to the bot list."), + "botserv/bot/add", "command"_kw = source.command); + else if (subcommand.equals_ci("CHANGE")) + source.Reply(_("\002{command} CHANGE\002 allows changing the \037nickname\037, \037username\037, \037hostname\037 and \037realname\037 of bot \037oldnickname\037." + " If a new username, hostname, or realname is specified, then the bot \037nickname\037 will quit and rejoin all of its channels using the new mask." + " Otherwise, the bot simply change nick to \037newnickname\037. All settings on the bot, such as channels and no-bot, are retained." + " This command requires the operator privilege for command \002{0}\002." + "\n" + "Example:\n" + " {command} CHANGE Botox peer connection reset.by peer\n" + " Renames the bot \"Botox\" to \"peer\" with the given username, hostname, and realname."), + "botserv/bot/change", "command"_kw = source.command); + else if (subcommand.equals_ci("DEL")) + source.Reply(_("\002{command} DEL\002 removes the bot \037nickname\037 from the bot list. The bot will quit from any channels it is in, and will not be replaced." + " This command requires the operator privilege for command \002{0}\002.\n" + "\n" + "Example:\n" + " {command} DEL peer\n" + " Removes the bot \"peer\" from the bot list."), + "botserv/bot/del", "command"_kw = source.command); + else + { + source.Reply(_("Allows Services Operators to create, modify, and delete bots that users will be able to use on their channels.")); + + CommandInfo *help = source.service->FindCommand("generic/help"); + if (help) + source.Reply(_("\n" + "The \002ADD\002 command adds a bot with the given \037nickname\037, \037username\037, \037hostname\037 and \037realname\037 to the bot list.\n" + "\002{msg}{service} {help} {command} ADD\002 for more information.\n" + "\n" + "The \002CHANGE\002 command allows changing the \037nickname\037, \037username\037, \037hostname\037 and \037realname\037 of bot \037oldnickname\037.\n" + "\002{msg}{service} {help} {command} CHANGE\002 for more information.\n" + "\n" + "The \002{command} DEL\002 removes the bot \037nickname\037 from the bot list.\n" + "\002{msg}{service} {help} {command} DEL\002 for more information."), + "msg"_kw = Config->StrictPrivmsg, "help"_kw = help->cname, "command"_kw = source.command); + } return true; } }; diff --git a/modules/commands/bs_botlist.cpp b/modules/commands/bs_botlist.cpp index 2ee130aba..85855bb82 100644 --- a/modules/commands/bs_botlist.cpp +++ b/modules/commands/bs_botlist.cpp @@ -44,8 +44,7 @@ class CommandBSBotList : public Command list.Process(replies); if (!count) - source.Reply(_("There are no bots available at this time.\n" - "Ask a Services Operator to create one!")); + source.Reply(_("There are no bots available at this time.")); else { source.Reply(_("Bot list:")); @@ -53,16 +52,28 @@ class CommandBSBotList : public Command for (unsigned i = 0; i < replies.size(); ++i) source.Reply(replies[i]); - source.Reply(_("%d bots available."), count); + source.Reply(_("{0} bots available."), count); } } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Lists all available bots on this network.\n" - "Bots prefixed by a * are reserved for IRC Operators.")); + BotInfo *bi; + Anope::string name; + Command::FindCommandFromService("botserv/assign", bi, name); + if (!bi) + return false; + + source.Reply(_("Lists all available bots. You may use the \002{msg}{service} {assign}\002 command to assign a bot to your channel." + "The bot names are vanity; they all proviate the same commands and features."), + "msg"_kw = Config->StrictPrivmsg, "service"_kw = bi->nick, "assign"_kw = name); + if (source.HasPriv("botserv/administration")) + source.Reply(_("Bots prefixed by a * are reserved for Services Operators with the privilege \002{0}\002."), + "botserv/administration"); + source.Reply(_("\n" + "Example:\n" + " {command} BOTLIST"), + "command"_kw = source.command); return true; } }; diff --git a/modules/commands/bs_control.cpp b/modules/commands/bs_control.cpp index 0311a9df2..74e978404 100644 --- a/modules/commands/bs_control.cpp +++ b/modules/commands/bs_control.cpp @@ -22,30 +22,38 @@ class CommandBSSay : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; const Anope::string &text = params[1]; - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } if (!source.AccessFor(ci).HasPriv("SAY") && !source.HasPriv("botserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SAY", ci->name); return; } if (!ci->bi) { - source.Reply(BOT_NOT_ASSIGNED); + source.Reply(_("There is no bot assigned to \002{0}\002. One must be assigned to the channel before this command can be used."), ci->name); + BotInfo *bi; + Anope::string name; + Command::FindCommandFromService("botserv/assign", bi, name); + CommandInfo *help = source.service->FindCommand("generic/help"); + if (bi && help) + source.Reply(_("See \002{msg}{service} {help} {command}\002 for information on assigning bots."), + "msg"_kw = Config->StrictPrivmsg, "service"_kw = bi->nick, "help"_kw = help->cname, "command"_kw = name); return; } if (!ci->c || !ci->c->FindUser(ci->bi)) { - source.Reply(BOT_NOT_ON_CHANNEL, ci->name.c_str()); + source.Reply(_("Bot \002{0}\002 is not on channel \002{1}\002."), ci->bi->nick, ci->name); return; } @@ -66,7 +74,11 @@ class CommandBSSay : public Command { this->SendSyntax(source); source.Reply(" "); - source.Reply(_("Makes the bot say the given text on the given channel.")); + source.Reply(_("Makes the bot say the given \037text\037 on \037channel\037.\n" + "\n" + "Example:\n" + " {command} #anope mmm pie\n" + " Makes the assigned service bot say \"mmm pie\".")); return true; } }; @@ -82,30 +94,38 @@ class CommandBSAct : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; Anope::string message = params[1]; - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } if (!source.AccessFor(ci).HasPriv("SAY") && !source.HasPriv("botserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SAY", ci->name); return; } if (!ci->bi) { - source.Reply(BOT_NOT_ASSIGNED); + source.Reply(_("There is no bot assigned to \002{0}\002. One must be assigned to the channel before this command can be used."), ci->name); + BotInfo *bi; + Anope::string name; + Command::FindCommandFromService("botserv/assign", bi, name); + CommandInfo *help = source.service->FindCommand("generic/help"); + if (bi && help) + source.Reply(_("See \002{msg}{service} {help} {command}\002 for information on assigning bots."), + "msg"_kw = Config->StrictPrivmsg, "service"_kw = bi->nick, "help"_kw = help->cname, "command"_kw = name); return; } if (!ci->c || !ci->c->FindUser(ci->bi)) { - source.Reply(BOT_NOT_ON_CHANNEL, ci->name.c_str()); + source.Reply(_("Bot \002{0}\002 is not on channel \002{1}\002."), ci->bi->nick, ci->name); return; } @@ -122,10 +142,12 @@ class CommandBSAct : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Makes the bot do the equivalent of a \"/me\" command\n" - "on the given channel using the given text.")); + source.Reply(_("Makes the assigned bot do the equivalent of a \"/me\" command on \037channel\037 using the given \037text\037.\n" + "\n" + "Example:\n" + " {command} #anope slaps Cronus\n" + " Shows the assigned service bot \"slapping\" Cronus."), + "command"_kw = source.command); return true; } }; diff --git a/modules/commands/bs_info.cpp b/modules/commands/bs_info.cpp index 88ac15a48..677dfaaf6 100644 --- a/modules/commands/bs_info.cpp +++ b/modules/commands/bs_info.cpp @@ -16,23 +16,6 @@ class CommandBSInfo : public Command { - private: - void send_bot_channels(std::vector<Anope::string> &buffers, const BotInfo *bi) - { - Anope::string buf; - for (ChanServ::Channel *ci : bi->GetChannels()) - { - buf += " " + ci->name + " "; - if (buf.length() > 300) - { - buffers.push_back(buf); - buf.clear(); - } - } - if (!buf.empty()) - buffers.push_back(buf); - } - EventHandlers<Event::BotInfoEvent> &onbotinfo; public: @@ -68,10 +51,10 @@ class CommandBSInfo : public Command if (source.HasPriv("botserv/administration")) { - std::vector<Anope::string> buf; - this->send_bot_channels(buf, bi); - for (unsigned i = 0; i < buf.size(); ++i) - source.Reply(buf[i]); + Anope::string buf; + for (ChanServ::Channel *ci : bi->GetChannels()) + buf += " " + ci->name; + source.Reply(buf); } } @@ -79,11 +62,11 @@ class CommandBSInfo : public Command { if (!source.AccessFor(ci).HasPriv("INFO") && !source.HasPriv("botserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "INFO", ci->name); return; } - source.Reply(CHAN_INFO_HEADER, ci->name.c_str()); + source.Reply(_("Information for channel \002{0}\002:"), ci->name); info[_("Bot nick")] = ci->bi ? ci->bi->nick : _("not assigned yet"); Anope::string enabled = Language::Translate(source.nc, _("Enabled")); @@ -98,18 +81,15 @@ class CommandBSInfo : public Command source.Reply(replies[i]); } else - source.Reply(_("\002%s\002 is not a valid bot or registered channel."), query.c_str()); + source.Reply(_("\002{0}\002 is not a valid bot or registered channel."), query.c_str()); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Allows you to see %s information about a channel or a bot.\n" - "If the parameter is a channel, then you'll get information\n" - "such as enabled kickers. If the parameter is a nick,\n" - "you'll get information about a bot, such as creation\n" - "time or number of channels it is on."), source.service->nick.c_str()); + source.Reply(_("Allows you to see {0} information about a channel or a bot." + " If the parameter is a channel, then you'll get information such as enabled kickers." + " If the parameter is a bot nickname, you'll get information about a bot, such as creation time and number of channels it is on."), + source.service->nick); return true; } diff --git a/modules/commands/bs_kick.cpp b/modules/commands/bs_kick.cpp index 7ffd9d353..c0ea685c5 100644 --- a/modules/commands/bs_kick.cpp +++ b/modules/commands/bs_kick.cpp @@ -130,9 +130,10 @@ class CommandBSKick : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Configures bot kickers. \037option\037 can be one of:")); + source.Reply(_("Configures bot kickers." + " Use of this command requires the \002SET\002 privilege on \037channel\037.\n" + "\n" + "Available kickers:")); Anope::string this_name = source.command; for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it) @@ -151,11 +152,10 @@ class CommandBSKick : public Command } } - source.Reply(_("Type \002%s%s HELP %s \037option\037\002 for more information\n" - "on a specific option.\n" - " \n" - "Note: access to this command is controlled by the\n" - "level SET."), Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), this_name.c_str()); + CommandInfo *help = source.service->FindCommand("generic/help"); + if (help) + source.Reply(_("See \002{0}{1} {2} {3} \037option\037\002 for more information on a specific option."), + Config->StrictPrivmsg, source.service->nick, help->cname, this_name); return true; } @@ -168,9 +168,9 @@ class CommandBSKickBase : public Command { } - virtual void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override = 0; + virtual void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override anope_abstract; - virtual bool OnHelp(CommandSource &source, const Anope::string &subcommand) override = 0; + virtual bool OnHelp(CommandSource &source, const Anope::string &subcommand) override anope_abstract; protected: bool CheckArguments(CommandSource &source, const std::vector<Anope::string> ¶ms, ChanServ::Channel* &ci) @@ -183,52 +183,58 @@ class CommandBSKickBase : public Command if (Anope::ReadOnly) source.Reply(_("Sorry, kicker configuration is temporarily disabled.")); else if (ci == NULL) - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); else if (option.empty()) this->OnSyntaxError(source, ""); else if (!option.equals_ci("ON") && !option.equals_ci("OFF")) this->OnSyntaxError(source, ""); else if (!source.AccessFor(ci).HasPriv("SET") && !source.HasPriv("botserv/administration")) - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->name); else if (!ci->bi) - source.Reply(BOT_NOT_ASSIGNED); + source.Reply(_("There is no bot assigned to \002{0}\002."), ci->name); else return true; return false; } + bool CheckTTB(CommandSource &source, const Anope::string &ttb, int16_t &i) + { + i = 0; + if (ttb.empty()) + return true; + + try + { + i = convertTo<int16_t>(ttb); + if (i < 0) + throw ConvertException(); + } + catch (const ConvertException &) + { + i = 0; + source.Reply(_("\002{0}\002 can not be taken as times to ban. Times to ban must be a positive integer."), ttb); + return false; + } + + return true; + } + void Process(CommandSource &source, ChanServ::Channel *ci, const Anope::string ¶m, const Anope::string &ttb, size_t ttb_idx, const Anope::string &optname, KickerData *kd, bool &val) { if (param.equals_ci("ON")) { - if (!ttb.empty()) - { - int16_t i; - - try - { - i = convertTo<int16_t>(ttb); - if (i < 0) - throw ConvertException(); - } - catch (const ConvertException &) - { - source.Reply(_("\002%s\002 cannot be taken as times to ban."), ttb.c_str()); - return; - } + int16_t i; + if (!CheckTTB(source, ttb, i)) + return; - kd->ttb[ttb_idx] = i; - } - else - kd->ttb[ttb_idx] = 0; + kd->ttb[ttb_idx] = i; val = true; if (kd->ttb[ttb_idx]) - source.Reply(_("Bot will now kick for \002%s\002, and will place a ban\n" - "after %d kicks for the same user."), optname.c_str(), kd->ttb[ttb_idx]); + source.Reply(_("Bot will now kick for \002{0}\002, and will place a ban after \002{1}\002 kicks for the same user."), optname, kd->ttb[ttb_idx]); else - source.Reply(_("Bot will now kick for \002%s\002."), optname.c_str()); + source.Reply(_("Bot will now kick for \002{0}\002."), optname); bool override = !source.AccessFor(ci).HasPriv("SET"); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable the " << optname << "kicker"; @@ -239,7 +245,7 @@ class CommandBSKickBase : public Command Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable the " << optname << "kicker"; val = false; - source.Reply(_("Bot won't kick for \002%s\002 anymore."), optname.c_str()); + source.Reply(_("Bot won't kick for \002{0}\002 anymore."), optname); } else this->OnSyntaxError(source, ""); @@ -268,16 +274,10 @@ class CommandBSKickAMSG : public CommandBSKickBase bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - BotInfo *bi = Config->GetClient("BotServ"); - source.Reply(_("Sets the AMSG kicker on or off. When enabled, the bot will\n" - "kick users who send the same message to multiple channels\n" - "where %s bots are.\n" - " \n" - "\037ttb\037 is the number of times a user can be kicked\n" - "before they get banned. Don't give ttb to disable\n" - "the ban system once activated."), bi ? bi->nick.c_str() : "BotServ"); + source.Reply(_("Sets the AMSG kicker on or off on \037channel\037. When enabled, the bot will kick users who send the same message to multiple channels where {0} bots are.\n" + "\n" + "\037ttb\037 is the number of times a user can be kicked before they get banned. Don't give ttb to disable the ban system."), + source.service->nick); return true; } }; @@ -300,23 +300,19 @@ class CommandBSKickBadwords : public CommandBSKickBase Process(source, ci, params[1], params.size() > 2 ? params[2] : "", TTB_BADWORDS, "badwords", kd, kd->badwords); kd->Check(ci); } - } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Sets the bad words kicker on or off. When enabled, this\n" - "option tells the bot to kick users who say certain words\n" - "on the channels.\n" - "You can define bad words for your channel using the\n" - "\002BADWORDS\002 command. Type \002%s%s HELP BADWORDS\002 for\n" - "more information.\n" - " \n" - "\037ttb\037 is the number of times a user can be kicked\n" - "before it gets banned. Don't give ttb to disable\n" - "the ban system once activated."), Config->StrictPrivmsg.c_str(), source.service->nick.c_str()); + BotInfo *bi; + Anope::string name; + CommandInfo *help; + source.Reply(_("Sets the bad words kicker on or off on \037channel\037. When enabled, the bot will kick users who say certain words on the channel.")); + if (Command::FindCommandFromService("botserv/badwords", bi, name) && (help = bi->FindCommand("generic/help"))) + source.Reply(_("You can define bad words for your channel using the \002{0}\002 command. See \002{1}{2} {3} {4}\002 for more information."), + name, Config->StrictPrivmsg, bi->nick, help->cname, name); + source.Reply(_("\n" + "\037ttb\037 is the number of times a user can be kicked before they get banned. Don't give ttb to disable the ban system.")); return true; } }; @@ -343,14 +339,9 @@ class CommandBSKickBolds : public CommandBSKickBase bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Sets the bolds kicker on or off. When enabled, this\n" - "option tells the bot to kick users who use bolds.\n" - " \n" - "\037ttb\037 is the number of times a user can be kicked\n" - "before it gets banned. Don't give ttb to disable\n" - "the ban system once activated.")); + source.Reply(_("Sets the bolds kicker on or off on \037channel\037. When enabled, the bot will kick users who use \002bolds\002.\n" + "\n" + "\037ttb\037 is the number of times a user can be kicked before they get banned. Don't give ttb to disable the ban system.")); return true; } }; @@ -378,24 +369,11 @@ class CommandBSKickCaps : public CommandBSKickBase &min = params.size() > 3 ? params[3] : "", &percent = params.size() > 4 ? params[4] : ""; - if (!ttb.empty()) - { - try - { - kd->ttb[TTB_CAPS] = convertTo<int16_t>(ttb); - if (kd->ttb[TTB_CAPS] < 0) - throw ConvertException(); - } - catch (const ConvertException &) - { - kd->ttb[TTB_CAPS] = 0; - source.Reply(_("\002%s\002 cannot be taken as times to ban."), ttb.c_str()); - return; - } - } - else - kd->ttb[TTB_CAPS] = 0; + int16_t i; + if (!CheckTTB(source, ttb, i)) + return; + kd->ttb[TTB_CAPS] = i; kd->capsmin = 10; try { @@ -416,12 +394,9 @@ class CommandBSKickCaps : public CommandBSKickBase kd->caps = true; if (kd->ttb[TTB_CAPS]) - source.Reply(_("Bot will now kick for \002caps\002 (they must constitute at least\n" - "%d characters and %d%% of the entire message), and will\n" - "place a ban after %d kicks for the same user."), kd->capsmin, kd->capspercent, kd->ttb[TTB_CAPS]); + source.Reply(_("Bot will now kick for \002caps\002 if they constitute at least {0} characters and {1}% of the entire message, and will place a ban after {2} kicks for the same user."), kd->capsmin, kd->capspercent, kd->ttb[TTB_CAPS]); else - source.Reply(_("Bot will now kick for \002caps\002 (they must constitute at least\n" - "%d characters and %d%% of the entire message)."), kd->capsmin, kd->capspercent); + source.Reply(_("Bot will now kick for \002caps\002 if they constitute at least {0} characters and {1}% of the entire message."), kd->capsmin, kd->capspercent); } else { @@ -434,19 +409,11 @@ class CommandBSKickCaps : public CommandBSKickBase bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Sets the caps kicker on or off. When enabled, this\n" - "option tells the bot to kick users who are talking in\n" - "CAPS.\n" - "The bot kicks only if there are at least \002min\002 caps\n" - "and they constitute at least \002percent\002%% of the total\n" - "text line (if not given, it defaults to 10 characters\n" - "and 25%%).\n" - " \n" - "\037ttb\037 is the number of times a user can be kicked\n" - "before it gets banned. Don't give ttb to disable\n" - "the ban system once activated.")); + source.Reply(_("Sets the caps kicker on or off on \037channel\037. When enabled, the bot will kick users who talk in CAPS." + " The bot kicks only if there are at least \002min\002 caps and they constitute at least \002percent\002% of the total text line." + " (if not given, it defaults to 10 characters and 25%).\n" + "\n" + "\037ttb\037 is the number of times a user can be kicked before they get banned. Don't give ttb to disable the ban system.")); return true; } }; @@ -473,14 +440,9 @@ class CommandBSKickColors : public CommandBSKickBase bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Sets the colors kicker on or off. When enabled, this\n" - "option tells the bot to kick users who use colors.\n" - " \n" - "\037ttb\037 is the number of times a user can be kicked\n" - "before it gets banned. Don't give ttb to disable\n" - "the ban system once activated.")); + source.Reply(_("Sets the colors kicker on or off on \037channel\037. When enabled, the bot will kick users who use \00304c\00307o\00308l\00303o\00306r\00312s\017.\n" + "\n" + "\037ttb\037 is the number of times a user can be kicked before they get banned. Don't give ttb to disable the ban system.")); return true; } }; @@ -491,7 +453,7 @@ class CommandBSKickFlood : public CommandBSKickBase CommandBSKickFlood(Module *creator) : CommandBSKickBase(creator, "botserv/kick/flood", 2, 5) { this->SetDesc(_("Configures flood kicker")); - this->SetSyntax(_("\037channel\037 {\037ON|OFF\037} [\037ttb\037 [\037ln\037 [\037secs\037]]]\002")); + this->SetSyntax(_("\037channel\037 {\037ON|OFF\037} [\037ttb\037 [\037lines\037 [\037seconds\037]]]\002")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -508,27 +470,11 @@ class CommandBSKickFlood : public CommandBSKickBase &lines = params.size() > 3 ? params[3] : "", &secs = params.size() > 4 ? params[4] : ""; - if (!ttb.empty()) - { - int16_t i; - - try - { - i = convertTo<int16_t>(ttb); - if (i < 1) - throw ConvertException(); - } - catch (const ConvertException &) - { - source.Reply(_("\002%s\002 cannot be taken as times to ban."), ttb.c_str()); - return; - } - - kd->ttb[TTB_FLOOD] = i; - } - else - kd->ttb[TTB_FLOOD] = 0; + int16_t i; + if (!CheckTTB(source, ttb, i)) + return; + kd->ttb[TTB_FLOOD] = i; kd->floodlines = 6; try { @@ -551,10 +497,9 @@ class CommandBSKickFlood : public CommandBSKickBase kd->flood = true; if (kd->ttb[TTB_FLOOD]) - source.Reply(_("Bot will now kick for \002flood\002 (%d lines in %d seconds\n" - "and will place a ban after %d kicks for the same user."), kd->floodlines, kd->floodsecs, kd->ttb[TTB_FLOOD]); + source.Reply(_("Bot will now kick for \002flood\002 ({0} lines in {1} seconds and will place a ban after {2} kicks for the same user."), kd->floodlines, kd->floodsecs, kd->ttb[TTB_FLOOD]); else - source.Reply(_("Bot will now kick for \002flood\002 (%d lines in %d seconds)."), kd->floodlines, kd->floodsecs); + source.Reply(_("Bot will now kick for \002flood\002 ({0} lines in {1} seconds)."), kd->floodlines, kd->floodsecs); } else if (params[1].equals_ci("OFF")) { @@ -569,16 +514,9 @@ class CommandBSKickFlood : public CommandBSKickBase bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Sets the flood kicker on or off. When enabled, this\n" - "option tells the bot to kick users who are flooding\n" - "the channel using at least \002ln\002 lines in \002secs\002 seconds\n" - "(if not given, it defaults to 6 lines in 10 seconds).\n" - " \n" - "\037ttb\037 is the number of times a user can be kicked\n" - "before it gets banned. Don't give ttb to disable\n" - "the ban system once activated.")); + source.Reply(_("Sets the flood kicker on or off on \037channel\037. When enabled, the bot to kick users who are flooding the channel with at least \037lines\037 lines in \037seconds\037 seconds. If not given, it defaults to 6 lines in 10 seconds.\n" + "\n" + "\037ttb\037 is the number of times a user can be kicked before they get banned. Don't give ttb to disable the ban system.")); return true; } }; @@ -605,14 +543,9 @@ class CommandBSKickItalics : public CommandBSKickBase bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Sets the italics kicker on or off. When enabled, this\n" - "option tells the bot to kick users who use italics.\n" - " \n" - "\037ttb\037 is the number of times a user can be kicked\n" - "before it gets banned. Don't give ttb to disable\n" - "the ban system once activated.")); + source.Reply(_("Sets the italics kicker on or off on \037channel\037. When enabled, the bot will kick users who use \035italics\035." + "\n" + "\037ttb\037 is the number of times a user can be kicked before they get banned. Don't give ttb to disable the ban system.")); return true; } }; @@ -639,27 +572,11 @@ class CommandBSKickRepeat : public CommandBSKickBase const Anope::string &ttb = params.size() > 2 ? params[2] : "", × = params.size() > 3 ? params[3] : ""; - if (!ttb.empty()) - { - int16_t i; - - try - { - i = convertTo<int16_t>(ttb); - if (i < 0) - throw ConvertException(); - } - catch (const ConvertException &) - { - source.Reply(_("\002%s\002 cannot be taken as times to ban."), ttb.c_str()); - return; - } - - kd->ttb[TTB_REPEAT] = i; - } - else - kd->ttb[TTB_REPEAT] = 0; + int16_t i; + if (!CheckTTB(source, ttb, i)) + return; + kd->ttb[TTB_REPEAT] = i; kd->repeattimes = 3; try { @@ -671,12 +588,9 @@ class CommandBSKickRepeat : public CommandBSKickBase kd->repeat = true; if (kd->ttb[TTB_REPEAT]) - source.Reply(_("Bot will now kick for \002repeats\002 (users that say the\n" - "same thing %d times), and will place a ban after %d\n" - "kicks for the same user."), kd->repeattimes + 1, kd->ttb[TTB_REPEAT]); + source.Reply(_("Bot will now kick for \002repeats\002 (users that say the same thing {0} times), and will place a ban after {1} kicks for the same user."), kd->repeattimes + 1, kd->ttb[TTB_REPEAT]); else - source.Reply(_("Bot will now kick for \002repeats\002 (users that say the\n" - "same thing %d times)."), kd->repeattimes + 1); + source.Reply(_("Bot will now kick for \002repeats\002 (users that say the same thing {0} times)."), kd->repeattimes + 1); } else if (params[1].equals_ci("OFF")) { @@ -691,16 +605,9 @@ class CommandBSKickRepeat : public CommandBSKickBase bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Sets the repeat kicker on or off. When enabled, this\n" - "option tells the bot to kick users who are repeating\n" - "themselves \002num\002 times (if num is not given, it\n" - "defaults to 3).\n" - " \n" - "\037ttb\037 is the number of times a user can be kicked\n" - "before it gets banned. Don't give ttb to disable\n" - "the ban system once activated.")); + source.Reply(_("Sets the repeat kicker on or off. When enabled, the bot will kick users who repeat themselves \037num\037 times. If \037num\037 is not given, it defaults to 3.\n" + "\n" + "\037ttb\037 is the number of times a user can be kicked before they get banned. Don't give ttb to disable the ban system.")); return true; } }; @@ -727,14 +634,9 @@ class CommandBSKickReverses : public CommandBSKickBase bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Sets the reverses kicker on or off. When enabled, this\n" - "option tells the bot to kick users who use reverses.\n" - " \n" - "\037ttb\037 is the number of times a user can be kicked\n" - "before it gets banned. Don't give ttb to disable\n" - "the ban system once activated.")); + source.Reply(_("Sets the reverses kicker on or off. When enabled, the bot will kick users who use \026reverses\026.\n" + "\n" + "\037ttb\037 is the number of times a user can be kicked before they get banned. Don't give ttb to disable the ban system.")); return true; } }; @@ -761,14 +663,9 @@ class CommandBSKickUnderlines : public CommandBSKickBase bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Sets the underlines kicker on or off. When enabled, this\n" - "option tells the bot to kick users who use underlines.\n" - " \n" - "\037ttb\037 is the number of times a user can be kicked\n" - "before it gets banned. Don't give ttb to disable\n" - "the ban system once activated.")); + source.Reply(_("Sets the underlines kicker on or off. When enabled, the bot will kick users who use \037underlines\037\n" + "\n" + "\037ttb\037 is the number of times a user can be kicked before they get banned. Don't give ttb to disable the ban system.")); return true; } }; @@ -787,14 +684,14 @@ class CommandBSSetDontKickOps : public Command ChanServ::Channel *ci = ChanServ::Find(params[0]); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), params[0]); return; } ChanServ::AccessGroup access = source.AccessFor(ci); if (!source.HasPriv("botserv/administration") && !access.HasPriv("SET")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->name); return; } @@ -811,7 +708,7 @@ class CommandBSSetDontKickOps : public Command Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable dontkickops"; kd->dontkickops = true; - source.Reply(_("Bot \002won't kick ops\002 on channel %s."), ci->name.c_str()); + source.Reply(_("Bot \002won't kick ops\002 on channel \002{0}\002."), ci->name); } else if (params[1].equals_ci("OFF")) { @@ -819,7 +716,7 @@ class CommandBSSetDontKickOps : public Command Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable dontkickops"; kd->dontkickops = false; - source.Reply(_("Bot \002will kick ops\002 on channel %s."), ci->name.c_str()); + source.Reply(_("Bot \002will kick ops\002 on channel \002{0}\002."), ci->name); } else this->OnSyntaxError(source, source.command); @@ -829,11 +726,11 @@ class CommandBSSetDontKickOps : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(_(" \n" - "Enables or disables \002ops protection\002 mode on a channel.\n" - "When it is enabled, ops won't be kicked by the bot\n" - "even if they don't match the NOKICK level.")); + source.Reply(_("Enables or disables \002op protection\002 mode on a channel." + " When it is enabled, ops won't be kicked by the bot, even if they don't have the \002{0}\002 privilege.\n" + "\n" + "Use of this command requires the \002{1}\002 privilege on \037channel\037."), + "NOKICK", "SET"); return true; } }; @@ -852,14 +749,14 @@ class CommandBSSetDontKickVoices : public Command ChanServ::Channel *ci = ChanServ::Find(params[0]); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), params[0]); return; } ChanServ::AccessGroup access = source.AccessFor(ci); if (!source.HasPriv("botserv/administration") && !access.HasPriv("SET")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->name); return; } @@ -894,11 +791,11 @@ class CommandBSSetDontKickVoices : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(_(" \n" - "Enables or disables \002voices protection\002 mode on a channel.\n" - "When it is enabled, voices won't be kicked by the bot\n" - "even if they don't match the NOKICK level.")); + source.Reply(_("Enables or disables \002voice protection\002 mode on a channel." + " When it is enabled, ops won't be kicked by the bot, even if they don't have the \002{0}\002 privilege.\n" + "\n" + "Use of this command requires the \002{1}\002 privilege on \037channel\037."), + "NOKICK", "SET"); return true; } }; diff --git a/modules/commands/bs_set.cpp b/modules/commands/bs_set.cpp index 9c92e462c..ff788eefd 100644 --- a/modules/commands/bs_set.cpp +++ b/modules/commands/bs_set.cpp @@ -28,10 +28,8 @@ class CommandBSSet : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); source.Reply(_("Configures bot options.\n" - " \n" + "\n" "Available options:")); Anope::string this_name = source.command; for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it) @@ -48,8 +46,11 @@ class CommandBSSet : public Command } } } - source.Reply(_("Type \002%s%s HELP %s \037option\037\002 for more information on a\n" - "particular option."), Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), this_name.c_str()); + + CommandInfo *help = source.service->FindCommand("generic/help"); + if (help) + source.Reply(_("Type \002{0}{1} {2} {3} \037option\037\002 for more information on a particular option."), + Config->StrictPrivmsg, source.service->nick, help->cname, this_name); return true; } @@ -88,14 +89,14 @@ class CommandBSSetBanExpire : public Command ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } ChanServ::AccessGroup access = source.AccessFor(ci); if (!source.HasPriv("botserv/administration") && !access.HasPriv("SET")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->name); return; } @@ -108,7 +109,7 @@ class CommandBSSetBanExpire : public Command time_t t = Anope::DoTime(arg); if (t == -1) { - source.Reply(BAD_EXPIRY_TIME); + source.Reply(_("Invalid expiry time \002{0}\002."), arg); return; } @@ -132,12 +133,8 @@ class CommandBSSetBanExpire : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(_(" \n" - "Sets the time bot bans expire in. If enabled, any bans placed by\n" - "bots, such as flood kicker, badwords kicker, etc. will automatically\n" - "be removed after the given time. Set to 0 to disable bans from\n" - "automatically expiring.")); + source.Reply(_("Sets the time bot bans expire in. If enabled, any bans placed by bots, such as by the flood kicker, badwords kicker, etc. will automatically be removed after the given time." + " Set to 0 to disable bans from automatically expiring.")); return true; } }; @@ -147,36 +144,34 @@ class CommandBSSetPrivate : public Command public: CommandBSSetPrivate(Module *creator, const Anope::string &sname = "botserv/set/private") : Command(creator, sname, 2, 2) { - this->SetDesc(_("Prevent a bot from being assigned by non IRC operators")); + this->SetDesc(_("Prevent a bot from being assigned by non Services Operators")); this->SetSyntax(_("\037botname\037 {\037ON|OFF\037}")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { - BotInfo *bi = BotInfo::Find(params[0], true); + const Anope::string &nick = params[9]; const Anope::string &value = params[1]; if (Anope::ReadOnly) - { - source.Reply(READ_ONLY_MODE); - return; - } + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); + BotInfo *bi = BotInfo::Find(nick, true); if (bi == NULL) { - source.Reply(BOT_DOES_NOT_EXIST, params[0].c_str()); + source.Reply(_("Bot \002{0}\002 does not exist."), nick); return; } if (value.equals_ci("ON")) { bi->oper_only = true; - source.Reply(_("Private mode of bot %s is now \002on\002."), bi->nick.c_str()); + source.Reply(_("Private mode of bot \002{0}\002 is now \002on\002."), bi->nick); } else if (value.equals_ci("OFF")) { bi->oper_only = false; - source.Reply(_("Private mode of bot %s is now \002off\002."), bi->nick.c_str()); + source.Reply(_("Private mode of bot \002{0}\002 is now \002off\002."), bi->nick); } else this->OnSyntaxError(source, source.command); @@ -184,10 +179,8 @@ class CommandBSSetPrivate : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(_(" \n" - "This option prevents a bot from being assigned to a\n" - "channel by users that aren't IRC Operators.")); + source.Reply(_("This option prevents a bot from being assigned to channels by users who do not have the \002{0}\002 privilege."), + "botserv/administration"); return true; } }; diff --git a/modules/commands/cs_access.cpp b/modules/commands/cs_access.cpp index 83d00f6ae..c9dfe08cb 100644 --- a/modules/commands/cs_access.cpp +++ b/modules/commands/cs_access.cpp @@ -110,9 +110,10 @@ class CommandCSAccess : public Command source.Reply(_("Access level must be non-zero.")); return; } - else if (level <= ChanServ::ACCESS_INVALID || level >= ChanServ::ACCESS_FOUNDER) + + if (level <= ChanServ::ACCESS_INVALID || level >= ChanServ::ACCESS_FOUNDER) { - source.Reply(CHAN_ACCESS_LEVEL_RANGE, ChanServ::ACCESS_INVALID + 1, ChanServ::ACCESS_FOUNDER - 1); + source.Reply(_("Access level must be between \002{0}\002 and \002{1}\002 inclusive."), ChanServ::ACCESS_INVALID + 1, ChanServ::ACCESS_FOUNDER - 1); return; } @@ -131,7 +132,7 @@ class CommandCSAccess : public Command override = true; else { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have enough privileges on \002{0}\002 to add someone at level \002{1}\002."), ci->name, level); return; } } @@ -147,10 +148,11 @@ class CommandCSAccess : public Command ChanServ::Channel *targ_ci = ChanServ::Find(mask); if (targ_ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, mask.c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), mask); return; } - else if (ci == targ_ci) + + if (ci == targ_ci) { source.Reply(_("You can't add a channel to its own access list.")); return; @@ -166,14 +168,15 @@ class CommandCSAccess : public Command source.Reply(_("Masks and unregistered users may not be on access lists.")); return; } - else if (mask.find_first_of("!*@") == Anope::string::npos && !na) + + if (mask.find_first_of("!*@") == Anope::string::npos && !na) { User *targ = User::Find(mask, true); if (targ != NULL) mask = "*!*@" + targ->GetDisplayedHost(); else { - source.Reply(NICK_X_NOT_REGISTERED, mask.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), mask); return; } } @@ -187,7 +190,7 @@ class CommandCSAccess : public Command /* Don't allow lowering from a level >= u_level */ if ((!highest || *access >= *highest) && !u_access.founder && !source.HasPriv("chanserv/access/modify")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have enough privileges on \002{0}\002 to lower the access of \002{1}\002."), ci->name, access->mask); return; } delete ci->EraseAccess(i - 1); @@ -218,15 +221,21 @@ class CommandCSAccess : public Command Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to add " << mask << " with level " << level; if (p != NULL) - source.Reply(_("\002%s\002 added to %s access list at privilege %s (level %d)"), access->mask.c_str(), ci->name.c_str(), p->name.c_str(), level); + 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->name, p->name, level); else - source.Reply(_("\002%s\002 added to %s access list at level \002%d\002."), access->mask.c_str(), ci->name.c_str(), level); + source.Reply(_("\002{0}\002 added to the access list of \002{1}\002 at level \002{2}\002."), access->mask, ci->name, level); } void DoDel(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> ¶ms) { Anope::string mask = params[2]; + if (!ci->GetAccessCount()) + { + source.Reply(_("The access list for \002{0}\002 is empty."), ci->name); + return; + } + if (!isdigit(mask[0]) && mask.find_first_of("#!*@") == Anope::string::npos && !NickServ::FindNick(mask)) { User *targ = User::Find(mask, true); @@ -234,14 +243,12 @@ class CommandCSAccess : public Command mask = "*!*@" + targ->GetDisplayedHost(); else { - source.Reply(NICK_X_NOT_REGISTERED, mask.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), mask); return; } } - if (!ci->GetAccessCount()) - source.Reply(_("%s access list is empty."), ci->name.c_str()); - else if (isdigit(mask[0]) && mask.find_first_not_of("1234567890,-") == Anope::string::npos) + if (isdigit(mask[0]) && mask.find_first_not_of("1234567890,-") == Anope::string::npos) { class AccessDelCallback : public NumberList { @@ -252,8 +259,9 @@ class CommandCSAccess : public Command Anope::string Nicks; bool denied; bool override; + Anope::string mask; public: - AccessDelCallback(CommandSource &_source, ChanServ::Channel *_ci, Command *_c, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c), deleted(0), denied(false), override(false) + AccessDelCallback(CommandSource &_source, ChanServ::Channel *_ci, Command *_c, const Anope::string &numlist) : NumberList(numlist, true), source(_source), ci(_ci), c(_c), deleted(0), denied(false), override(false), mask(numlist) { if (!source.AccessFor(ci).HasPriv("ACCESS_CHANGE") && source.HasPriv("chanserv/access/modify")) this->override = true; @@ -262,17 +270,17 @@ class CommandCSAccess : public Command ~AccessDelCallback() { if (denied && !deleted) - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have enough privileges on \002{0}\002 to remove any access entries matching \002{1}\002.")); else if (!deleted) - source.Reply(_("No matching entries on %s access list."), ci->name.c_str()); + source.Reply(_("There are no entries matching \002{0}\002 on the access list of \002{1}\002."), mask, ci->name); else { Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, c, ci) << "to delete " << Nicks; if (deleted == 1) - source.Reply(_("Deleted 1 entry from %s access list."), ci->name.c_str()); + source.Reply(_("Deleted \0021\002 entry from the access list of \002{0}\002."), ci->name); else - source.Reply(_("Deleted %d entries from %s access list."), deleted, ci->name.c_str()); + source.Reply(_("Deleted \002{0}\002 entries from the access list of \002{1}\002."), deleted, ci->name); } } @@ -318,10 +326,10 @@ class CommandCSAccess : public Command if (mask.equals_ci(access->mask)) { if (!access->mask.equals_ci(source.nc->display) && !u_access.founder && (!highest || *highest <= *access) && !source.HasPriv("chanserv/access/modify")) - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have enough privileges on \002{0}\002 to remove the access of \002{1}\002."), ci->name, access->mask); else { - source.Reply(_("\002%s\002 deleted from %s access list."), access->mask.c_str(), ci->name.c_str()); + source.Reply(_("\002{0}\002 deleted from the access list of \002{1}\002."), access->mask, ci->name); bool override = !u_access.founder && !u_access.HasPriv("ACCESS_CHANGE") && !access->mask.equals_ci(source.nc->display); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << access->mask; @@ -333,10 +341,8 @@ class CommandCSAccess : public Command } } - source.Reply(_("\002%s\002 not found on %s access list."), mask.c_str(), ci->name.c_str()); + source.Reply(_("\002{0}\002 was not found on the access list of \002{1}\002."), mask, ci->name); } - - return; } void ProcessList(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> ¶ms, ListFormatter &list) @@ -344,8 +350,12 @@ class CommandCSAccess : public Command const Anope::string &nick = params.size() > 2 ? params[2] : ""; if (!ci->GetAccessCount()) - source.Reply(_("%s access list is empty."), ci->name.c_str()); - else if (!nick.empty() && nick.find_first_not_of("1234567890,-") == Anope::string::npos) + { + source.Reply(_("The access list for \002{0}\002 is empty."), ci->name); + return; + } + + if (!nick.empty() && nick.find_first_not_of("1234567890,-") == Anope::string::npos) { class AccessListCallback : public NumberList { @@ -428,13 +438,13 @@ class CommandCSAccess : public Command } if (list.IsEmpty()) - source.Reply(_("No matching entries on %s access list."), ci->name.c_str()); + source.Reply(_("No matching entries on the access list of \002{0}\002."), ci->name); else { std::vector<Anope::string> replies; list.Process(replies); - source.Reply(_("Access list for %s:"), ci->name.c_str()); + source.Reply(_("Access list for \002{0}\002:"), ci->name); for (unsigned i = 0; i < replies.size(); ++i) source.Reply(replies[i]); @@ -442,14 +452,13 @@ class CommandCSAccess : public Command source.Reply(_("End of access list")); } - return; } void DoList(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> ¶ms) { if (!ci->GetAccessCount()) { - source.Reply(_("%s access list is empty."), ci->name.c_str()); + source.Reply(_("The access list for \002{0}\002 is empty."), ci->name); return; } @@ -462,7 +471,7 @@ class CommandCSAccess : public Command { if (!ci->GetAccessCount()) { - source.Reply(_("%s access list is empty."), ci->name.c_str()); + source.Reply(_("The access list for \002{0}\002 is empty."), ci->name); return; } @@ -474,20 +483,19 @@ class CommandCSAccess : public Command void DoClear(CommandSource &source, ChanServ::Channel *ci) { if (!source.IsFounder(ci) && !source.HasPriv("chanserv/access/modify")) - source.Reply(ACCESS_DENIED); - else { - Event::OnAccessClear(&Event::AccessClear::OnAccessClear, ci, source); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->name); + return; + } - ci->ClearAccess(); + Event::OnAccessClear(&Event::AccessClear::OnAccessClear, ci, source); - source.Reply(_("Channel %s access list has been cleared."), ci->name.c_str()); + ci->ClearAccess(); - bool override = !source.IsFounder(ci); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to clear the access list"; - } + source.Reply(_("The access list of \002{0}\002 has been cleared."), ci->name); - return; + bool override = !source.IsFounder(ci); + Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to clear the access list"; } public: @@ -503,14 +511,15 @@ class CommandCSAccess : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; const Anope::string &cmd = params[1]; const Anope::string &nick = params.size() > 2 ? params[2] : ""; const Anope::string &s = params.size() > 3 ? params[3] : ""; - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } @@ -518,6 +527,8 @@ class CommandCSAccess : public Command bool is_clear = cmd.equals_ci("CLEAR"); bool is_del = cmd.equals_ci("DEL"); + ChanServ::AccessGroup access = source.AccessFor(ci); + bool has_access = false; if (source.HasPriv("chanserv/access/modify")) has_access = true; @@ -538,7 +549,7 @@ class CommandCSAccess : public Command if (is_list || is_clear ? 0 : (cmd.equals_ci("DEL") ? (nick.empty() || !s.empty()) : s.empty())) this->OnSyntaxError(source, cmd); else if (!has_access) - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), is_list ? "ACCESS_LIST" : "ACCESS_CHANGE", ci->name); else if (Anope::ReadOnly && !is_list) source.Reply(_("Sorry, channel access list modification is temporarily disabled.")); else if (cmd.equals_ci("ADD")) @@ -553,60 +564,92 @@ class CommandCSAccess : public Command this->DoClear(source, ci); else this->OnSyntaxError(source, ""); - - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Maintains the \002access list\002 for a channel. The access\n" - "list specifies which users are allowed chanop status or\n" - "access to %s commands on the channel. Different\n" - "user levels allow for access to different subsets of\n" - "privileges. Any registered user not on the access list has\n" - "a user level of 0, and any unregistered user has a user level\n" - "of -1."), source.service->nick.c_str()); - source.Reply(" "); - source.Reply(_("The \002ACCESS ADD\002 command adds the given mask to the\n" - "access list with the given user level; if the mask is\n" - "already present on the list, its access level is changed to\n" - "the level specified in the command. The \037level\037 specified\n" - "may be a numerical level or the name of a privilege (eg AUTOOP).\n" - "When a user joins the channel the access they receive is from the\n" - "highest level entry in the access list.")); - if (!Config->GetModule("chanserv")->Get<bool>("disallow_channel_access")) - source.Reply(_("The given mask may also be a channel, which will use the\n" - "access list from the other channel up to the given \037level\037.")); - source.Reply(" "); - source.Reply(_("The \002ACCESS DEL\002 command removes the given nick from the\n" - "access list. If a list of entry numbers is given, those\n" - "entries are deleted. (See the example for LIST below.)\n" - "You may remove yourself from an access list, even if you\n" - "do not have access to modify that list otherwise.")); - source.Reply(" "); - source.Reply(_("The \002ACCESS LIST\002 command displays the access list. If\n" - "a wildcard mask is given, only those entries matching the\n" - "mask are displayed. If a list of entry numbers is given,\n" - "only those entries are shown; for example:\n" - " \002ACCESS #channel LIST 2-5,7-9\002\n" - " Lists access entries numbered 2 through 5 and\n" - " 7 through 9.\n" - " \n" - "The \002ACCESS VIEW\002 command displays the access list similar\n" - "to \002ACCESS LIST\002 but shows the creator and last used time.\n" - " \n" - "The \002ACCESS CLEAR\002 command clears all entries of the\n" - "access list.")); - source.Reply(" "); - - BotInfo *bi; - Anope::string cmd; - if (Command::FindCommandFromService("chanserv/levels", bi, cmd)) - source.Reply(_("\002User access levels\002 can be seen by using the\n" - "\002%s\002 command; type \002%s%s HELP LEVELS\002 for\n" - "information."), cmd.c_str(), Config->StrictPrivmsg.c_str(), bi->nick.c_str()); + if (subcommand.equals_ci("ADD")) + { + source.Reply(_("The \002{0} ADD\002 adds \037mask\037 to the access list of \037channel\037 at level \037level\037." + " If \037mask\037 is already present on the access list, the access level for it is changed to \037level\037." + " The \037level\037 may be a numerical level between \002{1}\002 and \002{2}\002 or the name of a privilege (eg. \002{3}\002)." + " The privilege set granted to a given user is the union of the privileges of access entries that match the user." + " Use of this command requires the \002{4}\002 privilege on \037channel\037."), + source.command, ChanServ::ACCESS_INVALID + 1, ChanServ::ACCESS_FOUNDER - 1, "AUTOOP", "ACCESS_CHANGE"); + + if (!Config->GetModule("chanserv")->Get<bool>("disallow_channel_access")) + source.Reply(_("The given \037mask\037 may also be a channel, which will use the access list from the other channel up to the given \037level\037.")); + + //XXX show def levels + + source.Reply(_("\n" + "Examples:\n" + " {command} #anope ADD Adam 9001\n" + " Adds \"Adam\" to the access list of \"#anope\" at level \"9001\".\n" + "\n" + " {command} #anope ADD *!*@anope.org AUTOOP\n" + " Adds the host mask \"*!*@anope.org\" to the access list of \"#anope\" with the privilege \"AUTOOP\".")); + } + else if (subcommand.equals_ci("DEL")) + source.Reply(_("The \002{0} DEL\002 command removes \037mask\037 from the access list of \037channel\037." + " If a list of entry numbers is given, those entries are deleted." + " You may remove yourself from an access list, even if you do not have access to modify that list otherwise." + " Use of this command requires the \002{1}\002 privilege on \037channel\037.\n" + "\n" + "Example:\n" + " {command} #anope del DukePyrolator\n" + " Removes the access of \"DukePyrolator\" from \"#anope\"."), + source.command, "ACCESS_CHANGE"); + else if (subcommand.equals_ci("LIST") || subcommand.equals_ci("VIEW")) + source.Reply(_("The \002{0} LIST\002 and \002{0} VIEW\002 command displays the access list of \037channel\037." + " If a wildcard mask is given, only those entries matching the mask are displayed." + " If a list of entry numbers is given, only those entries are shown." + " \002VIEW\002 is similar to \002LIST\002 but also shows who created the access entry, and when the access entry was last used." + " Use of these commands requires the \002{1}\002 privilege on \037channel\037.\n" + "\n" + "Example:\n" + " {0} #anope LIST 2-5,7-9\n" + " Lists access entries numbered 2 through 5 and 7 through 9 on #anope."), + source.command, "ACCESS_LIST"); + else if (subcommand.equals_ci("CLEAR")) + source.Reply(_("The \002{0} CLEAR\002 command clears the access list of \037channel\037." + " Use of this command requires the \002{1}\002 privilege on \037channel\037."), + source.command, "FOUNDER"); + + else + { + source.Reply(_("Maintains the access list for \037channel\037. The access list specifies which users are granted which privileges to the channel." + " The access system uses numerical levels to represent different sets of privileges. Users who are identified but do not match any entries on" + " the access list has a level of 0. Unregistered or unidentified users who do not match any entries have a user level of 0.")); + BotInfo *bi; + Anope::string name; + CommandInfo *help = source.service->FindCommand("generic/help"); + if (Command::FindCommandFromService("chanserv/levels", bi, name) && help) + source.Reply(_("\n" + "Access levels can be configured via the \002{levels}\002 command. See \002{msg}{service} {help} {levels}\002 for more information."), + "msg"_kw = Config->StrictPrivmsg, "service"_kw = bi->nick, "help"_kw = help->cname, "levels"_kw = name); + + if (help) + source.Reply(_("\n" + "The \002ADD\002 command adds \037mask\037 to the access list at level \037level\037.\n" + "Use of this command requires the \002{change}\002 privilege on \037channel\037.\n" + "\002{msg}{service} {help} {command} ADD\002 for more information.\n" + "\n" + "The \002DEL\002 command removes \037mask\037 from the access list.\n" + "Use of this command requires the \002{change}\002 privilege on \037channel\037.\n" + "\002{msg}{service} {help} {command} DEL\002 for more information.\n" + "\n" + "The \002LIST\002 and \002VIEW\002 commands both show the access list for \037channel\037, but \002VIEW\002 also shows who created the access entry, and when the user was last seen.\n" + "Use of these commands requires the \002{list}\002 privilege on \037channel\037.\n" + "\002{msg}{service} {help} {command} [LIST | VIEW]\002 for more information.\n" + "\n" + "The \002CLEAR\002 command clears the access list." + "Use of this command requires the \002{founder}\002 privilege on \037channel\037.\n" + "\002{msg}{service} {help} {command} CLEAR\002 for more information."), + "msg"_kw = Config->StrictPrivmsg, "service"_kw = source.service->nick, "command"_kw = source.command, + "help"_kw = help->cname, "change"_kw = "ACCESS_CHANGE", "list"_kw = "ACCESS_LIST", "founder"_kw = "FOUNDER"); + } + return true; } }; @@ -636,12 +679,17 @@ class CommandCSLevels : public Command } if (level <= ChanServ::ACCESS_INVALID || level > ChanServ::ACCESS_FOUNDER) - source.Reply(_("Level must be between %d and %d inclusive."), ChanServ::ACCESS_INVALID + 1, ChanServ::ACCESS_FOUNDER - 1); + source.Reply(_("Level must be between \002{0}\002 and \002{1}\002 inclusive."), ChanServ::ACCESS_INVALID + 1, ChanServ::ACCESS_FOUNDER - 1); else { ChanServ::Privilege *p = ChanServ::service ? ChanServ::service->FindPrivilege(what) : nullptr; if (p == NULL) - source.Reply(_("Setting \002%s\002 not known. Type \002%s%s HELP LEVELS\002 for a list of valid settings."), what.c_str(), Config->StrictPrivmsg.c_str(), source.service->nick.c_str()); + { + CommandInfo *help = source.service->FindCommand("generic/help"); + if (help) + source.Reply(_("There is no such privilege \002{0}\002. See \002{0}{1} {2} {3}\002 for a list of valid settings."), + what, Config->StrictPrivmsg, source.service->nick, help->cname, source.command); + } else { bool override = !source.AccessFor(ci).HasPriv("FOUNDER"); @@ -651,9 +699,9 @@ class CommandCSLevels : public Command this->onlevelchange(&Event::LevelChange::OnLevelChange, source, ci, p->name, level); if (level == ChanServ::ACCESS_FOUNDER) - source.Reply(_("Level for %s on channel %s changed to founder only."), p->name.c_str(), ci->name.c_str()); + source.Reply(_("Level for privilege \002{0}\002 on channel \002{1}\002 changed to \002founder only\002."), p->name, ci->name); else - source.Reply(_("Level for \002%s\002 on channel %s changed to \002%d\002."), p->name.c_str(), ci->name.c_str(), level); + source.Reply(_("Level for privilege \002{0}\002 on channel \002{1}\002 changed to \002{3}\002."), p->name, ci->name, level); } } } @@ -678,11 +726,14 @@ class CommandCSLevels : public Command ci->SetLevel(p->name, ChanServ::ACCESS_INVALID); this->onlevelchange(&Event::LevelChange::OnLevelChange, source, ci, p->name, ChanServ::ACCESS_INVALID); - source.Reply(_("\002%s\002 disabled on channel %s."), p->name.c_str(), ci->name.c_str()); + source.Reply(_("Privileged \002{0}\002 disabled on channel \002{1}\002."), p->name, ci->name); return; } - source.Reply(_("Setting \002%s\002 not known. Type \002%s%s HELP LEVELS\002 for a list of valid settings."), what.c_str(), Config->StrictPrivmsg.c_str(), source.service->nick.c_str()); + CommandInfo *help = source.service->FindCommand("generic/help"); + if (help) + source.Reply(_("There is no such privilege \002{0}\002. See \002{0}{1} {2} {3}\002 for a list of valid settings."), + what, Config->StrictPrivmsg, source.service->nick, help->cname, source.command); } void DoList(CommandSource &source, ChanServ::Channel *ci) @@ -690,7 +741,7 @@ class CommandCSLevels : public Command if (!ChanServ::service) return; - source.Reply(_("Access level settings for channel %s:"), ci->name.c_str()); + source.Reply(_("Access level settings for channel \002{0}\002"), ci->name); ListFormatter list(source.GetAccount()); list.AddColumn(_("Name")).AddColumn(_("Level")); @@ -730,7 +781,7 @@ class CommandCSLevels : public Command reset_levels(ci); this->onlevelchange(&Event::LevelChange::OnLevelChange, source, ci, "ALL", 0); - source.Reply(_("Access levels for \002%s\002 reset to defaults."), ci->name.c_str()); + source.Reply(_("Levels for \002{0}\002 reset to defaults."), ci->name); } EventHandlers<Event::LevelChange> &onlevelchange; @@ -739,22 +790,23 @@ class CommandCSLevels : public Command CommandCSLevels(Module *creator, EventHandlers<Event::LevelChange> &event) : Command(creator, "chanserv/levels", 2, 4), onlevelchange(event) { this->SetDesc(_("Redefine the meanings of access levels")); - this->SetSyntax(_("\037channel\037 SET \037type\037 \037level\037")); - this->SetSyntax(_("\037channel\037 {DIS | DISABLE} \037type\037")); + this->SetSyntax(_("\037channel\037 SET \037privilege\037 \037level\037")); + this->SetSyntax(_("\037channel\037 {DIS | DISABLE} \037privilege\037")); this->SetSyntax(_("\037channel\037 LIST")); this->SetSyntax(_("\037channel\037 RESET")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; const Anope::string &cmd = params[1]; const Anope::string &what = params.size() > 2 ? params[2] : ""; const Anope::string &s = params.size() > 3 ? params[3] : ""; - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } @@ -764,9 +816,9 @@ class CommandCSLevels : public Command if (cmd.equals_ci("SET") ? s.empty() : (cmd.substr(0, 3).equals_ci("DIS") ? (what.empty() || !s.empty()) : !what.empty())) this->OnSyntaxError(source, cmd); else if (!source.AccessFor(ci).HasPriv("FOUNDER") && !source.HasPriv("chanserv/access/modify")) - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->name); else if (Anope::ReadOnly && !cmd.equals_ci("LIST")) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); else if (cmd.equals_ci("SET")) this->DoSet(source, ci, params); else if (cmd.equals_ci("DIS") || cmd.equals_ci("DISABLE")) @@ -777,15 +829,13 @@ class CommandCSLevels : public Command this->DoReset(source, ci); else this->OnSyntaxError(source, ""); - - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { if (subcommand.equals_ci("DESC")) { - source.Reply(_("The following feature/function names are available:")); + source.Reply(_("The following privileges are available:")); ListFormatter list(source.GetAccount()); list.AddColumn(_("Name")).AddColumn(_("Description")); @@ -811,27 +861,27 @@ class CommandCSLevels : public Command } else { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("The \002LEVELS\002 command allows fine control over the meaning of\n" - "the numeric access levels used for channels. With this\n" - "command, you can define the access level required for most\n" - "of %s's functions. (The \002SET FOUNDER\002 and this command\n" - "are always restricted to the channel founder.)\n" - " \n" - "\002LEVELS SET\002 allows the access level for a function or group of\n" - "functions to be changed. \002LEVELS DISABLE\002 (or \002DIS\002 for short)\n" - "disables an automatic feature or disallows access to a\n" - "function by anyone, INCLUDING the founder (although, the founder\n" - "can always reenable it). Use \002LEVELS SET founder\002 to make a level\n" - "founder only.\n" - " \n" - "\002LEVELS LIST\002 shows the current levels for each function or\n" - "group of functions. \002LEVELS RESET\002 resets the levels to the\n" - "default levels of a newly-created channel.\n" - " \n" - "For a list of the features and functions whose levels can be\n" - "set, see \002HELP LEVELS DESC\002."), source.service->nick.c_str()); + BotInfo *bi; + Anope::string name; + if (!Command::FindCommandFromService("chanserv/access", bi, name) || bi != source.service) + return false; + CommandInfo *help = source.service->FindCommand("generic/help"); + if (!help) + return false; + + source.Reply(_("The \002{0}\002 command allows fine control over the meaning of numeric access levels used in the \002{1}\001 command.\n" + "\n" + "\002{0} SET\002 allows changing which \037privilege\037 is included in a given \037level\37.\n" + "\n" + "\002{0} DISABLE\002 disables a privilege and prevents anyone from be granted it, even channel founders." + " The \002{2}\002 privilege can not be disabled.\n" + "\n" + "\002{0} LIST\002 shows the current level for each privilege.\n" + "\n" + "\002{0} RESET\002 resets the levels to the default levels for newly registered channels.\n" + "\n" + "For the list of privileges and their descriptions, see \002{3} {4} DESC\002."), + source.command, name, "FOUNDER", help->cname, source.command); } return true; } diff --git a/modules/commands/cs_akick.cpp b/modules/commands/cs_akick.cpp index b548d87a9..435373810 100644 --- a/modules/commands/cs_akick.cpp +++ b/modules/commands/cs_akick.cpp @@ -108,7 +108,7 @@ class CommandCSAKick : public Command if (mask.equals_ci(ci->name) && ci->HasExt("PEACE")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied.")); return; } } @@ -151,7 +151,7 @@ class CommandCSAKick : public Command { if (Anope::Match(modes.first->second, mask)) { - source.Reply(CHAN_EXCEPTED, mask.c_str(), ci->name.c_str()); + source.Reply(_("\002{0}\002 matches an except on \002{1}\002 and cannot be banned until the except has been removed."), mask, ci->name); return; } } @@ -171,7 +171,7 @@ class CommandCSAKick : public Command ChanServ::AccessGroup nc_access = ci->AccessFor(nc), u_access = source.AccessFor(ci); if (nc == ci->GetFounder() || nc_access >= u_access) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You can not auto kick \002{0}\002 because they have more privileges than you on \002{1}\002 and \002{2}\002 is enabled."), nc->display, ci->name, "PEACE"); return; } } @@ -357,11 +357,11 @@ class CommandCSAKick : public Command if (ak->addtime) timebuf = Anope::strftime(ak->addtime, NULL, true); else - timebuf = UNKNOWN; + timebuf = _("<unknown>"); if (ak->last_used) lastused = Anope::strftime(ak->last_used, NULL, true); else - lastused = UNKNOWN; + lastused = _("<unknown>"); ListFormatter::ListEntry entry; entry["Number"] = stringify(number); @@ -397,11 +397,11 @@ class CommandCSAKick : public Command if (ak->addtime) timebuf = Anope::strftime(ak->addtime, NULL, true); else - timebuf = UNKNOWN; + timebuf = _("<unknown>"); if (ak->last_used) lastused = Anope::strftime(ak->last_used, NULL, true); else - lastused = UNKNOWN; + lastused = _("<unknown>"); ListFormatter::ListEntry entry; entry["Number"] = stringify(i + 1); @@ -466,7 +466,7 @@ class CommandCSAKick : public Command if (!c) { - source.Reply(CHAN_X_NOT_IN_USE, ci->name.c_str()); + source.Reply(_("Channel \002{0}\002 doesn't exist."), ci->name); return; } @@ -510,24 +510,36 @@ class CommandCSAKick : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { - Anope::string chan = params[0]; - Anope::string cmd = params[1]; - Anope::string mask = params.size() > 2 ? params[2] : ""; + const Anope::string &chan = params[0]; + const Anope::string &cmd = params[1]; + const Anope::string &mask = params.size() > 2 ? params[2] : ""; - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } if (mask.empty() && (cmd.equals_ci("ADD") || cmd.equals_ci("DEL"))) + { this->OnSyntaxError(source, cmd); - else if (!source.AccessFor(ci).HasPriv("AKICK") && !source.HasPriv("chanserv/access/modify")) - source.Reply(ACCESS_DENIED); - else if (!cmd.equals_ci("LIST") && !cmd.equals_ci("VIEW") && !cmd.equals_ci("ENFORCE") && Anope::ReadOnly) + return; + } + + if (!source.AccessFor(ci).HasPriv("AKICK") && !source.HasPriv("chanserv/access/modify")) + { + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "AKICK", ci->name); + return; + } + + if (Anope::ReadOnly && (cmd.equals_ci("ADD") || cmd.equals_ci("DEL"))) + { source.Reply(_("Sorry, channel autokick list modification is temporarily disabled.")); - else if (cmd.equals_ci("ADD")) + return; + } + + if (cmd.equals_ci("ADD")) this->DoAdd(source, ci, params); else if (cmd.equals_ci("DEL")) this->DoDel(source, ci, params); @@ -541,49 +553,82 @@ class CommandCSAKick : public Command this->DoClear(source, ci); else this->OnSyntaxError(source, ""); - - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) 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" - "on the AutoKick list attempts to join the channel,\n" - "%s will ban that user from the channel, then kick\n" - "the user.\n" - " \n" - "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 \"User has been\n" - "banned from the channel\".\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(), bi ? bi->nick.c_str() : "NickServ"); - source.Reply(_( - " \n" - "The \002AKICK DEL\002 command removes the given nick or mask\n" - "from the AutoKick list. It does not, however, remove any\n" - "bans placed by an AutoKick; those must be removed\n" - "manually.\n" - " \n" - "The \002AKICK LIST\002 command displays the AutoKick list, or\n" - "optionally only those AutoKick entries which match the\n" - "given mask.\n" - " \n" - "The \002AKICK VIEW\002 command is a more verbose version of the\n" - "\002AKICK LIST\002 command.\n" - " \n" - "The \002AKICK ENFORCE\002 command causes %s to enforce the\n" - "current AKICK list by removing those users who match an\n" - "AKICK mask.\n" - " \n" - "The \002AKICK CLEAR\002 command clears all entries of the\n" - "akick list."), source.service->nick.c_str()); + if (subcommand.equals_ci("ADD")) + source.Reply(_("The \002{0} ADD\002 command adds \037mask\037 to the auto kick list list of \037channel\037." + " If \037reason\037 is given, it is used when the user is kicked." + " If \037mask\037 is an account, then all users using the account will be affected.\n" + "\n" + "Examples:\n" + " {command} #anope ADD Cronus noob!\n" + " Adds the account \"Cronus\" to the auto kick list of \"#anope\" with the reason \"noob!\".\n" + "\n" + " {command} #anope ADD Guest*!*@*\n" + " Adds the mask \"Guest*!*@*\" to the auto kick list of \"#anope\"."), + source.command); + else if (subcommand.equals_ci("DEL")) + source.Reply(_("The \002{0} DEL\002 command removes \037mask\037 from the auto kick list." + " It does not, however, remove any bans placed by an auto kick; those must be removed manually.\n" + "\n" + "Example:\n" + " {command} #anope DEL Cronus!\n" + " Removes the auto kick for \"Cronus\" from the auto kick list of \"#anope\".\n"), + source.command); + else if (subcommand.equals_ci("LIST") || subcommand.equals_ci("VIEW")) + source.Reply(_("The \002{0} LIST\002 and \002{0} VIEW\002 command displays the auto kick list of \037channel\037." + " If a wildcard mask is given, only those entries matching the mask are displayed." + " If a list of entry numbers is given, only those entries are shown." + " \002VIEW\002 is similar to \002LIST\002 but also shows who created the auto kick entry, when it was created, and when it was last used." + "\n" + "Example:\n" + " \002{0} #anope LIST 2-5,7-9\002\n" + " Lists auto kick entries numbered 2 through 5 and 7 through 9 on #anope."), + source.command); + else if (subcommand.equals_ci("ENFORCE")) + source.Reply(_("The \002{0} ENFORCE\002 command enforces the auto kick list by forcibly removing users who match an entry on the auto kick list." + "This can be useful if someone does not authenticate or change their host mask until after joining.\n" + "\n" + "Example:\n" + " \002{0} #anope ENFORCE\002\n" + " Enforces the auto kick list of #anope."), + source.command); + else if (subcommand.equals_ci("CLEAR")) + source.Reply(_("The \002{0} CLEAR\002 command clears the auto kick list of \037channel\37. As with the \002DEL\002 command, existing bans placed by auto kick will not be removed.\n" + "\n" + "Example:\n" + " \002{0} #anope CLEAR\002\n" + " Clears the auto kick list of #anope."), + source.command); + else + { + source.Reply(_("Maintains the auto kick list for \037channel\037." + " If a user matching an entry on the auto kick list joins the channel, {0} will place a ban on the user and kick them.\n" + "\n" + "Use of this command requires the \002{1}\002 privilege on \037channel\037."), + source.service->nick, "AKICK"); + CommandInfo *help = source.service->FindCommand("generic/help"); + if (help) + source.Reply(_("\n" + "The \002ADD\002 command adds \037nick\037 or \037mask\037 to the auto kick list of \037channel\037.\n" + "\002{msg}{service} {help} {command} ADD\002 for more information.\n" + "\n" + "The \002DEL\002 command removes \037mask\037 from the auto kick list of \037channel\037.\n" + "\002{msg}{service} {help} {command} DEL\002 for more information.\n" + "\n" + "The \002LIST\002 and \002VIEW\002 commands both display the auto kick list of \037channel\037, but \002VIEW\002 also displays who created the auto kick entry, when it was created, and when it was last used.\n" + "\002{msg}{service} {help} {command} [LIST | VIEW]\002 for more information.\n" + "\n" + "The \002ENFORCE\002 command enforces the auto kick list by forcibly removing users who match an entry on the auto kick list.\n" + "\002{msg}{service} {help} {command} ENFORCE\002 for more information.\n" + "" + "The \002CLEAR\002 clears the auto kick list of \037channel\037." + "\002{msg}{service} {help} {command} CLEAR\002 for more information.\n"), + "msg"_kw = Config->StrictPrivmsg, "service"_kw = source.service->nick, "help"_kw = help->cname, "command"_kw = source.command); + } + return true; } }; diff --git a/modules/commands/cs_ban.cpp b/modules/commands/cs_ban.cpp index e85afc4a0..3571ccdf3 100644 --- a/modules/commands/cs_ban.cpp +++ b/modules/commands/cs_ban.cpp @@ -47,17 +47,18 @@ class CommandCSBan : public Command ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } Channel *c = ci->c; if (c == NULL) { - source.Reply(CHAN_X_NOT_IN_USE, chan.c_str()); + source.Reply(_("Channel \002{0}\002 doesn't exist."), ci->name); return; } - else if (IRCD->GetMaxListFor(c) && c->HasMode("BAN") >= IRCD->GetMaxListFor(c)) + + if (IRCD->GetMaxListFor(c) && c->HasMode("BAN") >= IRCD->GetMaxListFor(c)) { source.Reply(_("The ban list for %s is full."), c->name.c_str()); return; @@ -70,7 +71,7 @@ class CommandCSBan : public Command ban_time = Anope::DoTime(params[1]); if (ban_time == -1) { - source.Reply(BAD_EXPIRY_TIME); + source.Reply(_("Invalid expiry time \002{0}\002."), params[1]); return; } if (params.size() < 3) @@ -104,47 +105,60 @@ class CommandCSBan : public Command ChanServ::AccessGroup u_access = source.AccessFor(ci); if (!u_access.HasPriv("BAN") && !source.HasPriv("chanserv/kick")) - source.Reply(ACCESS_DENIED); - else if (u2) + { + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "BAN", ci->name); + return; + } + + if (u2) { ChanServ::AccessGroup u2_access = ci->AccessFor(u2); if (u != u2 && ci->HasExt("PEACE") && u2_access >= u_access && !source.HasPriv("chanserv/kick")) - source.Reply(ACCESS_DENIED); + { + source.Reply(_("Access denied. \002{0}\002 has the same or more privileges than you on \002{1}\002."), u2->nick, ci->name); + return; + } + /* * Dont ban/kick the user on channels where he is excepted * to prevent services <-> server wars. */ - else if (c->MatchesList(u2, "EXCEPT")) - source.Reply(CHAN_EXCEPTED, u2->nick.c_str(), ci->name.c_str()); - else if (u2->IsProtected()) - source.Reply(ACCESS_DENIED); - else + if (c->MatchesList(u2, "EXCEPT")) { - Anope::string mask = ci->GetIdealBan(u2); + source.Reply(_("\002{0}\002 matches an except on \002{1}\002 and can not be banned until the except has been removed."), u2->nick, ci->name); + return; + } - bool override = !u_access.HasPriv("BAN") || (u != u2 && ci->HasExt("PEACE") && u2_access >= u_access); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << mask; + if (u2->IsProtected()) + { + source.Reply(_("Access denied. \002{0}\002 is protected and can not be kicked."), u2->nick); + return; + } - if (!c->HasMode("BAN", mask)) + Anope::string mask = ci->GetIdealBan(u2); + + bool override = !u_access.HasPriv("BAN") || (u != u2 && ci->HasExt("PEACE") && u2_access >= u_access); + Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << mask; + + if (!c->HasMode("BAN", mask)) + { + c->SetMode(NULL, "BAN", mask); + if (ban_time) { - c->SetMode(NULL, "BAN", mask); - if (ban_time) - { - new TempBan(ban_time, c, mask); - source.Reply(_("Ban on \002%s\002 expires in %s."), mask.c_str(), Anope::Duration(ban_time, source.GetAccount()).c_str()); - } + new TempBan(ban_time, c, mask); + source.Reply(_("Ban on \002{0}\002 expires in \002{1}\002."), mask, Anope::Duration(ban_time, source.GetAccount())); } + } - /* We still allow host banning while not allowing to kick */ - if (!c->FindUser(u2)) - return; + /* We still allow host banning while not allowing to kick */ + if (!c->FindUser(u2)) + return; - if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !source.AccessFor(ci).HasPriv("SIGNKICK"))) - c->Kick(ci->WhoSends(), u2, "%s (%s)", reason.c_str(), source.GetNick().c_str()); - else - c->Kick(ci->WhoSends(), u2, "%s", reason.c_str()); - } + if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !source.AccessFor(ci).HasPriv("SIGNKICK"))) + c->Kick(ci->WhoSends(), u2, "%s (%s)", reason.c_str(), source.GetNick().c_str()); + else + c->Kick(ci->WhoSends(), u2, "%s", reason.c_str()); } else { @@ -158,7 +172,7 @@ class CommandCSBan : public Command if (ban_time) { new TempBan(ban_time, c, target); - source.Reply(_("Ban on \002%s\002 expires in %s."), target.c_str(), Anope::Duration(ban_time, source.GetAccount()).c_str()); + source.Reply(_("Ban on \002{0}\002 expires in \002{1}\002."), target, Anope::Duration(ban_time, source.GetAccount())); } } @@ -192,22 +206,25 @@ class CommandCSBan : public Command } if (matched) - source.Reply(_("Kicked %d/%d users matching %s from %s."), kicked, matched, target.c_str(), c->name.c_str()); + source.Reply(_("Kicked \002{0}/{1}\002 users matching \002{2}\002 from \002{3}\002."), kicked, matched, target, c->name); else - source.Reply(_("No users on %s match %s."), c->name.c_str(), target.c_str()); + source.Reply(_("No users on \002{0}\002 match \002{1}\002."), c->name, target); } } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Bans a given nick or mask on a channel. An optional expiry may\n" - "be given to cause services to remove the ban after a set amount\n" - "of time.\n" - " \n" - "By default, limited to AOPs or those with level 5 access\n" - "and above on the channel. Channel founders may ban masks.")); + source.Reply(_("Bans a given \037nick\037 or \037mask\037 on \002channel\002. An optional expiry may be given to cause services to remove the ban after a set amount of time.\n" + "\n" + "Use of this command requires the \002{0}\002 privilege on \037channel\037.\n" + "\n" + "Examples:\n" + " {command} #anope Jobe\n" + " Bans the user \"Jobe\" from \"#anope\".\n" + "\n" + " {command} #anope Guest!*@*\n" + " Bans the mask \"Guest!*@*\" on \"#anope\"."), + "BAN"); return true; } }; diff --git a/modules/commands/cs_clone.cpp b/modules/commands/cs_clone.cpp index bd7a6c990..a32320131 100644 --- a/modules/commands/cs_clone.cpp +++ b/modules/commands/cs_clone.cpp @@ -30,30 +30,30 @@ public: if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } User *u = source.GetUser(); - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(channel); bool override = false; if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), channel); return; } ChanServ::Channel *target_ci = ChanServ::Find(target); if (!target_ci) { - source.Reply(CHAN_X_NOT_REGISTERED, target.c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), target); return; } if (ci == target_ci) { - source.Reply(_("Cannot clone channel \002%s\002 to itself!"), target.c_str()); + source.Reply(_("Cannot clone channel \002{0}\002 to itself!"), ci->name); return; } @@ -61,7 +61,7 @@ public: { if (!source.HasPriv("chanserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have the privilege \002{0}\002 on \002{1}\002 and \002{2}\002."), "FOUNDER", ci->name, target_ci->name); return; } else @@ -104,7 +104,7 @@ public: Event::OnChanRegistered(&Event::ChanRegistered::OnChanRegistered, target_ci); - source.Reply(_("All settings from \002%s\002 have been cloned to \002%s\002."), channel.c_str(), target.c_str()); + source.Reply(_("All settings from \002{0}\002 have been cloned to \002{0}\002."), channel, target); } else if (what.equals_ci("ACCESS")) { @@ -140,7 +140,7 @@ public: ++count; } - source.Reply(_("%d access entries from \002%s\002 have been cloned to \002%s\002."), count, channel.c_str(), target.c_str()); + source.Reply(_("\002{0}\002 access entries from \002{1}\002 have been cloned to \002{2}\002."), count, channel, target); } else if (what.equals_ci("AKICK")) { @@ -154,7 +154,7 @@ public: target_ci->AddAkick(ak->creator, ak->mask, ak->reason, ak->addtime, ak->last_used); } - source.Reply(_("All akick entries from \002%s\002 have been cloned to \002%s\002."), channel.c_str(), target.c_str()); + source.Reply(_("All auto kick entries from \002{0}\002 have been cloned to \002{1}\002."), channel, target); } else if (what.equals_ci("BADWORDS")) { @@ -163,7 +163,7 @@ public: if (!target_badwords || !badwords) { - source.Reply(ACCESS_DENIED); // BotServ doesn't exist/badwords isn't loaded + source.Reply(_("All badword entries from \002{0}\002 have been cloned to \002{1}\002."), channel, target); // BotServ doesn't exist/badwords isn't loaded return; } @@ -178,7 +178,7 @@ public: badwords->Check(); target_badwords->Check(); - source.Reply(_("All badword entries from \002%s\002 have been cloned to \002%s\002."), channel.c_str(), target.c_str()); + source.Reply(_("All badword entries from \002{0}\002 have been cloned to \002{1}\002."), channel, target); } else { @@ -191,12 +191,10 @@ public: bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Copies all settings, access, akicks, etc from \002channel\002 to the\n" - "\002target\002 channel. If \037what\037 is \002ACCESS\002, \002AKICK\002, or \002BADWORDS\002\n" - "then only the respective settings are cloned.\n" - "You must be the founder of \037channel\037 and \037target\037.")); + source.Reply(_("Copies all settings, access, akicks, etc. from \037channel\037 to the \037target\037 channel." + " If \037what\037 is \002ACCESS\002, \002AKICK\002, or \002BADWORDS\002 then only the respective settings are cloned.\n" + "\n" + "You must be the founder of \037channel\037 and \037target\037.")); return true; } }; diff --git a/modules/commands/cs_drop.cpp b/modules/commands/cs_drop.cpp index 55a28f294..5ece6eb3b 100644 --- a/modules/commands/cs_drop.cpp +++ b/modules/commands/cs_drop.cpp @@ -29,26 +29,26 @@ class CommandCSDrop : public Command if (Anope::ReadOnly && !source.HasPriv("chanserv/administration")) { - source.Reply(_("Sorry, channel de-registration is temporarily disabled.")); // XXX: READ_ONLY_MODE? + source.Reply(_("Sorry, channel de-registration is temporarily disabled.")); return; } ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } if (params.size() < 2 || !chan.equals_ci(params[1])) { - source.Reply(_("You must enter the channel name twice as a confirmation that you wish to drop \002%s\002."), chan.c_str()); + source.Reply(_("You must enter the channel name twice as a confirmation that you wish to drop \002{0}\002."), ci->name); return; } if ((ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && !source.HasCommand("chanserv/drop")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->name); return; } @@ -62,7 +62,7 @@ class CommandCSDrop : public Command Reference<Channel> c = ci->c; delete ci; - source.Reply(_("Channel \002%s\002 has been dropped."), chan.c_str()); + source.Reply(_("Channel \002{0}\002 has been dropped."), chan); if (c) c->CheckModes(); @@ -70,14 +70,15 @@ class CommandCSDrop : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - if (source.IsServicesOper()) - source.Reply(_("Unregisters the named channel. Only \002Services Operators\002\n" - "can drop a channel of which they are not the founder.")); - else - source.Reply(_("Unregisters the named channel. Can only be used by\n" - "the \002channel founder\002.")); + source.Reply(_("Unregisters \037channel\037. All channel settings will be deleted. As a precaution, you must give the \037channel\037 name twice.\n" + "\n" + "Use of this command requires the \002{0}\002 privilege on \037channel\037."), + "FOUNDER"); + + if (source.HasCommand("chanserv/drop")) + source.Reply(_("\n" + "As a Services Operator with the command \002{0}\002, you may drop any channel."), + "chanserv/drop"); return true; } diff --git a/modules/commands/cs_enforce.cpp b/modules/commands/cs_enforce.cpp index 52b9093ca..64ef9ab0d 100644 --- a/modules/commands/cs_enforce.cpp +++ b/modules/commands/cs_enforce.cpp @@ -39,7 +39,7 @@ class CommandCSEnforce : public Command if (!hadsecureops) ci->Shrink<bool>("SECUREOPS"); - source.Reply(_("Secureops enforced on %s."), ci->name.c_str()); + source.Reply(_("\002Secureops\002 enforced on \002{0}\002."), ci->name); } void DoRestricted(CommandSource &source, ChanServ::Channel *ci) @@ -70,7 +70,7 @@ class CommandCSEnforce : public Command ci->c->Kick(NULL, user, "%s", reason.c_str()); } - source.Reply(_("Restricted enforced on %s."), ci->name.c_str()); + source.Reply(_("\002Restricted\002 enforced on \002{0}\002."), ci->name); } void DoRegOnly(CommandSource &source, ChanServ::Channel *ci) @@ -102,7 +102,7 @@ class CommandCSEnforce : public Command ci->c->Kick(NULL, user, "%s", reason.c_str()); } - source.Reply(_("Registered only enforced on %s."), ci->name.c_str()); + source.Reply(_("\002Registered only\002 enforced on \002{0}\002."), ci->name); } void DoSSLOnly(CommandSource &source, ChanServ::Channel *ci) @@ -134,7 +134,7 @@ class CommandCSEnforce : public Command ci->c->Kick(NULL, user, "%s", reason.c_str()); } - source.Reply(_("SSL only enforced on %s."), ci->name.c_str()); + source.Reply(_("\002SSL only\002 enforced on %s."), ci->name.c_str()); } void DoBans(CommandSource &source, ChanServ::Channel *ci) @@ -163,7 +163,7 @@ class CommandCSEnforce : public Command ci->c->Kick(NULL, user, "%s", reason.c_str()); } - source.Reply(_("Bans enforced on %s."), ci->name.c_str()); + source.Reply(_("\002Bans\002 enforced on %s."), ci->name.c_str()); } void DoLimit(CommandSource &source, ChanServ::Channel *ci) @@ -174,7 +174,7 @@ class CommandCSEnforce : public Command Anope::string l_str; if (!ci->c->GetParam("LIMIT", l_str)) { - source.Reply(_("No limit is set on %s."), ci->name.c_str()); + source.Reply(_("There is no limit is set on \002{0}\002."), ci->name); return; } @@ -187,7 +187,7 @@ class CommandCSEnforce : public Command } catch (const ConvertException &) { - source.Reply(_("The limit on %s is not valid."), ci->name.c_str()); + source.Reply(_("The limit on \002{0}\002 is not valid."), ci->name); return; } @@ -218,7 +218,7 @@ class CommandCSEnforce : public Command ci->c->Kick(NULL, user, "%s", reason.c_str()); } - source.Reply(_("LIMIT enforced on %s, %d users removed."), ci->name.c_str(), users.size()); + source.Reply(_("LIMIT enforced on \002{0}\002, \002{1]\002 users removed."), ci->name, users.size()); } public: @@ -235,11 +235,11 @@ class CommandCSEnforce : public Command ChanServ::Channel *ci = ChanServ::Find(params[0]); if (!ci) - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), params[0]); else if (!ci->c) - source.Reply(CHAN_X_NOT_IN_USE, ci->name.c_str()); + source.Reply(_("Channel \002{0}\002 doesn't exist."), ci->name); else if (!source.AccessFor(ci).HasPriv("AKICK") && !source.HasPriv("chanserv/access/modify")) - source.Reply(ACCESS_DENIED); + source.Reply("Access denied. You do not have the \002{0}\002 privilege on \002{1}\002.", "AKICK", ci->name); else if (what.equals_ci("SECUREOPS")) this->DoSecureOps(source, ci); else if (what.equals_ci("RESTRICTED")) @@ -258,21 +258,24 @@ class CommandCSEnforce : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Enforce various channel modes and set options. The \037channel\037\n" - "option indicates what channel to enforce the modes and options\n" - "on. The \037what\037 option indicates what modes and options to\n" - "enforce, and can be any of \002SECUREOPS\002, \002RESTRICTED\002, \002REGONLY\002, \002SSLONLY\002,\n" - "\002BANS\002, or \002LIMIT\002.\n" - " \n" - "Use \002SECUREOPS\002 to enforce the SECUREOPS option, even if it is not\n" - "enabled. Use \002RESTRICTED\002 to enfore the RESTRICTED option, also\n" - "if it's not enabled. Use \002REGONLY\002 to kick all unregistered users\n" - "from the channel. Use \002SSLONLY\002 to kick all users not using a secure\n" - "connection from the channel. \002BANS\002 will enforce bans on the channel by\n" - "kicking users affected by them, and \002LIMIT\002 will kick users until the\n" - "user count drops below the channel limit, if one is set.")); + source.Reply(_("Enforce various channel modes and set options on \037channel\037." + "\n" + "The \002SECUREOPS\002 option enforces SECUREOPS, even if it is not enabled.\n" + "See \002/msg ChanServ HELP SET SECUREOPS\002 for information about SECUREOPS.\n" //XXX + "\n" + "The \002RESTRICTED\002 option enforces RESTRICTED, even if it is not enabled.\n" + "See \002/msg ChanServ HELP SET RESTRICTED\002 for information about RESTRICTED.\n" //XXX + "\n" + "The \002REGONLY\002 option removes all unregistered users.\n" + "\n" + "The \002SSLONLY\002 option removes all users not using a secure connection.\n" + "\n" + "The \002BANS\002 option enforces bans on the channel by removing users affected by then.\n" + "\n" + "The \002LIMIT\002 option will remove users until the user count drops below the channel limit, if one is set.\n" + "\n" + "Use of this command requires the \002{0}\002 privilege."), + "AKICK"); return true; } }; diff --git a/modules/commands/cs_entrymsg.cpp b/modules/commands/cs_entrymsg.cpp index 8e196d18b..41a8da517 100644 --- a/modules/commands/cs_entrymsg.cpp +++ b/modules/commands/cs_entrymsg.cpp @@ -106,11 +106,11 @@ class CommandEntryMessage : public Command if ((*messages)->empty()) { - source.Reply(_("Entry message list for \002%s\002 is empty."), ci->name.c_str()); + source.Reply(_("Entry message list for \002{0}\002 is empty."), ci->name); return; } - source.Reply(_("Entry message list for \002%s\002:"), ci->name.c_str()); + source.Reply(_("Entry message list for \002{0}\002:"), ci->name); ListFormatter list(source.GetAccount()); list.AddColumn(_("Number")).AddColumn(_("Creator")).AddColumn(_("Created")).AddColumn(_("Message")); @@ -139,12 +139,12 @@ class CommandEntryMessage : public Command EntryMessageList *messages = ci->Require<EntryMessageList>("entrymsg"); if ((*messages)->size() >= Config->GetModule(this->owner)->Get<unsigned>("maxentries")) - source.Reply(_("The entry message list for \002%s\002 is full."), ci->name.c_str()); + source.Reply(_("The entry message list for \002{0}\002 is full."), ci->name); else { (*messages)->push_back(new EntryMsgImpl(ci, source.GetNick(), message)); Log(source.IsFounder(ci) ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to add a message"; - source.Reply(_("Entry message added to \002%s\002"), ci->name.c_str()); + source.Reply(_("Entry message added to \002{0}\002"), ci->name); } } @@ -153,9 +153,9 @@ class CommandEntryMessage : public Command EntryMessageList *messages = ci->Require<EntryMessageList>("entrymsg"); if (!message.is_pos_number_only()) - source.Reply(("Entry message \002%s\002 not found on channel \002%s\002."), message.c_str(), ci->name.c_str()); + source.Reply(("Entry message \002{0}\002 not found on channel \002{1}\002."), message, ci->name); else if ((*messages)->empty()) - source.Reply(_("Entry message list for \002%s\002 is empty."), ci->name.c_str()); + source.Reply(_("Entry message list for \002{0}\002 is empty."), ci->name); else { try @@ -167,14 +167,14 @@ class CommandEntryMessage : public Command if ((*messages)->empty()) ci->Shrink<EntryMessageList>("entrymsg"); Log(source.IsFounder(ci) ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to remove a message"; - source.Reply(_("Entry message \002%i\002 for \002%s\002 deleted."), i, ci->name.c_str()); + source.Reply(_("Entry message \002{0}\002 for \002{1]\002 deleted."), i, ci->name); } else throw ConvertException(); } catch (const ConvertException &) { - source.Reply(_("Entry message \002%s\002 not found on channel \002%s\002."), message.c_str(), ci->name.c_str()); + source.Reply(_("Entry message \002{0}\002 not found on channel \002{1}\002."), message, ci->name); } } } @@ -184,7 +184,7 @@ class CommandEntryMessage : public Command ci->Shrink<EntryMessageList>("entrymsg"); Log(source.IsFounder(ci) ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to remove all messages"; - source.Reply(_("Entry messages for \002%s\002 have been cleared."), ci->name.c_str()); + source.Reply(_("Entry messages for \002{0}\002 have been cleared."), ci->name); } public: @@ -199,22 +199,24 @@ class CommandEntryMessage : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { - ChanServ::Channel *ci = ChanServ::Find(params[0]); + const Anope::string &chan = params[0]; + + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } if (Anope::ReadOnly && !params[1].equals_ci("LIST")) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } if (!source.IsFounder(ci) && !source.HasPriv("chanserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->name); return; } @@ -234,25 +236,19 @@ class CommandEntryMessage : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Controls what messages will be sent to users when they join the channel.")); - source.Reply(" "); - source.Reply(_("The \002ENTRYMSG ADD\002 command adds the given message to\n" - "the list of messages to be shown to users when they join\n" - "the channel.")); - source.Reply(" "); - source.Reply(_("The \002ENTRYMSG DEL\002 command removes the given message from\n" - "the list of messages to be shown to users when they join\n" - "the channel. You can remove the message by specifying its number\n" - "which you can get by listing the messages as explained below.")); - source.Reply(" "); - source.Reply(_("The \002ENTRYMSG LIST\002 command displays a listing of messages\n" - "to be shown to users when they join the channel.")); - source.Reply(" "); - source.Reply(_("The \002ENTRYMSG CLEAR\002 command clears all entries from\n" - "the list of messages to be shown to users when they join\n" - "the channel, effectively disabling entry messages.")); + source.Reply(_("Controls what messages will be sent to users when they join \037channel\037.\n" + "\n" + "The \002{0} ADD\002 command adds the given message to the list of messages to be shown to users when they join the channel.\n" + "\n" + "The \002{0} DEL\002 command removes the given message from the entry message list.\n" + " You can remove the message by specifying its number which you can get by listing the messages as explained below.\n" + "\n" + "The \002{0} LIST\002 command displays the list of messages on the entry message list.\n" + "\n" + "The \002{0} CLEAR\002 command clears the entry message list.\n" + "\n" + "Use of this command requires being the founder of \037channel\037."), + source.command); return true; } }; diff --git a/modules/commands/cs_flags.cpp b/modules/commands/cs_flags.cpp index 2c5cfa547..c7953f0c9 100644 --- a/modules/commands/cs_flags.cpp +++ b/modules/commands/cs_flags.cpp @@ -103,7 +103,7 @@ class CommandCSFlags : public Command ChanServ::Channel *targ_ci = ChanServ::Find(mask); if (targ_ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, mask.c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), mask); return; } else if (ci == targ_ci) @@ -129,7 +129,7 @@ class CommandCSFlags : public Command mask = "*!*@" + targ->GetDisplayedHost(); else { - source.Reply(NICK_X_NOT_REGISTERED, mask.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), mask); return; } } @@ -154,7 +154,7 @@ class CommandCSFlags : public Command override = true; else { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have enough privileges on \002{0}\002 to modify the access of \002{1}\002."), ci->name, access->mask); return; } } @@ -170,7 +170,7 @@ class CommandCSFlags : public Command unsigned access_max = Config->GetModule("chanserv")->Get<unsigned>("accessmax", "1024"); if (access_max && ci->GetDeepAccessCount() >= access_max) { - source.Reply(_("Sorry, you can only have %d access entries on a channel, including access entries from other channels."), access_max); + source.Reply(_("Sorry, you can only have \002{0}\002 access entries on a channel, including access entries from other channels."), access_max); return; } @@ -227,7 +227,7 @@ class CommandCSFlags : public Command override = true; else { - source.Reply(_("You can not set the \002%c\002 flag."), f); + source.Reply(_("You can not set the \002{0}\002 flag."), f); break; } } @@ -247,11 +247,11 @@ class CommandCSFlags : public Command Event::OnAccessDel(&Event::AccessDel::OnAccessDel, ci, source, current); delete current; Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to delete " << mask; - source.Reply(_("\002%s\002 removed from the %s access list."), mask.c_str(), ci->name.c_str()); + source.Reply(_("\002{0}\002 removed from the access list of \002{1}\002."), mask, ci->name); } else { - source.Reply(_("\002%s\002 not found on %s access list."), mask.c_str(), ci->name.c_str()); + source.Reply(_("\002{0}\002 not found on the access list of \002{1}\002."), mask, ci->name); } return; } @@ -278,12 +278,12 @@ class CommandCSFlags : public Command if (p != NULL) { if (add) - source.Reply(_("Privilege \002%s\002 added to \002%s\002 on \002%s\002, new flags are +\002%s\002"), p->name.c_str(), access->mask.c_str(), ci->name.c_str(), access->AccessSerialize().c_str()); + source.Reply(_("Privilege \002{0}\002 added to \002{1}\002 on \002{2}\002, new flags are +\002{3}\002"), p->name, access->mask, ci->name, access->AccessSerialize()); else - source.Reply(_("Privilege \002%s\002 removed from \002%s\002 on \002%s\002, new flags are +\002%s\002"), p->name.c_str(), access->mask.c_str(), ci->name.c_str(), access->AccessSerialize().c_str()); + 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->name, access->AccessSerialize()); } else - source.Reply(_("Flags for \002%s\002 on %s set to +\002%s\002"), access->mask.c_str(), ci->name.c_str(), access->AccessSerialize().c_str()); + source.Reply(_("Flags for \002{0}\002 on \002{1}\002 set to +\002{2}\002"), access->mask, ci->name, access->AccessSerialize()); } void DoList(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> ¶ms) @@ -292,7 +292,7 @@ class CommandCSFlags : public Command if (!ci->GetAccessCount()) { - source.Reply(_("%s access list is empty."), ci->name.c_str()); + source.Reply(_("The access list of \002{0}\002 is empty."), ci->name); return; } @@ -332,39 +332,38 @@ class CommandCSFlags : public Command } if (list.IsEmpty()) - source.Reply(_("No matching entries on %s access list."), ci->name.c_str()); + source.Reply(_("No matching entries on the access list of \002{0}\002."), ci->name); else { std::vector<Anope::string> replies; list.Process(replies); - source.Reply(_("Flags list for %s"), ci->name.c_str()); + source.Reply(_("Flags list for \002{0}\002:"), ci->name); for (unsigned i = 0; i < replies.size(); ++i) source.Reply(replies[i]); if (count == ci->GetAccessCount()) source.Reply(_("End of access list.")); else - source.Reply(_("End of access list - %d/%d entries shown."), count, ci->GetAccessCount()); + source.Reply(_("End of access list - \002{0}/{1}\002 entries shown."), count, ci->GetAccessCount()); } } void DoClear(CommandSource &source, ChanServ::Channel *ci) { if (!source.IsFounder(ci) && !source.HasPriv("chanserv/access/modify")) - source.Reply(ACCESS_DENIED); - else { - ci->ClearAccess(); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->name); + return; + } - Event::OnAccessClear(&Event::AccessClear::OnAccessClear, ci, source); + ci->ClearAccess(); - source.Reply(_("Channel %s access list has been cleared."), ci->name.c_str()); + Event::OnAccessClear(&Event::AccessClear::OnAccessClear, ci, source); - bool override = !source.IsFounder(ci); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to clear the access list"; - } + source.Reply(_("The access list of \002{0}\002 has been cleared."), ci->name); - return; + bool override = !source.IsFounder(ci); + Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to clear the access list"; } public: @@ -384,7 +383,7 @@ class CommandCSFlags : public Command ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } @@ -398,7 +397,7 @@ class CommandCSFlags : public Command has_access = true; if (!has_access) - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), is_list ? "ACCESS_LIST" : "ACCESS_CHANGE", ci->name); else if (Anope::ReadOnly && !is_list) source.Reply(_("Sorry, channel access list modification is temporarily disabled.")); else if (cmd.equals_ci("MODIFY")) @@ -413,24 +412,28 @@ class CommandCSFlags : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("%s is another way to modify the channel access list, similar to\n" - "the XOP and ACCESS methods."), source.command.c_str()); + source.Reply(_("{0} allow granularly granting privileges on channels to users by assigning them flags, which map to one or more privileges.\n" + "\n" + "The \002MODIFY\002 command allows you to modify the access list." + " If \037mask\037 is not already on the access list is it added, then the \037changes\037 are applied." + " If the mask has no more flags, then the mask is removed from the access list." + " Additionally, you may use +* or -* to add or remove all flags, respectively." + " You are only able to modify the access list if you have the \002{1}\002 privilege on the channel, and can only give privileges to up what you have."), + source.command, "ACCESS_CHANGE"); source.Reply(" "); - source.Reply(_("The \002MODIFY\002 command allows you to modify the access list. If mask is\n" - "not already on the access list is it added, then the changes are applied.\n" - "If the mask has no more flags, then the mask is removed from the access list.\n" - "Additionally, you may use +* or -* to add or remove all flags, respectively. You are\n" - "only able to modify the access list if you have the proper permission on the channel,\n" - "and even then you can only give other people access to up what you already have.")); + source.Reply(_("The \002LIST\002 command allows you to list existing entries on the channel access list." + " If \037mask\037 is given, the \037mask\037 is wildcard matched against all existing entries on the access list, and only those entries are returned." + " If a set of flags is given, only those on the access list with the specified flags are returned.")); source.Reply(" "); - source.Reply(_("The \002LIST\002 command allows you to list existing entries on the channel access list.\n" - "If a mask is given, the mask is wildcard matched against all existing entries on the\n" - "access list, and only those entries are returned. If a set of flags is given, only those\n" - "on the access list with the specified flags are returned.")); + source.Reply(_("The \002CLEAR\002 command clears the channel access list, which requires being the founder of \037channel\037.")); source.Reply(" "); - source.Reply(_("The \002CLEAR\002 command clears the channel access list, which requires channel founder.")); + source.Reply(_("\n" + "Examples:\n" + " {command} #anope MODIFY Attila +fHhu-i\n" + " Modifies the flags of \"Attila\" on the access list of \"#anope\" to \"+fHhu-i\".\n" + "\n" + " {command} #anope MODIFY *!*@anope.org +*\n" + " Modifies the flags of the host mask \"*!*@anope.org\" on the access list of \"#anope\" to have all flags.")); source.Reply(" "); source.Reply(_("The available flags are:")); diff --git a/modules/commands/cs_getkey.cpp b/modules/commands/cs_getkey.cpp index 122035acc..75a36d184 100644 --- a/modules/commands/cs_getkey.cpp +++ b/modules/commands/cs_getkey.cpp @@ -24,37 +24,38 @@ class CommandCSGetKey : public Command { const Anope::string &chan = params[0]; - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } if (!source.AccessFor(ci).HasPriv("GETKEY") && !source.HasCommand("chanserv/getkey")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "GETKEY", ci->name); return; } Anope::string key; if (!ci->c || !ci->c->GetParam("KEY", key)) { - source.Reply(_("Channel \002%s\002 has no key."), chan.c_str()); + source.Reply(_("Channel \002{0}\002 does not have a key."), ci->name); return; } bool override = !source.AccessFor(ci).HasPriv("GETKEY"); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci); - source.Reply(_("Key for channel \002%s\002 is \002%s\002."), chan.c_str(), key.c_str()); + source.Reply(_("Key for channel \002{0}\002 is \002{1}\002."), ci->name, key); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Returns the key of the given channel.")); + source.Reply(_("Returns the key of \037channel\037.\n" + "\n" + "Use of this command requires the \002{0}\002 privilege on \037channel\037."), + "GETKEY"); return true; } }; diff --git a/modules/commands/cs_info.cpp b/modules/commands/cs_info.cpp index 2b974ef1d..aca2390dd 100644 --- a/modules/commands/cs_info.cpp +++ b/modules/commands/cs_info.cpp @@ -29,10 +29,10 @@ class CommandCSInfo : public Command const Anope::string &chan = params[0]; NickServ::Account *nc = source.nc; - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } @@ -45,7 +45,7 @@ class CommandCSInfo : public Command InfoFormatter info(nc); - source.Reply(CHAN_INFO_HEADER, chan.c_str()); + source.Reply(_("Information for channel \002{0}\002:"), ci->name); if (ci->GetFounder()) info[_("Founder")] = ci->GetFounder()->display; @@ -74,14 +74,8 @@ class CommandCSInfo : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Lists information about the named registered channel,\n" - "including its founder, time of registration, and last\n" - "time used. If the user issuing the command has the\n" - "appropriate access for it, then the description, successor,\n" - "last topic set, settings and expiration time will also\n" - "be displayed when applicable.")); + source.Reply(_("Shows information about \037channel\037, including its founder, description, time of registration, and last time used." + " If the user issuing the command has \002{0}\002 privilege on \037channel\037, then the successor, last topic set, settings and expiration time will also be displayed when applicable.")); return true; } }; diff --git a/modules/commands/cs_invite.cpp b/modules/commands/cs_invite.cpp index 9e0168b53..b97606c80 100644 --- a/modules/commands/cs_invite.cpp +++ b/modules/commands/cs_invite.cpp @@ -29,20 +29,20 @@ class CommandCSInvite : public Command if (!c) { - source.Reply(CHAN_X_NOT_IN_USE, chan.c_str()); + source.Reply(_("Channel \002{0}\002 doesn't exist."), chan); return; } ChanServ::Channel *ci = c->ci; if (!ci) { - source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), c->name); return; } if (!source.AccessFor(ci).HasPriv("INVITE") && !source.HasCommand("chanserv/invite")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "INVITE", ci->name); return; } @@ -54,45 +54,42 @@ class CommandCSInvite : public Command if (!u2) { - source.Reply(NICK_X_NOT_IN_USE, params.size() > 1 ? params[1].c_str() : source.GetNick().c_str()); + source.Reply(_("\002{0}\002 isn't currently online."), params.size() > 1 ? params[1] : source.GetNick()); return; } if (c->FindUser(u2)) { if (u2 == u) - source.Reply(_("You are already in \002%s\002!"), c->name.c_str()); + source.Reply(_("You are already in \002{0}\002!"), c->name); else - source.Reply(_("\002%s\002 is already in \002%s\002!"), u2->nick.c_str(), c->name.c_str()); + source.Reply(_("\002{0}\002 is already in \002{1}\002!"), u2->nick, c->name); + + return; + } + + bool override = !source.AccessFor(ci).HasPriv("INVITE"); + + IRCD->SendInvite(ci->WhoSends(), c, u2); + if (u2 != u) + { + 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; } else { - bool override = !source.AccessFor(ci).HasPriv("INVITE"); - - IRCD->SendInvite(ci->WhoSends(), c, u2); - if (u2 != u) - { - source.Reply(_("\002%s\002 has been invited to \002%s\002."), u2->nick.c_str(), c->name.c_str()); - u2->SendMessage(ci->WhoSends(), _("You have been invited to \002%s\002 by \002%s\002."), c->name.c_str(), source.GetNick().c_str()); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << u2->nick; - } - else - { - u2->SendMessage(ci->WhoSends(), _("You have been invited to \002%s\002."), c->name.c_str()); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci); - } + u2->SendMessage(ci->WhoSends(), _("You have been invited to \002{0}\002."), c->name); + Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci); } } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Tells %s to invite you or an optionally specified\n" - "nick into the given channel.\n" - " \n" - "By default, limited to AOPs or those with level 5 and above\n" - "on the channel."), source.service->nick.c_str()); + source.Reply(_("Causes \002{0}\002 to invite you or an optionally specified \037nick\037 to \037channel\037.\n" + "\n" + "Use of this command requires the \002{0}\002 privilege on \037channel\037."), + source.service->nick, "INVITE"); return true; } }; diff --git a/modules/commands/cs_kick.cpp b/modules/commands/cs_kick.cpp index 9828c79fa..d95435d77 100644 --- a/modules/commands/cs_kick.cpp +++ b/modules/commands/cs_kick.cpp @@ -17,7 +17,7 @@ class CommandCSKick : public Command CommandCSKick(Module *creator) : Command(creator, "chanserv/kick", 2, 3) { this->SetDesc(_("Kicks a specified nick from a channel")); - this->SetSyntax(_("\037channel\037 \037nick\037 [\037reason\037]")); + this->SetSyntax(_("\037channel\037 \037user\037 [\037reason\037]")); this->SetSyntax(_("\037channel\037 \037mask\037 [\037reason\037]")); } @@ -34,12 +34,13 @@ class CommandCSKick : public Command if (!c) { - source.Reply(CHAN_X_NOT_IN_USE, chan.c_str()); + source.Reply(_("Channel \002{0}\002 doesn't exist."), chan); return; } - else if (!ci) + + if (!ci) { - source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), c->name); return; } @@ -50,16 +51,20 @@ class CommandCSKick : public Command ChanServ::AccessGroup u_access = source.AccessFor(ci); if (!u_access.HasPriv("KICK") && !source.HasPriv("chanserv/kick")) - source.Reply(ACCESS_DENIED); - else if (u2) + { + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "KICK", ci->name); + return; + } + + if (u2) { ChanServ::AccessGroup u2_access = ci->AccessFor(u2); if (u != u2 && ci->HasExt("PEACE") && u2_access >= u_access && !source.HasPriv("chanserv/kick")) - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. \002{0}\002 has the same or more privileges than you on \002{1}\002."), u2->nick, ci->name); else if (u2->IsProtected()) - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. \002{0}\002 is protected and can not be kicked."), u2->nick); else if (!c->FindUser(u2)) - source.Reply(NICK_X_NOT_ON_CHAN, u2->nick.c_str(), c->name.c_str()); + source.Reply(_("User \002{0}\002 is not on channel \002{1}\002."), u2->nick, c->name); else { bool override = !u_access.HasPriv("KICK") || (u != u2 && ci->HasExt("PEACE") && u2_access >= u_access); @@ -100,22 +105,20 @@ class CommandCSKick : public Command } if (matched) - source.Reply(_("Kicked %d/%d users matching %s from %s."), kicked, matched, target.c_str(), c->name.c_str()); + source.Reply(_("Kicked \002{0}/{1}\002 users matching \002{2}\002 from \002{3}\002."), kicked, matched, target, c->name); else - source.Reply(_("No users on %s match %s."), c->name.c_str(), target.c_str()); + source.Reply(_("No users on\002{0}\002 match \002{1}\002."), c->name, target); } else - source.Reply(NICK_X_NOT_IN_USE, target.c_str()); + source.Reply(_("\002{0}\002 isn't currently in use."), target); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Kicks a specified nick from a channel.\n" - " \n" - "By default, limited to AOPs or those with level 5 access\n" - "and above on the channel. Channel founders may use masks too.")); + source.Reply(_("Kicks \037user\037 from a \037channel\037. Users with the \002{0}\002 privilege on \037channel\037 may give a \037mask\037, which kicks all users who match the wildcard mask.\n" + " \n" + "Use of this command requires the \002{1}\002 privilege on \037channel\037."), + "FOUNDER", "KICK"); return true; } }; diff --git a/modules/commands/cs_list.cpp b/modules/commands/cs_list.cpp index f97e6e065..c8901fa03 100644 --- a/modules/commands/cs_list.cpp +++ b/modules/commands/cs_list.cpp @@ -43,9 +43,8 @@ class CommandCSList : public Command } catch (const ConvertException &) { - source.Reply(LIST_INCORRECT_RANGE); - source.Reply(_("To search for channels starting with #, search for the channel\n" - "name without the #-sign prepended (\002anope\002 instead of \002#anope\002).")); + source.Reply(_("Incorrect range specified. The correct syntax is \002#\037from\037-\037to\037\002.")); + source.Reply(_("To search for channels starting with #, search for the channel name without the #-sign prepended (\002anope\002 instead of \002#anope\002).")); return; } @@ -70,7 +69,7 @@ class CommandCSList : public Command Anope::string spattern = "#" + pattern; unsigned listmax = Config->GetModule(this->owner)->Get<unsigned>("listmax", "50"); - source.Reply(_("List of entries matching \002%s\002:"), pattern.c_str()); + source.Reply(_("List of entries matching \002{0}\002:"), pattern); ListFormatter list(source.GetAccount()); list.AddColumn(_("Name")).AddColumn(_("Description")); @@ -124,45 +123,36 @@ class CommandCSList : public Command for (unsigned i = 0; i < replies.size(); ++i) source.Reply(replies[i]); - source.Reply(_("End of list - %d/%d matches shown."), nchans > listmax ? listmax : nchans, nchans); + source.Reply(_("End of list - \002{0}/{1}\002 matches shown."), nchans > listmax ? listmax : nchans, nchans); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Lists all registered channels matching the given pattern.\n" - "Channels with the \002PRIVATE\002 option set will only be\n" - "displayed to Services Operators with the proper access.\n" - "Channels with the \002NOEXPIRE\002 option set will have\n" - "a \002!\002 prefixed to the channel for Services Operators to see.\n" - " \n" - "Note that a preceding '#' specifies a range, channel names\n" - "are to be written without '#'.\n" - " \n" - "If the SUSPENDED or NOEXPIRE options are given, only channels\n" - "which, respectively, are SUSPENDED or have the NOEXPIRE\n" - "flag set will be displayed. If multiple options are given,\n" - "all channels matching at least one option will be displayed.\n" - "Note that these options are limited to \037Services Operators\037.\n" - " \n" - "Examples:\n" - " \n" - " \002LIST *anope*\002\n" - " Lists all registered channels with \002anope\002 in their\n" - " names (case insensitive).\n" - " \n" - " \002LIST * NOEXPIRE\002\n" - " Lists all registered channels which have been set to not expire.\n" - " \n" - " \002LIST #51-100\002\n" - " Lists all registered channels within the given range (51-100).")); + source.Reply(_("Lists all registered channels matching the given pattern." + " Channels with the \002PRIVATE\002 option set will only be displayed to Services Operators with the proper access." + " Channels with the \002NOEXPIRE\002 option set will have a \002!\002 prefixed to the channel for Services Operators to see." + "\n" + "Note that a preceding '#' specifies a range, channel names are to be written without '#'.\n" + "\n" + "If the SUSPENDED or NOEXPIRE options are given, only channels which, respectively, are SUSPENDED or have the NOEXPIRE flag set will be displayed." + " If multiple options are given, all channels matching at least one option will be displayed." + " Note that these options are limited to \037Services Operators\037.\n" + "\n" + "Examples:\n" + "\n" + " {0} *anope*\n" + " Lists all registered channels with \002anope\002 in their names (case insensitive).\n" + "\n" + " {0} * NOEXPIRE\n" + " Lists all registered channels which have been set to not expire.\n" + "\n" + " {0} #51-100\n" + " Lists all registered channels within the given range (51-100).")); if (!Config->GetBlock("options")->Get<const Anope::string>("regexengine").empty()) { source.Reply(" "); - source.Reply(_("Regex matches are also supported using the %s engine.\n" - "Enclose your pattern in // if this is desired."), Config->GetBlock("options")->Get<const Anope::string>("regexengine").c_str()); + source.Reply(_("Regex matches are also supported using the {0} engine. Enclose your pattern in // if this is desired."), Config->GetBlock("options")->Get<const Anope::string>("regexengine")); } return true; @@ -180,16 +170,18 @@ class CommandCSSetPrivate : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; + if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } @@ -199,7 +191,7 @@ class CommandCSSetPrivate : public Command if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->name); return; } @@ -207,18 +199,16 @@ class CommandCSSetPrivate : public Command { Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable private"; ci->Extend<bool>("CS_PRIVATE"); - source.Reply(_("Private option for %s is now \002on\002."), ci->name.c_str()); + source.Reply(_("Private option for \002{0}\002 is now \002on\002."), ci->name); } else if (params[1].equals_ci("OFF")) { Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable private"; ci->Shrink<bool>("CS_PRIVATE"); - source.Reply(_("Private option for %s is now \002off\002."), ci->name.c_str()); + source.Reply(_("Private option for \002{0}\002 is now \002off\002."), ci->name); } else this->OnSyntaxError(source, "PRIVATE"); - - return; } bool OnHelp(CommandSource &source, const Anope::string &) override @@ -230,8 +220,7 @@ class CommandCSSetPrivate : public Command BotInfo *bi; Anope::string cmd; if (Command::FindCommandFromService("chanserv/list", bi, cmd)) - source.Reply(_("When \002private\002 is set, the channel will not appear in\n" - "%s's %s command."), bi->nick.c_str(), cmd.c_str()); + source.Reply(_("When \002private\002 is set, the channel will not appear in the \002{0}\002 command of \002{1}\002."), cmd, bi->nick); return true; } }; diff --git a/modules/commands/cs_log.cpp b/modules/commands/cs_log.cpp index 39e6a31b5..9fd1a2fdf 100644 --- a/modules/commands/cs_log.cpp +++ b/modules/commands/cs_log.cpp @@ -114,14 +114,22 @@ public: ChanServ::Channel *ci = ChanServ::Find(channel); if (ci == NULL) - source.Reply(CHAN_X_NOT_REGISTERED, channel.c_str()); - else if (!source.AccessFor(ci).HasPriv("SET") && !source.HasPriv("chanserv/administration")) - source.Reply(ACCESS_DENIED); - else if (params.size() == 1) + { + source.Reply(_("Channel \002{0}\002 isn't registered."), channel); + return; + } + + if (!source.AccessFor(ci).HasPriv("SET") && !source.HasPriv("chanserv/administration")) + { + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->name); + return; + } + + if (params.size() == 1) { LogSettings *ls = ci->Require<LogSettings>("logsettings"); if (!ls || (*ls)->empty()) - source.Reply(_("There currently are no logging configurations for %s."), ci->name.c_str()); + source.Reply(_("There currently are no logging configurations for \002{0}\002."), ci->name); else { ListFormatter list(source.GetAccount()); @@ -140,7 +148,7 @@ public: list.AddEntry(entry); } - source.Reply(_("Log list for %s:"), ci->name.c_str()); + source.Reply(_("Log list for \002{0}\002:"), ci->name); std::vector<Anope::string> replies; list.Process(replies); @@ -153,7 +161,7 @@ public: { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } @@ -165,7 +173,7 @@ public: size_t sl = command.find('/'); if (sl == Anope::string::npos) { - source.Reply(_("%s is not a valid command."), command.c_str()); + source.Reply(_("\002{0}\002 is not a valid command."), command); return; } @@ -190,20 +198,20 @@ public: } else { - source.Reply(_("%s is not a valid command."), command.c_str()); + source.Reply(_("\002{0}\002 is not a valid command."), command); return; } if (!method.equals_ci("MESSAGE") && !method.equals_ci("NOTICE") && !method.equals_ci("MEMO")) { - source.Reply(_("%s is not a valid logging method."), method.c_str()); + source.Reply(_("\002%s\002 is not a valid logging method.")); return; } for (unsigned i = 0; i < extra.length(); ++i) if (ModeManager::GetStatusChar(extra[i]) == 0) { - source.Reply(_("%c is an unknown status mode."), extra[i]); + source.Reply(_("\002%c\002 is an unknown status mode."), extra[i]); return; } @@ -218,14 +226,14 @@ public: if (log->extra == 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 %s on %s with log method %s%s%s has been removed."), !log->command_name.empty() ? log->command_name.c_str() : log->service_name.c_str(), !log->command_service.empty() ? log->command_service.c_str() : "any service", method.c_str(), extra.empty() ? "" : " ", extra.empty() ? "" : extra.c_str()); + source.Reply(_("Logging for command \002{0}\002 on \002{1}\002 with log method \002{2}{3}{4}\002 has been removed."), !log->command_name.empty() ? log->command_name : log->service_name, !log->command_service.empty() ? log->command_service : "any service", method, extra.empty() ? "" : " ", extra); delete log; } else { log->extra = 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 %s on %s, now using log method %s%s%s."), !log->command_name.empty() ? log->command_name.c_str() : log->service_name.c_str(), !log->command_service.empty() ? log->command_service.c_str() : "any service", method.c_str(), extra.empty() ? "" : " ", extra.empty() ? "" : extra.c_str()); + source.Reply(_("Logging changed for command \002{0}\002 on \002{1}\002, now using log method \002{2}{3}{4]\002."), !log->command_name.empty() ? log->command_name : log->service_name, !log->command_service.empty() ? log->command_service : "any service", method, extra.empty() ? "" : " ", extra); } return; } @@ -246,7 +254,7 @@ public: Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to log " << command << " with method " << method << (extra == "" ? "" : " ") << extra; - source.Reply(_("Logging is now active for command %s on %s, using log method %s%s%s."), !command_name.empty() ? command_name.c_str() : service_name.c_str(), bi ? bi->nick.c_str() : "any service", method.c_str(), extra.empty() ? "" : " ", extra.empty() ? "" : extra.c_str()); + 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 this->OnSyntaxError(source, ""); @@ -254,28 +262,24 @@ public: bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("The %s command allows users to configure logging settings\n" - "for their channel. If no parameters are given this command\n" - "lists the current logging methods in place for this channel.\n" - " \n" - "Otherwise, \037command\037 must be a command name, and \037method\037\n" - "is one of the following logging methods:\n" - " \n" - " MESSAGE [status], NOTICE [status], MEMO\n" - " \n" - "Which are used to message, notice, and memo the channel respectively.\n" - "With MESSAGE or NOTICE you must have a service bot assigned to and joined\n" - "to your channel. Status may be a channel status such as @ or +.\n" - " \n" - "To remove a logging method use the same syntax as you would to add it.\n" - " \n" - "Example:\n" - " %s #anope chanserv/access MESSAGE @%\n" - " Would message any channel operators whenever someone used the\n" - " ACCESS command on ChanServ on the channel."), - source.command.upper().c_str(), source.command.upper().c_str()); + source.Reply(_("The {0} command allows users to configure logging settings for \037channel\037." + " If no parameters are given this command lists the current logging methods in place on \037channel\037." + " Otherwise, \037command\037 must be a command name, and \037method\037 must be one of the following logging methods:\n" + "\n" + " MESSAGE [status], NOTICE [status], MEMO\n" + "\n" + "Which are used to message, notice, and memo the channel respectively." + " With MESSAGE or NOTICE you must have a service bot assigned to and joined to your channel." + " Status may be a channel status such as @ or +.\n" + "\n" + "To remove a logging method use the same syntax as you would to add it.\n" + "\n" + "Use of this command requires the \002{1}\002 privilege on \037channel\037." + "\n" + "Example:\n" + " {command} #anope chanserv/access MESSAGE @\n" + " Would message any channel operators of \"#anope\" whenever someone used the \"ACCESS\" command on ChanServ for \"#anope\"."), + source.command, "SET"); return true; } }; @@ -393,7 +397,7 @@ class CSLog : public Module else if (log->method.equals_ci("MESSAGE") && l->ci->c) { IRCD->SendPrivmsg(l->ci->WhoSends(), log->extra + l->ci->c->name, "%s", buffer.c_str()); - //l->ci->WhoSends()->lastmsg = Anope::CurTime; + //l->ci->WhoSends()->lastmsg = Anope::CurTime; XXX } else if (log->method.equals_ci("NOTICE") && l->ci->c) IRCD->SendNotice(l->ci->WhoSends(), log->extra + l->ci->c->name, "%s", buffer.c_str()); diff --git a/modules/commands/cs_mode.cpp b/modules/commands/cs_mode.cpp index 9750cc031..696d0214f 100644 --- a/modules/commands/cs_mode.cpp +++ b/modules/commands/cs_mode.cpp @@ -273,7 +273,7 @@ class CommandCSMode : public Command if (Anope::ReadOnly && !subcommand.equals_ci("LIST")) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } @@ -316,20 +316,20 @@ class CommandCSMode : public Command ChannelMode *cm = ModeManager::FindChannelModeByChar(modes[i]); if (!cm) { - source.Reply(_("Unknown mode character %c ignored."), modes[i]); + source.Reply(_("Unknown mode character \002{0}\002 ignored."), modes[i]); break; } else if (u && !cm->CanSet(u)) { - source.Reply(_("You may not (un)lock mode %c."), modes[i]); + source.Reply(_("You may not (un)lock mode \002{0}\002."), modes[i]); break; } Anope::string mode_param; if (((cm->type == MODE_STATUS || cm->type == MODE_LIST) && !sep.GetToken(mode_param)) || (cm->type == MODE_PARAM && adding && !sep.GetToken(mode_param))) - source.Reply(_("Missing parameter for mode %c."), cm->mchar); + source.Reply(_("Missing parameter for mode \002{0}\002."), cm->mchar); else if (cm->type == MODE_LIST && ci->c && IRCD->GetMaxListFor(ci->c) && ci->c->HasMode(cm->name) >= IRCD->GetMaxListFor(ci->c)) - source.Reply(_("List for mode %c is full."), cm->mchar); + source.Reply(_("List for mode \002{0}\002 is full."), cm->mchar); else { modelocks->SetMLock(cm, adding, mode_param, source.GetNick()); @@ -358,7 +358,7 @@ class CommandCSMode : public Command if (!reply.empty()) { - source.Reply(_("%s locked on %s."), reply.c_str(), ci->name.c_str()); + source.Reply(_("\002{0}\002 locked on \002{1}\002."), reply.c_str(), ci->name.c_str()); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to lock " << reply; } else if (needreply) @@ -391,29 +391,29 @@ class CommandCSMode : public Command ChannelMode *cm = ModeManager::FindChannelModeByChar(modes[i]); if (!cm) { - source.Reply(_("Unknown mode character %c ignored."), modes[i]); + source.Reply(_("Unknown mode character \002{0}\002 ignored."), modes[i]); break; } else if (u && !cm->CanSet(u)) { - source.Reply(_("You may not (un)lock mode %c."), modes[i]); + source.Reply(_("You may not (un)lock mode \002{0}\002."), modes[i]); break; } Anope::string mode_param; if (cm->type != MODE_REGULAR && !sep.GetToken(mode_param)) - source.Reply(_("Missing parameter for mode %c."), cm->mchar); + source.Reply(_("Missing parameter for mode \002{0}\002."), cm->mchar); else { if (modelocks->RemoveMLock(cm, adding, mode_param)) { if (!mode_param.empty()) mode_param = " " + mode_param; - source.Reply(_("%c%c%s has been unlocked from %s."), adding == 1 ? '+' : '-', cm->mchar, mode_param.c_str(), ci->name.c_str()); + source.Reply(_("\002{0}{1}{2}\002 has been unlocked from \002{3}\002."), adding == 1 ? '+' : '-', cm->mchar, mode_param, ci->name); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to unlock " << (adding ? '+' : '-') << cm->mchar << mode_param; } else - source.Reply(_("%c%c is not locked on %s."), adding == 1 ? '+' : '-', cm->mchar, ci->name.c_str()); + source.Reply(_("\002{0}{1}\002 is not locked on \002{2}\002."), adding == 1 ? '+' : '-', cm->mchar, ci->name); } } } @@ -426,7 +426,7 @@ class CommandCSMode : public Command const ModeLocks::ModeList mlocks = modelocks->GetMLock(); if (mlocks.empty()) { - source.Reply(_("Channel %s has no mode locks."), ci->name.c_str()); + source.Reply(_("Channel \002{0}\002 has no mode locks."), ci->name); } else { @@ -448,7 +448,7 @@ class CommandCSMode : public Command list.AddEntry(entry); } - source.Reply(_("Mode locks for %s:"), ci->name.c_str()); + source.Reply(_("Mode locks for \002{0}\002:"), ci->name); std::vector<Anope::string> replies; list.Process(replies); @@ -542,7 +542,7 @@ class CommandCSMode : public Command { if (!this->CanSet(source, ci, cm, false) && !can_override) { - source.Reply(_("You do not have access to set mode %c."), cm->mchar); + source.Reply(_("You do not have access to set mode \002{0}\002."), cm->mchar); break; } @@ -555,7 +555,7 @@ class CommandCSMode : public Command if (uc->user->IsProtected() || (ci->HasExt("PEACE") && targ_access >= u_access && !can_override)) { - source.Reply(_("You do not have the access to change %s's modes."), uc->user->nick.c_str()); + source.Reply(_("You do not have the access to change the modes of \002{0}\002."), uc->user->nick.c_str()); continue; } @@ -573,13 +573,13 @@ class CommandCSMode : public Command User *target = User::Find(param, true); if (target == NULL) { - source.Reply(NICK_X_NOT_IN_USE, param.c_str()); + source.Reply(_("User \002{0}\002 isn't currently online."), param); break; } if (!this->CanSet(source, ci, cm, source.GetUser() == target) && !can_override) { - source.Reply(_("You do not have access to set mode %c."), cm->mchar); + source.Reply(_("You do not have access to set mode \002{0}\002."), cm->mchar); break; } @@ -588,12 +588,12 @@ class CommandCSMode : public Command ChanServ::AccessGroup targ_access = ci->AccessFor(target); if (ci->HasExt("PEACE") && targ_access >= u_access && !can_override) { - source.Reply(_("You do not have the access to change %s's modes."), target->nick.c_str()); + source.Reply(_("You do not have the access to change the modes of \002{0}\002"), target->nick); break; } else if (target->IsProtected()) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. \002{0}\002 is protected and can not have their modes changed."), target->nick); break; } } @@ -658,13 +658,13 @@ class CommandCSMode : public Command if (!cm) { - source.Reply(_("There is no such mode %s."), param.c_str()); + source.Reply(_("There is no such mode \002{0}\002."), param); return; } if (cm->type != MODE_STATUS && cm->type != MODE_LIST) { - source.Reply(_("Mode %s is not a status or list mode."), param.c_str()); + source.Reply(_("Mode \002{0}\002 is not a status or list mode."), param); return; } @@ -687,27 +687,31 @@ class CommandCSMode : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; const Anope::string &subcommand = params[1]; - ChanServ::Channel *ci = ChanServ::Find(params[0]); - + ChanServ::Channel *ci = ChanServ::Find(chan); if (!ci) - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); - else if (subcommand.equals_ci("LOCK") && params.size() > 2) + { + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); + return; + } + + if (subcommand.equals_ci("LOCK") && params.size() > 2) { if (!source.AccessFor(ci).HasPriv("MODE") && !source.HasPriv("chanserv/administration")) - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "MODE", ci->name); else this->DoLock(source, ci, params); } else if (!ci->c) - source.Reply(CHAN_X_NOT_IN_USE, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 doesn't exist."), ci->name); else if (subcommand.equals_ci("SET") && params.size() > 2) this->DoSet(source, ci, params); else if (subcommand.equals_ci("CLEAR")) { if (!source.AccessFor(ci).HasPriv("MODE") && !source.HasPriv("chanserv/administration")) - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "MODE", ci->name); else this->DoClear(source, ci, params); } @@ -717,31 +721,26 @@ class CommandCSMode : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Mainly controls mode locks and mode access (which is different from channel access)\n" - "on a channel.\n" - " \n" - "The \002%s LOCK\002 command allows you to add, delete, and view mode locks on a channel.\n" - "If a mode is locked on or off, services will not allow that mode to be changed. The \002SET\002\n" - "command will clear all existing mode locks and set the new one given, while \002ADD\002 and \002DEL\002\n" - "modify the existing mode lock.\n" - "Example:\n" - " \002MODE #channel LOCK ADD +bmnt *!*@*aol*\002\n" - " \n" - "The \002%s SET\002 command allows you to set modes through services. Wildcards * and ? may\n" - "be given as parameters for list and status modes.\n" - "Example:\n" - " \002MODE #channel SET +v *\002\n" - " Sets voice status to all users in the channel.\n" - " \n" - " \002MODE #channel SET -b ~c:*\n" - " Clears all extended bans that start with ~c:\n" - " \n" - "The \002%s CLEAR\002 command is an easy way to clear modes on a channel. \037what\037 may be\n" - "any mode name. Examples include bans, excepts, inviteoverrides, ops, halfops, and voices. If \037what\037\n" - "is not given then all basic modes are removed."), - source.command.upper().c_str(), source.command.upper().c_str(), source.command.upper().c_str()); + source.Reply(_("Controls mode locks and allows changing modes on a channel." + "\n" + "The \002{0} LOCK\002 command allows you to add, delete, and view mode locks on a channel." + " If a mode is locked on or off, services will not allow that mode to be changed." + " The \002SET\002 command will clear all existing mode locks and set the new one given, while \002ADD\002 and \002DEL\002 modify the existing mode lock.\n" + "\n" + "Example:\n" + " {0} #channel LOCK ADD +bmnt *!*@*aol*\n" + "\n" + "The \002{0} SET\002 command allows you to set modes through services. Wildcards * and ? may be given as parameters for list and status modes.\n" + "Example:\n" + " {0} #channel SET +v *\n" + " Sets voice status to all users in the channel.\n" + "\n" + " {0} #channel SET -b ~c:*\n" + " Clears all extended bans that start with ~c:\n" + "\n" + "The \002{0} CLEAR\002 command is an easy way to clear modes on a channel. \037what\037 may be any mode name. Examples include bans, excepts, inviteoverrides, ops, halfops, and voices." + " If \037what\037 is not given then all basic modes are removed."), + source.command.upper()); return true; } }; @@ -758,25 +757,26 @@ class CommandCSModes : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; User *u = source.GetUser(), *targ = params.size() > 1 ? User::Find(params[1], true) : u; - ChanServ::Channel *ci = ChanServ::Find(params[0]); if (!targ) { - if (params.size() > 1) - source.Reply(NICK_X_NOT_IN_USE, params[1].c_str()); + source.Reply(_("User \002{0}\002 isn't currently online."), params.size() > 1 ? params[1] : source.GetNick()); return; } + ChanServ::Channel *ci = ChanServ::Find(chan); if (!ci) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } - else if (!ci->c) + + if (!ci->c) { - source.Reply(CHAN_X_NOT_IN_USE, ci->name.c_str()); + source.Reply(_("Channel \002%s\002 doesn't exist."), ci->name); return; } @@ -787,16 +787,14 @@ class CommandCSModes : public Command bool override = false; if (m.second.empty()) - { - source.Reply(ACCESS_DENIED); - return; - } + return; // Configuration issue - if (u == targ ? !u_access.HasPriv(m.second + "ME") : !u_access.HasPriv(m.second)) + const Anope::string &want = u == targ ? m.second + "ME" : m.second; + if (!u_access.HasPriv(want)) { if (!can_override) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), want, ci->name); return; } else @@ -807,7 +805,7 @@ class CommandCSModes : public Command { if (!can_override) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. \002{0}\002 has the same or more privileges than you on \002{1}\002."), targ->nick, ci->name); return; } else @@ -816,7 +814,7 @@ class CommandCSModes : public Command if (!ci->c->FindUser(targ)) { - source.Reply(NICK_X_NOT_ON_CHAN, targ->nick.c_str(), ci->name.c_str()); + source.Reply(_("User \002{0}\002 is not on channel \002{1}\002."), targ->nick, ci->name); return; } @@ -848,18 +846,14 @@ class CommandCSModes : public Command if (m.second.empty()) return false; - this->SendSyntax(source); - source.Reply(" "); if (m.first) - source.Reply(_("Gives %s status to the selected nick on a channel. If \037nick\037 is\n" - "not given, it will %s you."), - m.second.upper().c_str(), m.second.lower().c_str()); + source.Reply(_("Gives {0} status to the selected \037user\037 on \037channel\037. If \037user\037 is not given, it will give the status to you."), + m.second.upper()); else - source.Reply(_("Removes %s status from the selected nick on a channel. If \037nick\037 is\n" - "not given, it will de%s you."), - m.second.upper().c_str(), m.second.lower().c_str()); + source.Reply(_("Removes {0} status from the selected \037user\037 on \037channel\037. If \037user\037 is not given, it will remove the status from you."), + m.second.upper()); source.Reply(" "); - source.Reply(_("You must have the %s(ME) privilege on the channel to use this command."), m.second.upper().c_str()); + source.Reply(_("Use of this command requires the \002{1}(ME)\002 privilege on \037channel\037."), m.second.upper()); return true; } diff --git a/modules/commands/cs_register.cpp b/modules/commands/cs_register.cpp index 4e584b51c..594babe2f 100644 --- a/modules/commands/cs_register.cpp +++ b/modules/commands/cs_register.cpp @@ -36,19 +36,24 @@ class CommandCSRegister : public Command else if (nc->HasExt("UNCONFIRMED")) source.Reply(_("You must confirm your account before you can register a channel.")); else if (chan[0] == '&') - source.Reply(_("Local channels cannot be registered.")); + source.Reply(_("Local channels can not be registered.")); else if (chan[0] != '#') - source.Reply(CHAN_SYMBOL_REQUIRED); + source.Reply(_("Please use the symbol of \002#\002 when attempting to register.")); else if (!IRCD->IsChannelValid(chan)) - source.Reply(CHAN_X_INVALID, chan.c_str()); + source.Reply(_("Channel \002{0}\002 is not a valid channel."), chan); else if (!c && u) - source.Reply(CHAN_X_NOT_IN_USE, chan.c_str()); + source.Reply(_("Channel \002{0}\002 doesn't exist."), chan); else if (ci) source.Reply(_("Channel \002%s\002 is already registered!"), chan.c_str()); else if (c && !c->HasUserStatus(u, "OP")) source.Reply(_("You must be a channel operator to register the channel.")); else if (maxregistered && nc->channelcount >= maxregistered && !source.HasPriv("chanserv/no-register-limit")) - source.Reply(nc->channelcount > maxregistered ? CHAN_EXCEEDED_CHANNEL_LIMIT : CHAN_REACHED_CHANNEL_LIMIT, maxregistered); + { + if (nc->channelcount > maxregistered) + source.Reply(_("Sorry, you have already exceeded your limit of \002{0}\002 channels."), maxregistered); + else + source.Reply(_("Sorry, you have already reached your limit of \002{0}\002 channels."), maxregistered); + } else { if (!ChanServ::service) @@ -67,7 +72,7 @@ class CommandCSRegister : public Command ci->last_topic_setter = source.service->nick; Log(LOG_COMMAND, source, this, ci); - source.Reply(_("Channel \002%s\002 registered under your account: %s"), chan.c_str(), nc->display.c_str()); + source.Reply(_("Channel \002{0}\002 registered under your account: \002{1}\002"), chan, nc->display); /* Implement new mode lock */ if (c) @@ -85,28 +90,22 @@ class CommandCSRegister : public Command { this->SendSyntax(source); source.Reply(" "); - source.Reply(_("Registers a channel in the %s database. In order\n" - "to use this command, you must first be a channel operator\n" - "on the channel you're trying to register.\n" - "The description, which is optional, is a\n" - "general description of the channel's purpose.\n" - " \n" - "When you register a channel, you are recorded as the\n" - "\"founder\" of the channel. The channel founder is allowed\n" - "to change all of the channel settings for the channel;\n" - "%s will also automatically give the founder\n" - "channel-operator privileges when s/he enters the channel."), - source.service->nick.c_str(), source.service->nick.c_str()); + source.Reply(_("Registers a channel, which sets you as the founder and prevents other users from gaining unauthorized access in the channel." + " To use this command, you must first be a channel operator on \037channel\037." + " The description, which is optional, is a general description of the channel's purpose.\n" + "\n" + "When you register a channel, you are recorded as the founder of the channel." + " The channel founder is allowed to change all of the channel settings for the channel," + " and will automatically be given channel operator status when entering the channel.")); + BotInfo *bi; Anope::string cmd; - if (Command::FindCommandFromService("chanserv/access", bi, cmd)) - source.Reply(_(" \n" - "See the \002%s\002 command (\002%s%s HELP ACCESS\002) for\n" - "information on giving a subset of these privileges to\n" - "other channel users.\n"), cmd.c_str(), Config->StrictPrivmsg.c_str(), bi->nick.c_str()); - source.Reply(_(" \n" - "NOTICE: In order to register a channel, you must have\n" - "first registered your nickname.")); + CommandInfo *help = source.service->FindCommand("generic/help"); + if (Command::FindCommandFromService("chanserv/access", bi, cmd) && help) + source.Reply(_("\n" + "See the \002{0}\002 command (\002{1}{2} {3} {0}\002) for information on giving a subset of these privileges to other users."), + cmd, Config->StrictPrivmsg, bi->nick, help->cname); + return true; } }; diff --git a/modules/commands/cs_seen.cpp b/modules/commands/cs_seen.cpp index 873457b3a..8ae9814a1 100644 --- a/modules/commands/cs_seen.cpp +++ b/modules/commands/cs_seen.cpp @@ -168,15 +168,13 @@ class CommandOSSeen : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("The \002STATS\002 command prints out statistics about stored nicks and memory usage.")); - source.Reply(_("The \002CLEAR\002 command lets you clean the database by removing all entries from the\n" - "entries from the database that were added within \037time\037.\n" - " \n" - "Example:\n" - " %s CLEAR 30m\n" - " Will remove all entries that were added within the last 30 minutes."), source.command.c_str()); + source.Reply(_("The \002STATS\002 command prints out statistics about stored nicks and memory usage.\n" + "The \002CLEAR\002 command lets you clean the database by removing all entries from the entries from the database that were added within \037time\037.\n" + "\n" + "Example:\n" + " {0} CLEAR 30m\n" + " Will remove all entries that were added within the last 30 minutes."), + source.command); return true; } }; @@ -267,26 +265,26 @@ class CommandSeen : public Command if (target.length() > Config->GetBlock("networkinfo")->Get<unsigned>("nicklen")) { - source.Reply(_("Nick too long, max length is %u characters."), Config->GetBlock("networkinfo")->Get<unsigned>("nicklen")); + source.Reply(_("Nick too long, max length is \002{0}\002 characters."), Config->GetBlock("networkinfo")->Get<unsigned>("nicklen")); return; } if (BotInfo::Find(target, true) != NULL) { - source.Reply(_("%s is a client on services."), target.c_str()); + source.Reply(_("\002{0}\002 is a service bot."), target); return; } if (target.equals_ci(source.GetNick())) { - source.Reply(_("You might see yourself in the mirror, %s."), source.GetNick().c_str()); + source.Reply(_("You might see yourself in the mirror, \002{0}\002."), source.GetNick()); return; } SeenInfo *info = FindInfo(target); if (!info) { - source.Reply(_("Sorry, I have not seen %s."), target.c_str()); + source.Reply(_("Sorry, I have not seen \002{0}\002."), target); return; } @@ -302,8 +300,8 @@ class CommandSeen : public Command if (info->type == NEW) { - source.Reply(_("%s (%s) was last seen connecting %s ago (%s)%s"), - target.c_str(), info->vhost.c_str(), timebuf.c_str(), timebuf2.c_str(), onlinestatus.c_str()); + source.Reply(_("\002{0}\002 (\002{1}\002) was last seen connecting \002{2}\002 ago (\002{3}\002){4}"), + target, info->vhost, timebuf, timebuf2, onlinestatus); } else if (info->type == NICK_TO) { @@ -313,55 +311,51 @@ class CommandSeen : public Command else onlinestatus = Anope::printf(_(", but %s mysteriously dematerialized."), info->nick2.c_str()); - source.Reply(_("%s (%s) was last seen changing nick to %s %s ago%s"), - target.c_str(), info->vhost.c_str(), info->nick2.c_str(), timebuf.c_str(), onlinestatus.c_str()); + source.Reply(_("\002{0}\002 (\002{1}\002) was last seen changing nick to \002{2}\002 \002{3}\002 ago{4}"), + target, info->vhost, info->nick2, timebuf, onlinestatus); } else if (info->type == NICK_FROM) { - source.Reply(_("%s (%s) was last seen changing nick from %s to %s %s ago%s"), - target.c_str(), info->vhost.c_str(), info->nick2.c_str(), target.c_str(), timebuf.c_str(), onlinestatus.c_str()); + source.Reply(_("\002{0}\002 (\002{1}\002) was last seen changing nick from \002{2}\002 to \002{3} {4}\002 ago{5}"), + target, info->vhost, info->nick2, target, timebuf, onlinestatus); } else if (info->type == JOIN) { if (ShouldHide(info->channel, u2)) - source.Reply(_("%s (%s) was last seen joining a secret channel %s ago%s"), - target.c_str(), info->vhost.c_str(), timebuf.c_str(), onlinestatus.c_str()); + source.Reply(_("\002{0}\002 (\002{1}\002) was last seen joining a secret channel \002{2}\002 ago{3}"), + target, info->vhost, timebuf, onlinestatus); else - source.Reply(_("%s (%s) was last seen joining %s %s ago%s"), - target.c_str(), info->vhost.c_str(), info->channel.c_str(), timebuf.c_str(), onlinestatus.c_str()); + source.Reply(_("\002{0}\002 (\002{1}\002) was last seen joining \002{2} {3}\002 ago{4}"), + target, info->vhost, info->channel, timebuf, onlinestatus); } else if (info->type == PART) { if (ShouldHide(info->channel, u2)) - source.Reply(_("%s (%s) was last seen parting a secret channel %s ago%s"), - target.c_str(), info->vhost.c_str(), timebuf.c_str(), onlinestatus.c_str()); + source.Reply(_("\002{0}\002 (\002{1}\002) was last seen parting a secret channel \002{2}\002 ago{3}"), + target, info->vhost, timebuf, onlinestatus); else - source.Reply(_("%s (%s) was last seen parting %s %s ago%s"), - target.c_str(), info->vhost.c_str(), info->channel.c_str(), timebuf.c_str(), onlinestatus.c_str()); + source.Reply(_("\002{0}\002 (\002{1}\002) was last seen parting \002{2} {3}\002 ago{4}"), + target, info->vhost, info->channel, timebuf, onlinestatus); } else if (info->type == QUIT) { - source.Reply(_("%s (%s) was last seen quitting (%s) %s ago (%s)."), - target.c_str(), info->vhost.c_str(), info->message.c_str(), timebuf.c_str(), timebuf2.c_str()); + source.Reply(_("\002{0}\002 (\002{1}\002) was last seen quitting (\002{2}\002) \002{3}\002 ago (\002{4}\\2)."), + target, info->vhost, info->message, timebuf, timebuf2); } else if (info->type == KICK) { if (ShouldHide(info->channel, u2)) - source.Reply(_("%s (%s) was kicked from a secret channel %s ago%s"), - target.c_str(), info->vhost.c_str(), timebuf.c_str(), onlinestatus.c_str()); + source.Reply(_("\002{0}\002 (\002{1}\002) was kicked from a secret channel \002{2}\002 ago{3}"), + target, info->vhost, timebuf, onlinestatus); else - source.Reply(_("%s (%s) was kicked from %s (\"%s\") %s ago%s"), - target.c_str(), info->vhost.c_str(), info->channel.c_str(), info->message.c_str(), timebuf.c_str(), onlinestatus.c_str()); + source.Reply(_("\002{0}\002 (\002{1}\002) was kicked from \002{2}\002 (\"{3}\") {4} ago{5}"), + target, info->vhost, info->channel, info->message, timebuf, onlinestatus); } } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Checks for the last time \037nick\037 was seen joining, leaving,\n" - "or changing nick on the network and tells you when and, depending\n" - "on channel or user settings, where it was.")); + source.Reply(_("Checks for the last time \037nick\037 was seen joining, leaving, or changing nick on the network and tells you when and, depending on channel or user settings, where it was.")); return true; } }; diff --git a/modules/commands/cs_set.cpp b/modules/commands/cs_set.cpp index 21969833d..df1091078 100644 --- a/modules/commands/cs_set.cpp +++ b/modules/commands/cs_set.cpp @@ -33,10 +33,9 @@ class CommandCSSet : public Command { this->SendSyntax(source); source.Reply(" "); - source.Reply(_("Allows the channel founder to set various channel options\n" - "and other information.\n" - " \n" - "Available options:")); + source.Reply(_("Allows the channel founder to set various channel options and other information.\n" + "\n" + "Available options:")); Anope::string this_name = source.command; bool hide_privileged_commands = Config->GetBlock("options")->Get<bool>("hideprivilegedcommands"); for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it) @@ -60,8 +59,12 @@ class CommandCSSet : public Command c->OnServHelp(source); } } - source.Reply(_("Type \002%s%s HELP %s \037option\037\002 for more information on a\n" - "particular option."), Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), this_name.c_str()); + + CommandInfo *help = source.service->FindCommand("generic/help"); + if (help) + source.Reply(_("Type \002{0}{1} {2} {3} \037option\037\002 for more information on a particular option."), + Config->StrictPrivmsg, source.service->nick, help->cname, this_name); + return true; } }; @@ -77,16 +80,18 @@ class CommandCSSetAutoOp : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; + if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } @@ -96,7 +101,7 @@ class CommandCSSetAutoOp : public Command if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->name); return; } @@ -104,13 +109,13 @@ class CommandCSSetAutoOp : public Command { Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable autoop"; ci->Shrink<bool>("NOAUTOOP"); - source.Reply(_("Services will now automatically give modes to users in \002%s\002."), ci->name.c_str()); + source.Reply(_("Services will now automatically give modes to users in \002{0}\002."), ci->name); } else if (params[1].equals_ci("OFF")) { Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable autoop"; ci->Extend<bool>("NOAUTOOP"); - source.Reply(_("Services will no longer automatically give modes to users in \002%s\002."), ci->name.c_str()); + source.Reply(_("Services will no longer automatically give modes to users in \002{0}\002."), ci->name); } else this->OnSyntaxError(source, "AUTOOP"); @@ -118,12 +123,7 @@ class CommandCSSetAutoOp : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Enables or disables %s's autoop feature for a\n" - "channel. When disabled, users who join the channel will\n" - "not automatically gain any status from %s."), source.service->nick.c_str(), - source.service->nick.c_str(), this->name.c_str()); + source.Reply(_("Enables or disables AUTOOP for a \037channel\037. When disabled, users who join \037channel\037 will not automatically gain any status from {0}."), source.service->nick); return true; } }; @@ -139,16 +139,18 @@ class CommandCSSetBanType : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; + if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } @@ -159,7 +161,7 @@ class CommandCSSetBanType : public Command if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->name); return; } @@ -170,27 +172,24 @@ class CommandCSSetBanType : public Command throw ConvertException("Invalid range"); Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to change the ban type to " << new_type; ci->bantype = new_type; - source.Reply(_("Ban type for channel %s is now #%d."), ci->name.c_str(), ci->bantype); + source.Reply(_("Ban type for channel \002{0}\002 is now \002#{1}\002."), ci->name, ci->bantype); } catch (const ConvertException &) { - source.Reply(_("\002%s\002 is not a valid ban type."), params[1].c_str()); + source.Reply(_("\002{0}\002 is not a valid ban type."), params[1]); } } bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Sets the ban type that will be used by services whenever\n" - "they need to ban someone from your channel.\n" - " \n" - "Bantype is a number between 0 and 3 that means:\n" - " \n" - "0: ban in the form *!user@host\n" - "1: ban in the form *!*user@host\n" - "2: ban in the form *!*@host\n" - "3: ban in the form *!*user@*.domain"), this->name.c_str()); + source.Reply(_("Sets the ban type that will be used by services whenever they need to ban someone from your channel.\n" + "\n" + "Bantype is a number between 0 and 3 that means:\n" + "\n" + "0: ban in the form *!user@host\n" + "1: ban in the form *!*user@host\n" + "2: ban in the form *!*@host\n" + "3: ban in the form *!*user@*.domain")); return true; } }; @@ -206,17 +205,19 @@ class CommandCSSetDescription : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; + const Anope::string ¶m = params.size() > 1 ? params[1] : ""; + if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } - ChanServ::Channel *ci = ChanServ::Find(params[0]); - const Anope::string ¶m = params.size() > 1 ? params[1] : ""; + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } @@ -227,7 +228,7 @@ class CommandCSSetDescription : public Command if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->name); return; } @@ -235,24 +236,19 @@ class CommandCSSetDescription : public Command { ci->desc = param; Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to change the description to " << ci->desc; - source.Reply(_("Description of %s changed to \002%s\002."), ci->name.c_str(), ci->desc.c_str()); + source.Reply(_("Description of \002{0}\002 changed to \002{1}\002."), ci->name, ci->desc); } else { ci->desc.clear(); Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to unset the description"; - source.Reply(_("Description of %s unset."), ci->name.c_str()); + source.Reply(_("Description of \002{0}\002 unset."), ci->name); } - - return; } bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Sets the description for the channel, which shows up with\n" - "the \002LIST\002 and \002INFO\002 commands."), this->name.c_str()); + source.Reply(_("Sets the description for the channel, which shows up with the \002LIST\002 and \002INFO\002 commands.")); return true; } }; @@ -263,39 +259,42 @@ class CommandCSSetFounder : public Command CommandCSSetFounder(Module *creator, const Anope::string &cname = "chanserv/set/founder") : Command(creator, cname, 2, 2) { this->SetDesc(_("Set the founder of a channel")); - this->SetSyntax(_("\037channel\037 \037nick\037")); + this->SetSyntax(_("\037channel\037 \037user\037")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; + const Anope::string ¶m = params[1]; + if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } EventReturn MOD_RESULT; - MOD_RESULT = Event::OnSetChannelOption(&Event::SetChannelOption::OnSetChannelOption, source, this, ci, params[1]); + MOD_RESULT = Event::OnSetChannelOption(&Event::SetChannelOption::OnSetChannelOption, source, this, ci, param); if (MOD_RESULT == EVENT_STOP) return; if (MOD_RESULT != EVENT_ALLOW && (ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.permission.empty() && !source.HasPriv("chanserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->name); return; } - const NickServ::Nick *na = NickServ::FindNick(params[1]); + const NickServ::Nick *na = NickServ::FindNick(param); if (!na) { - source.Reply(NICK_X_NOT_REGISTERED, params[1].c_str()); + source.Reply(_("\002{0}\002 isn't registered."), param); return; } @@ -303,7 +302,7 @@ class CommandCSSetFounder : public Command unsigned max_reg = Config->GetModule("chanserv")->Get<unsigned>("maxregistered"); if (max_reg && nc->channelcount >= max_reg && !source.HasPriv("chanserv/no-register-limit")) { - source.Reply(_("\002%s\002 has too many channels registered."), na->nick.c_str()); + source.Reply(_("\002{0}\002 has too many channels registered."), na->nick); return; } @@ -311,17 +310,14 @@ class CommandCSSetFounder : public Command ci->SetFounder(nc); - source.Reply(_("Founder of \002%s\002 changed to \002%s\002."), ci->name.c_str(), na->nick.c_str()); - - return; + source.Reply(_("Founder of \002{0}\002 changed to \002{1}\002."), ci->name, na->nick); } bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Changes the founder of a channel. The new nickname must\n" - "be a registered one."), this->name.c_str()); + source.Reply(_("Changes the founder of \037channel\037 to \037user\037. Using this command will cause you to lose your founder access to \037channel\037, and cannot be undone." + "\n" + "Use of this command requires being the founder or \037channel\037 or having the \002{0}\002 privilege, if secure founder is enabled or not, respectively.")); return true; } }; @@ -337,16 +333,19 @@ class CommandCSSetKeepModes : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; + const Anope::string ¶m = params[1]; + if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } @@ -357,7 +356,7 @@ class CommandCSSetKeepModes : public Command if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->name); return; } @@ -365,7 +364,7 @@ class CommandCSSetKeepModes : public Command { Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable keep modes"; ci->Extend<bool>("CS_KEEP_MODES"); - source.Reply(_("Keep modes for %s is now \002on\002."), ci->name.c_str()); + source.Reply(_("Keep modes for \002{0}\002 is now \002on\002."), ci->name); if (ci->c) ci->last_modes = ci->c->GetModes(); } @@ -373,7 +372,7 @@ class CommandCSSetKeepModes : public Command { Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable keep modes"; ci->Shrink<bool>("CS_KEEP_MODES"); - source.Reply(_("Keep modes for %s is now \002off\002."), ci->name.c_str()); + source.Reply(_("Keep modes for \002{0}\002 is now \002off\002."), ci->name); ci->last_modes.clear(); } else @@ -382,11 +381,7 @@ class CommandCSSetKeepModes : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Enables or disables keepmodes for the given channel. If keep\n" - "modes is enabled, services will remember modes set on the channel\n" - "and attempt to re-set them the next time the channel is created.")); + source.Reply(_("Enables or disables keepmodes for \037channel\037. If keepmodes is enabled, services will remember modes set on the channel and re-set them the next time the channel is created.")); return true; } }; @@ -402,56 +397,54 @@ class CommandCSSetPeace : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; + const Anope::string ¶m = params[1]; + if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } EventReturn MOD_RESULT; - MOD_RESULT = Event::OnSetChannelOption(&Event::SetChannelOption::OnSetChannelOption, source, this, ci, params[1]); + MOD_RESULT = Event::OnSetChannelOption(&Event::SetChannelOption::OnSetChannelOption, source, this, ci, param); if (MOD_RESULT == EVENT_STOP) return; if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->name); return; } - if (params[1].equals_ci("ON")) + if (param.equals_ci("ON")) { Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable peace"; ci->Extend<bool>("PEACE"); - source.Reply(_("Peace option for %s is now \002on\002."), ci->name.c_str()); + source.Reply(_("Peace option for \002{0}\002 is now \002on\002."), ci->name); } - else if (params[1].equals_ci("OFF")) + else if (param.equals_ci("OFF")) { Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable peace"; ci->Shrink<bool>("PEACE"); - source.Reply(_("Peace option for %s is now \002off\002."), ci->name.c_str()); + source.Reply(_("Peace option for \002{0}\002 is now \002off\002."), ci->name); } else this->OnSyntaxError(source, "PEACE"); - - return; } bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Enables or disables the \002peace\002 option for a channel.\n" - "When \002peace\002 is set, a user won't be able to kick,\n" - "ban or remove a channel status of a user that has\n" - "a level superior or equal to his via %s commands."), source.service->nick.c_str()); + source.Reply(_("Enables or disables the \002peace\002 option for \037channel\037." + " When \002peace\002 is set, a user won't be able to kick, ban or remove a channel status of a user that has a level superior or equal to his via services."), + source.service->nick); return true; } }; @@ -474,27 +467,30 @@ class CommandCSSetPersist : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; + const Anope::string ¶m = params[1]; + if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } EventReturn MOD_RESULT; - MOD_RESULT = Event::OnSetChannelOption(&Event::SetChannelOption::OnSetChannelOption, source, this, ci, params[1]); + MOD_RESULT = Event::OnSetChannelOption(&Event::SetChannelOption::OnSetChannelOption, source, this, ci, param); if (MOD_RESULT == EVENT_STOP) return; if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->name); return; } @@ -552,7 +548,7 @@ class CommandCSSetPersist : public Command } Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable persist"; - source.Reply(_("Channel \002%s\002 is now persistent."), ci->name.c_str()); + source.Reply(_("Channel \002{0}\002 is now persistent."), ci->name); } else if (params[1].equals_ci("OFF")) { @@ -590,7 +586,7 @@ class CommandCSSetPersist : public Command } Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable persist"; - source.Reply(_("Channel \002%s\002 is no longer persistent."), ci->name.c_str()); + source.Reply(_("Channel \002{0}\002 is no longer persistent."), ci->name); } else this->OnSyntaxError(source, "PERSIST"); @@ -598,30 +594,8 @@ class CommandCSSetPersist : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - BotInfo *BotServ = Config->GetClient("BotServ"); - BotInfo *ChanServ = Config->GetClient("ChanServ"); - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Enables or disables the persistent channel setting.\n" - "When persistent is set, the service bot will remain\n" - "in the channel when it has emptied of users.\n" - " \n" - "If your IRCd does not have a permanent (persistent) channel\n" - "mode you must have a service bot in your channel to\n" - "set persist on, and it can not be unassigned while persist\n" - "is on.\n" - " \n" - "If this network does not have %s enabled and does\n" - "not have a permanent channel mode, %s will\n" - "join your channel when you set persist on (and leave when\n" - "it has been set off).\n" - " \n" - "If your IRCd has a permanent (persistent) channel mode\n" - "and it is set or unset (for any reason, including MODE LOCK),\n" - "persist is automatically set and unset for the channel aswell.\n" - "Additionally, services will set or unset this mode when you\n" - "set persist on or off."), BotServ ? BotServ->nick.c_str() : "BotServ", - ChanServ ? ChanServ->nick.c_str() : "ChanServ"); + source.Reply(_("Enables or disables the persistent channel setting." + " When persistent is set, the service bot will remain in the channel when it has emptied of users.")); return true; } }; @@ -637,41 +611,44 @@ class CommandCSSetRestricted : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; + const Anope::string ¶m = params[1]; + if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } EventReturn MOD_RESULT; - MOD_RESULT = Event::OnSetChannelOption(&Event::SetChannelOption::OnSetChannelOption, source, this, ci, params[1]); + MOD_RESULT = Event::OnSetChannelOption(&Event::SetChannelOption::OnSetChannelOption, source, this, ci, param); if (MOD_RESULT == EVENT_STOP) return; if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->name); return; } - if (params[1].equals_ci("ON")) + if (param.equals_ci("ON")) { Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable restricted"; ci->Extend<bool>("RESTRICTED"); - source.Reply(_("Restricted access option for %s is now \002on\002."), ci->name.c_str()); + source.Reply(_("Restricted access option for \002{0}\002 is now \002on\002."), ci->name); } - else if (params[1].equals_ci("OFF")) + else if (param.equals_ci("OFF")) { Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable restricted"; ci->Shrink<bool>("RESTRICTED"); - source.Reply(_("Restricted access option for %s is now \002off\002."), ci->name.c_str()); + source.Reply(_("Restricted access option for \002{0}\002 is now \002off\002."), ci->name); } else this->OnSyntaxError(source, "RESTRICTED"); @@ -679,11 +656,7 @@ class CommandCSSetRestricted : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Enables or disables the \002restricted access\002 option for a\n" - "channel. When \002restricted access\002 is set, users not on the access list will\n" - "instead be kicked and banned from the channel.")); + source.Reply(_("Enables or disables the \002restricted access\002 option for \037channel\037. When \002restricted access\002 is set, users not on the access list will not be permitted to join the channel.")); return true; } }; @@ -699,41 +672,44 @@ class CommandCSSetSecure : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; + const Anope::string ¶m = params[1]; + if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } EventReturn MOD_RESULT; - MOD_RESULT = Event::OnSetChannelOption(&Event::SetChannelOption::OnSetChannelOption, source, this, ci, params[1]); + MOD_RESULT = Event::OnSetChannelOption(&Event::SetChannelOption::OnSetChannelOption, source, this, ci, param); if (MOD_RESULT == EVENT_STOP) return; if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->name); return; } - if (params[1].equals_ci("ON")) + if (param.equals_ci("ON")) { Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable secure"; ci->Extend<bool>("CS_SECURE"); - source.Reply(_("Secure option for %s is now \002on\002."), ci->name.c_str()); + source.Reply(_("Secure option for \002{0}\002 is now \002on\002."), ci->name); } - else if (params[1].equals_ci("OFF")) + else if (param.equals_ci("OFF")) { Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable secure"; ci->Shrink<bool>("CS_SECURE"); - source.Reply(_("Secure option for %s is now \002off\002."), ci->name.c_str()); + source.Reply(_("Secure option for \002{0}\002 is now \002off\002."), ci->name); } else this->OnSyntaxError(source, "SECURE"); @@ -741,13 +717,8 @@ class CommandCSSetSecure : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Enables or disables security features for a\n" - "channel. When \002%s\002 is set, only users who have\n" - "registered their nicknames and IDENTIFY'd\n" - "with their password will be given access to the channel\n" - "as controlled by the access list."), this->name.c_str()); + source.Reply(_("Enables or disables security features for a channel." + " When \002secure\002 is set, only users who have logged in (eg. not recognized based on their hostmask) will be given access to the channel as controlled by the access list.")); return true; } }; @@ -763,41 +734,44 @@ class CommandCSSetSecureFounder : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; + const Anope::string ¶m = params[1]; + if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } EventReturn MOD_RESULT; - MOD_RESULT = Event::OnSetChannelOption(&Event::SetChannelOption::OnSetChannelOption, source, this, ci, params[1]); + MOD_RESULT = Event::OnSetChannelOption(&Event::SetChannelOption::OnSetChannelOption, source, this, ci, param); if (MOD_RESULT == EVENT_STOP) return; if (MOD_RESULT != EVENT_ALLOW && (ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.permission.empty() && !source.HasPriv("chanserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->name); return; } - if (params[1].equals_ci("ON")) + if (param.equals_ci("ON")) { Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable secure founder"; ci->Extend<bool>("SECUREFOUNDER"); - source.Reply(_("Secure founder option for %s is now \002on\002."), ci->name.c_str()); + source.Reply(_("Secure founder option for \002{0}\002 is now \002on\002."), ci->name); } - else if (params[1].equals_ci("OFF")) + else if (param.equals_ci("OFF")) { Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable secure founder"; ci->Shrink<bool>("SECUREFOUNDER"); - source.Reply(_("Secure founder option for %s is now \002off\002."), ci->name.c_str()); + source.Reply(_("Secure founder option for \002{0}\002 is now \002off\002."), ci->name); } else this->OnSyntaxError(source, "SECUREFOUNDER"); @@ -807,11 +781,10 @@ class CommandCSSetSecureFounder : public Command { this->SendSyntax(source); source.Reply(" "); - source.Reply(_("Enables or disables the \002secure founder\002 option for a channel.\n" - "When \002secure founder\002 is set, only the real founder will be\n" - "able to drop the channel, change its founder and its successor,\n" - "and not those who have founder level access through\n" - "the access/qop command.")); + source.Reply(_("Enables or disables the \002secure founder\002 option for a channel." + " When \002secure founder\002 is set, only the real founder will be able to drop the channel, change its founder, and change its successor." + " Otherwise, anyone with the \002{0}\002 privilege will be able to use these commands."), + "FOUNDER"); return true; } }; @@ -827,41 +800,44 @@ class CommandCSSetSecureOps : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; + const Anope::string ¶m = params[1]; + if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } EventReturn MOD_RESULT; - MOD_RESULT = Event::OnSetChannelOption(&Event::SetChannelOption::OnSetChannelOption, source, this, ci, params[1]); + MOD_RESULT = Event::OnSetChannelOption(&Event::SetChannelOption::OnSetChannelOption, source, this, ci, param); if (MOD_RESULT == EVENT_STOP) return; if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->name); return; } - if (params[1].equals_ci("ON")) + if (param.equals_ci("ON")) { Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable secure ops"; ci->Extend<bool>("SECUREOPS"); - source.Reply(_("Secure ops option for %s is now \002on\002."), ci->name.c_str()); + source.Reply(_("Secure ops option for \002{0}\002 is now \002on\002."), ci->name); } - else if (params[1].equals_ci("OFF")) + else if (param.equals_ci("OFF")) { Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable secure ops"; ci->Shrink<bool>("SECUREOPS"); - source.Reply(_("Secure ops option for %s is now \002off\002."), ci->name.c_str()); + source.Reply(_("Secure ops option for \002{0}\002 is now \002off\002."), ci->name); } else this->OnSyntaxError(source, "SECUREOPS"); @@ -869,11 +845,8 @@ class CommandCSSetSecureOps : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Enables or disables the \002secure ops\002 option for a channel.\n" - "When \002secure ops\002 is set, users who are not on the userlist\n" - "will not be allowed chanop status.")); + source.Reply(_("Enables or disables the \002secure ops\002 option for \037channel\037." + " When \002secure ops\002 is set, users will not be allowed to have channel operator status if they do not have the privileges to have it.")); return true; } }; @@ -889,50 +862,52 @@ class CommandCSSetSignKick : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; + const Anope::string ¶m = params[1]; + if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } EventReturn MOD_RESULT; - MOD_RESULT = Event::OnSetChannelOption(&Event::SetChannelOption::OnSetChannelOption, source, this, ci, params[1]); + MOD_RESULT = Event::OnSetChannelOption(&Event::SetChannelOption::OnSetChannelOption, source, this, ci, param); if (MOD_RESULT == EVENT_STOP) return; if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->name); return; } - if (params[1].equals_ci("ON")) + if (param.equals_ci("ON")) { ci->Extend<bool>("SIGNKICK"); ci->Shrink<bool>("SIGNKICK_LEVEL"); - source.Reply(_("Signed kick option for %s is now \002on\002."), ci->name.c_str()); + source.Reply(_("Signed kick option for \002{0}\002 is now \002on\002."), ci->name); Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable sign kick"; } - else if (params[1].equals_ci("LEVEL")) + else if (param.equals_ci("LEVEL")) { ci->Extend<bool>("SIGNKICK_LEVEL"); ci->Shrink<bool>("SIGNKICK"); - source.Reply(_("Signed kick option for %s is now \002on\002, but depends of the\n" - "level of the user that is using the command."), ci->name.c_str()); + source.Reply(_("Signed kick option for \002{0}\002 is now \002on\002, but depends of the privileges of the user that is using the command."), ci->name); Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable sign kick level"; } - else if (params[1].equals_ci("OFF")) + else if (param.equals_ci("OFF")) { ci->Shrink<bool>("SIGNKICK"); ci->Shrink<bool>("SIGNKICK_LEVEL"); - source.Reply(_("Signed kick option for %s is now \002off\002."), ci->name.c_str()); + source.Reply(_("Signed kick option for \002{0}\002 is now \002off\002."), ci->name); Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable sign kick"; } else @@ -941,16 +916,10 @@ class CommandCSSetSignKick : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Enables or disables signed kicks for a\n" - "channel. When \002SIGNKICK\002 is set, kicks issued with\n" - "the \002KICK\002 command will have the nick that used the\n" - "command in their reason.\n" - " \n" - "If you use \002LEVEL\002, those who have a level that is superior\n" - "or equal to the SIGNKICK level on the channel won't have their\n" - "kicks signed.")); + source.Reply(_("Enables or disables \002signed kicks\002 for \037channel\037." + " When \002signed kicks\002 is enabled, kicks issued through services will have the nickname of the user who performed the kick included in the kick reason." + " If you use \002LEVEL\002 setting, then only users who do not have the \002{0}\002 privilege will have their kicks signed."), + "SIGNKICK"); return true; } }; @@ -966,17 +935,19 @@ class CommandCSSetSuccessor : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; + const Anope::string ¶m = params[1]; + if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } - ChanServ::Channel *ci = ChanServ::Find(params[0]); - const Anope::string ¶m = params.size() > 1 ? params[1] : ""; + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } @@ -987,7 +958,7 @@ class CommandCSSetSuccessor : public Command if (MOD_RESULT != EVENT_ALLOW && (ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.permission.empty() && !source.HasPriv("chanserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->name); return; } @@ -999,14 +970,16 @@ class CommandCSSetSuccessor : public Command if (!na) { - source.Reply(NICK_X_NOT_REGISTERED, param.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), param); return; } + if (na->nc == ci->GetFounder()) { - source.Reply(_("%s cannot be the successor on channel %s as they are the founder."), na->nick.c_str(), ci->name.c_str()); + source.Reply(_("\002{0}\002 cannot be the successor of channel \002{1}\002 as they are the founder."), na->nick, ci->name); return; } + nc = na->nc; } else @@ -1017,26 +990,16 @@ class CommandCSSetSuccessor : public Command ci->SetSuccessor(nc); if (nc) - source.Reply(_("Successor for \002%s\002 changed to \002%s\002."), ci->name.c_str(), nc->display.c_str()); + source.Reply(_("Successor for \002{0}\002 changed to \002{1}\002."), ci->name, nc->display); else - source.Reply(_("Successor for \002%s\002 unset."), ci->name.c_str()); - - return; + source.Reply(_("Successor for \002{0}\002 unset."), ci->name); } bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Changes the successor of a channel. If the founder's\n" - "nickname expires or is dropped while the channel is still\n" - "registered, the successor will become the new founder of the\n" - "channel. The new nickname must be a registered one.")); - unsigned max_reg = Config->GetModule("chanserv")->Get<unsigned>("maxregistered"); - if (max_reg) - source.Reply(_("However, if the successor already has too many\n" - "channels registered (%d), the channel will be dropped\n" - "instead, just as if no successor had been set."), max_reg); + source.Reply(_("Changes the successor of \037channel\037." + " The successor of a channel is automatically given ownership of the channel if the founder's account drops of expires." + " If the success has too many registered channels or there is no successor, the channel may instead be given to one of the users on the channel access list with the most privileges.")); return true; } }; @@ -1052,22 +1015,25 @@ class CommandCSSetNoexpire : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; + const Anope::string ¶m = params[1]; + if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->name); return; } @@ -1075,26 +1041,21 @@ class CommandCSSetNoexpire : public Command { Log(LOG_ADMIN, source, this, ci) << "to enable noexpire"; ci->Extend<bool>("CS_NO_EXPIRE"); - source.Reply(_("Channel %s \002will not\002 expire."), ci->name.c_str()); + source.Reply(_("Channel \002{0} will not\002 expire."), ci->name); } else if (params[1].equals_ci("OFF")) { Log(LOG_ADMIN, source, this, ci) << "to disable noexpire"; ci->Shrink<bool>("CS_NO_EXPIRE"); - source.Reply(_("Channel %s \002will\002 expire."), ci->name.c_str()); + source.Reply(_("Channel \002{0} will\002 expire."), ci->name); } else this->OnSyntaxError(source, "NOEXPIRE"); - - return; } bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Sets whether the given channel will expire. Setting this\n" - "to ON prevents the channel from expiring.")); + source.Reply(_("Sets whether the given \037channel\037 will expire. Setting \002 noexpire\002 to \002on\002 prevents the channel from expiring.")); return true; } }; @@ -1124,7 +1085,7 @@ class CSSet : public Module { SerializableExtensibleItem<bool>::ExtensibleSerialize(e, s, data); - if (s->GetSerializableType()->GetName() != "ChanServ::Channel") + if (s->GetSerializableType()->GetName() != "ChannelInfo") return; const ChanServ::Channel *ci = anope_dynamic_static_cast<const ChanServ::Channel *>(s); @@ -1144,7 +1105,7 @@ class CSSet : public Module { SerializableExtensibleItem<bool>::ExtensibleUnserialize(e, s, data); - if (s->GetSerializableType()->GetName() != "ChanServ::Channel") + if (s->GetSerializableType()->GetName() != "ChannelInfo") return; ChanServ::Channel *ci = anope_dynamic_static_cast<ChanServ::Channel *>(s); diff --git a/modules/commands/cs_set_misc.cpp b/modules/commands/cs_set_misc.cpp index 783dae8d7..b057b1398 100644 --- a/modules/commands/cs_set_misc.cpp +++ b/modules/commands/cs_set_misc.cpp @@ -99,17 +99,19 @@ class CommandCSSetMisc : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; + const Anope::string ¶m = params[1]; + if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } - ChanServ::Channel *ci = ChanServ::Find(params[0]); - const Anope::string ¶m = params.size() > 1 ? params[1] : ""; + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } @@ -120,7 +122,7 @@ class CommandCSSetMisc : public Command if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->name); return; } @@ -134,13 +136,13 @@ class CommandCSSetMisc : public Command { item->Set(ci, CSMiscData(ci, key, param)); Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to change it to " << param; - source.Reply(CHAN_SETTING_CHANGED, scommand.c_str(), ci->name.c_str(), params[1].c_str()); + source.Reply(_("\002{0}\002 for \002{1}\002 set to \002{2}\002."), scommand, ci->name, param); } else { item->Unset(ci); Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to unset it"; - source.Reply(CHAN_SETTING_UNSET, scommand.c_str(), ci->name.c_str()); + source.Reply(_("\002{0}\002 for \002{1}\002 unset."), scommand, ci->name); } } diff --git a/modules/commands/cs_status.cpp b/modules/commands/cs_status.cpp index 7b7415fdb..e559f7749 100644 --- a/modules/commands/cs_status.cpp +++ b/modules/commands/cs_status.cpp @@ -27,73 +27,76 @@ public: ChanServ::Channel *ci = ChanServ::Find(channel); if (ci == NULL) - source.Reply(CHAN_X_NOT_REGISTERED, channel.c_str()); - else if (!source.AccessFor(ci).HasPriv("ACCESS_CHANGE") && !source.HasPriv("chanserv/auspex")) - source.Reply(ACCESS_DENIED); + { + source.Reply(_("Channel \002{0}\002 isn't registered."), channel); + return; + } + + if (!source.AccessFor(ci).HasPriv("ACCESS_CHANGE") && !source.HasPriv("chanserv/auspex")) + { + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "ACCESS_CHANGE", ci->name); + return; + } + + Anope::string nick = source.GetNick(); + if (params.size() > 1) + nick = params[1]; + + ChanServ::AccessGroup ag; + User *u = User::Find(nick, true); + NickServ::Nick *na = NULL; + if (u != NULL) + ag = ci->AccessFor(u); else { - Anope::string nick = source.GetNick(); - if (params.size() > 1) - nick = params[1]; - - ChanServ::AccessGroup ag; - User *u = User::Find(nick, true); - NickServ::Nick *na = NULL; - if (u != NULL) - ag = ci->AccessFor(u); - else - { - na = NickServ::FindNick(nick); - if (na != NULL) - ag = ci->AccessFor(na->nc); - } + na = NickServ::FindNick(nick); + if (na != NULL) + ag = ci->AccessFor(na->nc); + } - if (ag.super_admin) - source.Reply(_("\002%s\002 is a super administrator."), nick.c_str()); - else if (ag.founder) - source.Reply(_("\002%s\002 is the founder of \002%s\002."), nick.c_str(), ci->name.c_str()); - else if (ag.empty()) - source.Reply(_("\002%s\002 has no access on \002%s\002."), nick.c_str(), ci->name.c_str()); - else - { - source.Reply(_("Access for \002%s\002 on \002%s\002:"), nick.c_str(), ci->name.c_str()); + if (ag.super_admin) + source.Reply(_("\002{0}\002 is a super administrator."), nick); + else if (ag.founder) + source.Reply(_("\002{0}\002 is the founder of \002{1}\002."), nick, ci->name); + else if (ag.empty()) + source.Reply(_("\002{0}\002 has no access on \002{1}\002."), nick, ci->name); + else + { + source.Reply(_("Access for \002{0}\002 on \002{1}\002:"), nick, ci->name); - for (unsigned i = 0; i < ag.size(); ++i) - { - ChanServ::ChanAccess *acc = ag[i]; + for (unsigned i = 0; i < ag.size(); ++i) + { + ChanServ::ChanAccess *acc = ag[i]; - source.Reply(_("\002%s\002 matches access entry %s, which has privilege %s."), nick.c_str(), acc->mask.c_str(), acc->AccessSerialize().c_str()); - } + source.Reply(_("\002{0}\002 matches access entry \002{1}\002, which has privilege \002{2}\002."), nick, acc->mask, acc->AccessSerialize()); } + } - for (unsigned j = 0, end = ci->GetAkickCount(); j < end; ++j) + for (unsigned j = 0, end = ci->GetAkickCount(); j < end; ++j) + { + AutoKick *autokick = ci->GetAkick(j); + + if (autokick->nc) + { + if (na && *autokick->nc == na->nc) + source.Reply(_("\002{0}\002 is on the auto kick list of \002{1}\002 ({2})."), na->nc->display, ci->name, autokick->reason); + } + else if (u != NULL) { - AutoKick *autokick = ci->GetAkick(j); - - if (autokick->nc) - { - if (na && *autokick->nc == na->nc) - source.Reply(_("\002%s\002 is on the auto kick list of \002%s\002 (%s)."), na->nc->display.c_str(), ci->name.c_str(), autokick->reason.c_str()); - } - else if (u != NULL) - { - Entry akick_mask("", autokick->mask); - if (akick_mask.Matches(u)) - source.Reply(_("\002%s\002 matches auto kick entry %s on \002%s\002 (%s)."), u->nick.c_str(), autokick->mask.c_str(), ci->name.c_str(), autokick->reason.c_str()); - } + Entry akick_mask("", autokick->mask); + if (akick_mask.Matches(u)) + source.Reply(_("\002{0}\002 matches auto kick entry \002{1}\002 on \002{2}\002 ({3})."), u->nick, autokick->mask, ci->name, autokick->reason); } } } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("This command tells you what a users access is on a channel\n" - "and what access entries, if any, they match. Additionally it\n" - "will tell you of any auto kick entries they match. Usage of\n" - "this command is limited to users who have the ability to modify\n" - "access entries on the channel.")); + source.Reply(_("This command tells you what access \037user\037 has on \037channel\037." + "It will also tell you which access and auto kick entries match \037user\037.\n" + "\n" + "Use of this command requires the \002{0}\002 privilege on \037channel\037."), + "ACCESS_CHANGE"); return true; } }; diff --git a/modules/commands/cs_suspend.cpp b/modules/commands/cs_suspend.cpp index 411b141e6..b97760bd9 100644 --- a/modules/commands/cs_suspend.cpp +++ b/modules/commands/cs_suspend.cpp @@ -81,24 +81,24 @@ class CommandCSSuspend : public Command expiry_secs = Anope::DoTime(expiry); if (expiry_secs == -1) { - source.Reply(BAD_EXPIRY_TIME); + source.Reply(_("Invalid expiry time \002{0}\002."), expiry); return; } } if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } if (ci->HasExt("CS_SUSPENDED")) { - source.Reply(_("\002%s\002 is already suspended."), ci->name.c_str()); + source.Reply(_("\002{0}\002 is already suspended."), ci->name); return; } @@ -126,23 +126,16 @@ class CommandCSSuspend : public Command } 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()); + source.Reply(_("Channel \002{0}\002 is now suspended."), ci->name); this->onchansuspend(&Event::ChanSuspend::OnChanSuspend, ci); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Disallows anyone from using the given channel.\n" - "May be cancelled by using the \002UNSUSPEND\002\n" - "command to preserve all previous channel data/settings.\n" - "If an expiry is given the channel will be unsuspended after\n" - "that period of time, else the default expiry from the\n" - "configuration is used.\n" - " \n" - "Reason may be required on certain networks.")); + source.Reply(_("Disallows anyone from using the given channel." + " All channel settings are preserved while the channel is suspended." + "If \037expiry\037 is given the channel will be unsuspended after that period of time.")); return true; } }; @@ -160,14 +153,15 @@ class CommandCSUnSuspend : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } @@ -175,7 +169,7 @@ class CommandCSUnSuspend : public Command CSSuspendInfo *si = ci->GetExt<CSSuspendInfo>("CS_SUSPENDED"); if (!si) { - source.Reply(_("Channel \002%s\002 isn't suspended."), ci->name.c_str()); + source.Reply(_("Channel \002{0}\002 isn't suspended."), ci->name.c_str()); return; } @@ -190,10 +184,7 @@ class CommandCSUnSuspend : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Releases a suspended channel. All data and settings\n" - "are preserved from before the suspension.")); + source.Reply(_("Releases a suspended channel. All data and settings are preserved from before the suspension.")); return true; } }; @@ -277,7 +268,7 @@ class CSSuspend : public Module CSSuspendInfo *si = suspend.Get(ci); if (si && !source.HasCommand("chanserv/drop")) { - source.Reply(CHAN_X_SUSPENDED, ci->name.c_str()); + source.Reply(_("Channel \002{0}\002 is currently suspended."), ci->name); return EVENT_STOP; } diff --git a/modules/commands/cs_sync.cpp b/modules/commands/cs_sync.cpp index 20154c70a..5dcefdf10 100644 --- a/modules/commands/cs_sync.cpp +++ b/modules/commands/cs_sync.cpp @@ -22,32 +22,42 @@ class CommandCSSync : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { - ChanServ::Channel *ci = ChanServ::Find(params[0]); + const Anope::string &chan = params[0]; + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); - else if (ci->c == NULL) - source.Reply(CHAN_X_NOT_IN_USE, params[0].c_str()); - else if (!source.AccessFor(ci).HasPriv("ACCESS_CHANGE") && !source.HasPriv("chanserv/administration")) - source.Reply(ACCESS_DENIED); - else { - bool override = !source.AccessFor(ci).HasPriv("ACCESS_CHANGE") && source.HasPriv("chanserv/administration"); - Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); + return; + } - for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it) - ci->c->SetCorrectModes(it->second->user, true); + if (ci->c == NULL) + { + source.Reply(_("Channel \002{0}\002 doesn't exist."), ci->name); + return; + } - source.Reply(_("All user modes on \002%s\002 have been synced."), ci->name.c_str()); + if (!source.AccessFor(ci).HasPriv("ACCESS_CHANGE") && !source.HasPriv("chanserv/administration")) + { + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "ACCESS_CHANGE", ci->name); + return; } + + bool override = !source.AccessFor(ci).HasPriv("ACCESS_CHANGE") && source.HasPriv("chanserv/administration"); + Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci); + + for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it) + ci->c->SetCorrectModes(it->second->user, true); + + source.Reply(_("All user modes on \002{0}\002 have been synced.")); } bool OnHelp(CommandSource &source, const Anope::string ¶ms) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Syncs all modes set on users on the channel with the modes\n" - "they should have based on their access.")); + source.Reply(_("Syncs all channel status modes on all users on \037channel\037 with the modes they should have based on the channel access list.\n" + "\n" + "Use of this command requires the \002{0}\002 privilege on \037channel\037."), + "ACCESS_CHNAGE"); return true; } }; diff --git a/modules/commands/cs_topic.cpp b/modules/commands/cs_topic.cpp index 0c0e56696..03a2fb0d5 100644 --- a/modules/commands/cs_topic.cpp +++ b/modules/commands/cs_topic.cpp @@ -25,41 +25,44 @@ class CommandCSSetKeepTopic : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &chan = params[0]; + const Anope::string ¶m = params[1]; + if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } EventReturn MOD_RESULT; - MOD_RESULT = Event::OnSetChannelOption(&Event::SetChannelOption::OnSetChannelOption, source, this, ci, params[1]); + MOD_RESULT = Event::OnSetChannelOption(&Event::SetChannelOption::OnSetChannelOption, source, this, ci, param); if (MOD_RESULT == EVENT_STOP) return; if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->name); return; } - if (params[1].equals_ci("ON")) + if (param.equals_ci("ON")) { Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable keeptopic"; ci->Extend<bool>("KEEPTOPIC"); - source.Reply(_("Topic retention option for %s is now \002on\002."), ci->name.c_str()); + source.Reply(_("Topic retention option for \002{0}\002 is now \002on\002."), ci->name); } - else if (params[1].equals_ci("OFF")) + else if (param.equals_ci("OFF")) { Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable keeptopic"; ci->Shrink<bool>("KEEPTOPIC"); - source.Reply(_("Topic retention option for %s is now \002off\002."), ci->name.c_str()); + source.Reply(_("Topic retention option for \002{0}\002 is now \002off\002."), ci->name); } else this->OnSyntaxError(source, "KEEPTOPIC"); @@ -67,13 +70,9 @@ class CommandCSSetKeepTopic : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Enables or disables the \002topic retention\002 option for a\n" - "channel. When \002%s\002 is set, the topic for the\n" - "channel will be remembered by %s even after the\n" - "last user leaves the channel, and will be restored the\n" - "next time the channel is created."), source.command.c_str(), source.service->nick.c_str()); + source.Reply(_("Enables or disables the \002topic retention\002 option for a \037channel\037." + " When \002topic retention\002 is set, the topic for the channel will be remembered by {0} even after the last user leaves the channel, and will be restored the next time the channel is created."), + source.service->nick); return true; } }; @@ -86,7 +85,7 @@ class CommandCSTopic : public Command { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } @@ -96,14 +95,14 @@ class CommandCSTopic : public Command return; topiclock->Set(ci, true); - source.Reply(_("Topic lock option for %s is now \002on\002."), ci->name.c_str()); + source.Reply(_("Topic lock option for \002{0}\002 is now \002on\002."), ci->name); } void Unlock(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> ¶ms) { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } @@ -113,7 +112,7 @@ class CommandCSTopic : public Command return; topiclock->Unset(ci); - source.Reply(_("Topic lock option for %s is now \002off\002."), ci->name.c_str()); + source.Reply(_("Topic lock option for \002{0}\002 is now \002off\002."), ci->name); } void Set(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> ¶ms) @@ -163,19 +162,20 @@ class CommandCSTopic : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { + const Anope::string &channel = params[0]; const Anope::string &subcmd = params[1]; - ChanServ::Channel *ci = ChanServ::Find(params[0]); + ChanServ::Channel *ci = ChanServ::Find(channel); if (ci == NULL) - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), channel); else if (!source.AccessFor(ci).HasPriv("TOPIC") && !source.HasCommand("chanserv/topic")) - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "TOPIC", ci->name); else if (subcmd.equals_ci("LOCK")) this->Lock(source, ci, params); else if (subcmd.equals_ci("UNLOCK")) this->Unlock(source, ci, params); else if (!ci->c) - source.Reply(CHAN_X_NOT_IN_USE, ci->name.c_str()); + source.Reply(_("Channel \002{0}\002 doesn't exist."), ci->name); else if (subcmd.equals_ci("SET")) this->Set(source, ci, params); else if (subcmd.equals_ci("APPEND") && params.size() > 2) @@ -186,15 +186,15 @@ class CommandCSTopic : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Allows manipulating the topic of the specified channel.\n" - "The \002SET\002 command changes the topic of the channel to the given topic\n" - "or unsets the topic if no topic is given. The \002APPEND\002 command appends\n" - "the given topic to the existing topic.\n" - " \n" - "\002LOCK\002 and \002UNLOCK\002 may be used to enable and disable topic lock. When\n" - "topic lock is set, the channel topic will be unchangeable except via this command.")); + source.Reply(_("Allows manipulating the topic of the specified channel." + " The \002SET\002 command changes the topic of the channel to the given topic or unsets the topic if no topic is given." + " The \002APPEND\002 command appends the given topic to the existing topic.\n" + "\n" + "\002LOCK\002 and \002UNLOCK\002 may be used to enable and disable topic lock." + " When topic lock is set, the channel topic will be unchangeable except via this command.\n" + "\n" + "Use of this command requires the \002{0}\002 privilege on \037channel\037."), + "TOPIC"); return true; } }; diff --git a/modules/commands/cs_unban.cpp b/modules/commands/cs_unban.cpp index a658c65dd..cf06b82f9 100644 --- a/modules/commands/cs_unban.cpp +++ b/modules/commands/cs_unban.cpp @@ -48,22 +48,23 @@ class CommandCSUnban : public Command return; } - ChanServ::Channel *ci = ChanServ::Find(params[0]); + const Anope::string &chan = params[0]; + ChanServ::Channel *ci = ChanServ::Find(chan); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } if (ci->c == NULL) { - source.Reply(CHAN_X_NOT_IN_USE, ci->name.c_str()); + source.Reply(_("Channel \002{0}\002 doesn't exist."), ci->name); return; } if (!source.AccessFor(ci).HasPriv("UNBAN") && !source.HasPriv("chanserv/kick")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "UNBAN", ci->name); return; } @@ -73,7 +74,8 @@ class CommandCSUnban : public Command if (!u2) { - source.Reply(NICK_X_NOT_IN_USE, params[1].c_str()); + if (params.size() > 1) + source.Reply(_("User \002{0}\002 isn't currently online."), params[1]); return; } @@ -82,22 +84,18 @@ class CommandCSUnban : public Command ci->c->Unban(u2, source.GetUser() == u2); if (u2 == source.GetUser()) - source.Reply(_("You have been unbanned from \002%s\002."), ci->c->name.c_str()); + source.Reply(_("You have been unbanned from \002{0}\002."), ci->c->name); else - source.Reply(_("\002%s\002 has been unbanned from \002%s\002."), u2->nick.c_str(), ci->c->name.c_str()); + source.Reply(_("\002{0}\002 has been unbanned from \002{1}\002."), u2->nick, ci->c->name); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Tells %s to remove all bans preventing you or the given\n" - "user from entering the given channel. If no channel is\n" - "given, all bans affecting you in channels you have access\n" - "in are removed.\n" - " \n" - "By default, limited to AOPs or those with level 5 and above\n" - "on the channel."), source.service->nick.c_str()); + source.Reply(_("Tells {0} to remove all bans preventing you or the given \037user\037 from entering \037channel\037." + " If no channel is given, all bans affecting you in channels you have access in are removed.\n" + "\n" + "Use of this command requires the \002{1}\002 privilege on \037channel\037."), + source.service->nick, "UNBAN"); return true; } }; diff --git a/modules/commands/cs_updown.cpp b/modules/commands/cs_updown.cpp index bf94b9c2d..7468331aa 100644 --- a/modules/commands/cs_updown.cpp +++ b/modules/commands/cs_updown.cpp @@ -46,7 +46,7 @@ class CommandCSUp : public Command CommandCSUp(Module *creator) : Command(creator, "chanserv/up", 0, 2) { this->SetDesc(_("Updates a selected nicks status on a channel")); - this->SetSyntax(_("[\037channel\037 [\037nick\037]]")); + this->SetSyntax(_("[\037channel\037 [\037user\037]]")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -64,36 +64,46 @@ class CommandCSUp : public Command } else { - const Anope::string &channel = params[0]; + const Anope::string &chan = params[0]; const Anope::string &nick = params.size() > 1 ? params[1] : source.GetNick(); - Channel *c = Channel::Find(channel); - - if (c == NULL) + ChanServ::Channel *ci = ChanServ::Find(chan); + if (ci == NULL) { - source.Reply(CHAN_X_NOT_IN_USE, channel.c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } - else if (!c->ci) + + if (ci->c == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, channel.c_str()); + source.Reply(_("Channel \002{0}\002 doesn't exist."), ci->name); return; } User *u = User::Find(nick, true); + Channel *c = ci->c; + User *srcu = source.GetUser(); bool override = false; if (u == NULL) { - source.Reply(NICK_X_NOT_IN_USE, nick.c_str()); + source.Reply(_("User \002{0}\002 isn't currently online."), nick); return; } - else if (!u->FindChannel(c)) + + if (srcu && !srcu->FindChannel(c)) + { + source.Reply(_("You must be on channel \002{0}\002 to use this command."), c->name); + return; + } + + if (!u->FindChannel(c)) { - source.Reply(NICK_X_NOT_ON_CHAN, nick.c_str(), channel.c_str()); + source.Reply(_("\002{0}\002 is not on channel \002{1}\002."), u->nick, c->name); return; } - else if (source.GetUser() && u != source.GetUser() && c->ci->HasExt("PEACE")) + + if (source.GetUser() && u != source.GetUser() && c->ci->HasExt("PEACE")) { if (c->ci->AccessFor(u) > c->ci->AccessFor(source.GetUser())) { @@ -101,7 +111,7 @@ class CommandCSUp : public Command override = true; else { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. \002{0}\002 has more privileges than you on \002{1}\002."), u->nick, ci->name); return; } } @@ -115,11 +125,9 @@ class CommandCSUp : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Updates a selected nicks status modes on a channel. If \037nick\037 is\n" - "ommited then your status is updated. If \037channel\037 is ommited then\n" - "your channel status is updated on every channel you are in.")); + source.Reply(_("Updates the status modes of \037user\037 on \037channel\037." + " If \037user\037 is omitted then your status is updated." + " If \037channel\037 is omitted then your status is updated on every channel you are in.")); return true; } }; @@ -159,33 +167,43 @@ class CommandCSDown : public Command const Anope::string &channel = params[0]; const Anope::string &nick = params.size() > 1 ? params[1] : source.GetNick(); - Channel *c = Channel::Find(channel); - - if (c == NULL) + ChanServ::Channel *ci = ChanServ::Find(channel); + if (ci == NULL) { - source.Reply(CHAN_X_NOT_IN_USE, channel.c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), channel); return; } - else if (!c->ci) + + if (ci->c == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, channel.c_str()); + source.Reply(_("Channel \002{0}\002 doesn't exist."), ci->name); return; } User *u = User::Find(nick, true); + Channel *c = ci->c; + User *srcu = source.GetUser(); bool override = false; if (u == NULL) { - source.Reply(NICK_X_NOT_IN_USE, nick.c_str()); + source.Reply(_("User \002{0}\002 isn't currently online."), nick); return; } - else if (!u->FindChannel(c)) + + if (srcu && !srcu->FindChannel(c)) { - source.Reply(NICK_X_NOT_ON_CHAN, nick.c_str(), channel.c_str()); + source.Reply(_("You must be on channel \002{0}\002 to use this command."), c->name); return; } - else if (source.GetUser() && u != source.GetUser() && c->ci->HasExt("PEACE")) + + if (!u->FindChannel(c)) + { + source.Reply(_("\002%s\002 is not on channel %s."), u->nick, c->name); + return; + } + + if (source.GetUser() && u != source.GetUser() && c->ci->HasExt("PEACE")) { if (c->ci->AccessFor(u) > c->ci->AccessFor(source.GetUser())) { @@ -193,7 +211,7 @@ class CommandCSDown : public Command override = true; else { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. \002{0}\002 has more privileges than you on \002{1}\002."), u->nick, ci->name); return; } } @@ -206,11 +224,9 @@ class CommandCSDown : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Removes a selected nicks status modes on a channel. If \037nick\037 is\n" - "ommited then your status is removed. If \037channel\037 is ommited then\n" - "your channel status is removed on every channel you are in.")); + source.Reply(_("Removes a selected nicks status modes on a channel." + " If \037nick\037 is ommited then your status is removed." + " If \037channel\037 is ommited then channel status is removed on every channel you are in.")); return true; } }; diff --git a/modules/commands/cs_xop.cpp b/modules/commands/cs_xop.cpp index b2c554d71..53730cb57 100644 --- a/modules/commands/cs_xop.cpp +++ b/modules/commands/cs_xop.cpp @@ -130,7 +130,7 @@ class CommandCSXOP : public Command override = true; else { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have the \002{0}\002 privilege on \002{1}\002."), "ACCESS_CHANGE", ci->name); return; } } @@ -146,7 +146,7 @@ class CommandCSXOP : public Command ChanServ::Channel *targ_ci = ChanServ::Find(mask); if (targ_ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, mask.c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), mask); return; } else if (ci == targ_ci) @@ -172,7 +172,7 @@ class CommandCSXOP : public Command mask = "*!*@" + targ->GetDisplayedHost(); else { - source.Reply(NICK_X_NOT_REGISTERED, mask.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), mask); return; } } @@ -186,7 +186,7 @@ class CommandCSXOP : public Command { if ((!highest || *a >= *highest) && !access.founder && !source.HasPriv("chanserv/access/modify")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have enough privileges on \002{0}\002 to lower the access of \002{1}\002."), ci->name, a->mask); return; } @@ -258,7 +258,7 @@ class CommandCSXOP : public Command mask = "*!*@" + targ->GetDisplayedHost(); else { - source.Reply(NICK_X_NOT_REGISTERED, mask.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), mask); return; } } @@ -272,7 +272,7 @@ class CommandCSXOP : public Command override = true; else { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have the \002{0}\002 privilege on \002{1}\002."), "ACCESS_CHANGE", ci->name); return; } } @@ -368,7 +368,7 @@ class CommandCSXOP : public Command if (!access.HasPriv("ACCESS_LIST") && !source.HasCommand("chanserv/access/list")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have the \002{0}\002 privilege on \002{1}\002."), "ACCESS_LIST", ci->name); return; } @@ -458,7 +458,7 @@ class CommandCSXOP : public Command if (!source.AccessFor(ci).HasPriv("FOUNDER") && !source.HasPriv("chanserv/access/modify")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have the \002{0}\002 privilege on \002{1}\002."), "FOUNDER", ci->name); return; } @@ -499,7 +499,7 @@ class CommandCSXOP : public Command ChanServ::Channel *ci = ChanServ::Find(params[0]); if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), params[0]); return; } @@ -520,69 +520,93 @@ class CommandCSXOP : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - const Anope::string &cmd = source.command.upper(); + if (subcommand.equals_ci("ADD")) + { + source.Reply(_("The \002{0} ADD\002 command adds \037mask\037 to the {0} list of \037channel\037." + " If you have the privilege to use this command, you may use it if you have more privileges than it grants."), + source.command); + + source.Reply(_("Use of this command requires the \002{0}\002 privilege on \037channel\037.\n" + "Example:\n" + " {1} #anope ADD Adam" + " Adds \"Adam\" to the access list of \"#anope\" with the privilege set {1}"), + "ACCESS_CHANGE", source.command); + } + else if (subcommand.equals_ci("DEL")) + source.Reply(_("The \002{0} DEL\002 command removes the given \037mask\037 from the {0} list of \037channel\037." + " If a list of entry numbers is given, those entries are deleted.\n" + "\n" + "Use of this command requires the \002{1}\002 privilege on \037channel\037.\n" + "Example:\n" + " {0} #anope DEL Cronus" + " Removes \"Cronus\" from the {0} list of \"#anope\""), + source.command, "ACCESS_CHANGE"); + else if (subcommand.equals_ci("LIST")) + source.Reply(_("The \002{0} LIST\002 command displays the {0} list of \037channel\037." + " If a wildcard mask is given, only those entries matching the mask are displayed." + " If a list of entry numbers is given, only those entries are shown.\n" + "\n" + "Use of this command requires the \002{1}\002 privilege on \037channel\037.\n" + "\n" + "Example:" + " {0} #anope LIST 2-5,7-9\n" + " List entries numbered 2 through 5 and 7 through 9 on the {0} of \"#anope\""), + source.command, "ACCESS_LIST"); + else if (subcommand.equals_ci("CLEAR")) + source.Reply(_("The \002{0} CLEAR\002 command clears the {0} list of \037channel\037." + "\n" + "Use of this command requires the \002{1}\002 privilege on \037channel\037."), + source.command, "FOUNDER"); - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Maintains the \002%s list\002 for a channel. Users who match an access entry\n" - "on the %s list receive the following privileges:\n" - " "), cmd.c_str(), cmd.c_str()); - - Anope::string buf; - for (unsigned i = 0; i < permissions[cmd].size(); ++i) + else { - buf += ", " + permissions[cmd][i]; - if (buf.length() > 75) + source.Reply(_("Maintains the \002{0} list\002 for a channel." + " Users who match an access entry on the {0} list receive the following privileges:\n" + "\n"), + source.command); + + Anope::string buf; + for (unsigned i = 0; i < permissions[source.command].size(); ++i) + buf += "," + permissions[source.command][i]; + + source.Reply(buf); + + CommandInfo *help = source.service->FindCommand("generic/help"); + if (help) { - source.Reply(" %s\n", buf.substr(2).c_str()); - buf.clear(); + source.Reply(_("\n" + "The \002ADD\002 command adds \037mask\037 to the {0} list.\n" + "Use of this command requires the \002{change}\002 privilege on \037channel\037.\n" + "\002{msg}{service} {help} {command} ADD\002 for more information.\n" + "\n" + "The \002DEL\002 command removes \037mask\037 from the {0} list.\n" + "Use of this command requires the \002{change}\002 privilege on \037channel\037.\n" + "\002{msg}{service} {help} {command} DEL\002 for more information.\n" + "\n" + "The \002LIST\002 command shows the {0} list for \037channel\037.\n" + "Use of this commands requires the \002{list}\002 privilege on \037channel\037.\n" + "\002{msg}{service} {help} {command} LIST\002 for more information.\n" + "\n" + "The \002CLEAR\002 command clears the {0} list." + "Use of this command requires the \002{founder}\002 privilege on \037channel\037.\n" + "\002{msg}{service} {help} {command} CLEAR\002 for more information.)"), + source.command, "change"_kw = "ACCESS_CHANGE", "list"_kw = "ACCESS_LIST", "help"_kw = help->cname); + + Anope::string access_cmd, flags_cmd; + BotInfo *access_bi, *flags_bi; + Command::FindCommandFromService("chanserv/access", access_bi, access_cmd); + Command::FindCommandFromService("chanserv/flags", flags_bi, access_cmd); + if (!access_cmd.empty() || !flags_cmd.empty()) + { + source.Reply(_("\n" + "Alternative methods of modifying channel access lists are available:\n")); + if (!access_cmd.empty()) + source.Reply(_("See \002{0}{1} {2} {3}\002 for more information about the access list."), Config->StrictPrivmsg, access_bi->nick, help->cname, access_cmd); + if (!flags_cmd.empty()) + source.Reply(_("See \002{0}{1} {2} {3}\002 for more information about the flags system."), Config->StrictPrivmsg, flags_bi->nick, help->cname, flags_cmd); + } } } - if (!buf.empty()) - { - source.Reply(" %s\n", buf.substr(2).c_str()); - buf.clear(); - } - - source.Reply(_(" \n" - "The \002%s ADD\002 command adds the given nickname to the\n" - "%s list.\n" - " \n" - "The \002%s DEL\002 command removes the given nick from the\n" - "%s list. If a list of entry numbers is given, those\n" - "entries are deleted. (See the example for LIST below.)\n" - " \n" - "The \002%s LIST\002 command displays the %s list. If\n" - "a wildcard mask is given, only those entries matching the\n" - "mask are displayed. If a list of entry numbers is given,\n" - "only those entries are shown; for example:\n" - " \002%s #channel LIST 2-5,7-9\002\n" - " Lists %s entries numbered 2 through 5 and\n" - " 7 through 9.\n" - " \n" - "The \002%s CLEAR\002 command clears all entries of the\n" - "%s list."), cmd.c_str(), cmd.c_str(), cmd.c_str(), cmd.c_str(), - cmd.c_str(), cmd.c_str(), cmd.c_str(), cmd.c_str(), cmd.c_str(), cmd.c_str()); - source.Reply(_(" \n" - "The \002%s\002 commands are limited to founders\n" - "(unless SECUREOPS is off). However, any user on the\n" - "VOP list or above may use the \002%s LIST\002 command.\n" - " \n"), cmd.c_str(), cmd.c_str()); - BotInfo *access_bi, *flags_bi; - Anope::string access_cmd, flags_cmd; - Command::FindCommandFromService("chanserv/access", access_bi, access_cmd); - Command::FindCommandFromService("chanserv/flags", flags_bi, access_cmd); - if (!access_cmd.empty() || !flags_cmd.empty()) - { - source.Reply(_("Alternative methods of modifying channel access lists are\n" - "available. ")); - if (!access_cmd.empty()) - source.Reply(_("See \002%s%s HELP %s\002 for more information\n" - "about the access list."), Config->StrictPrivmsg.c_str(), access_bi->nick.c_str(), access_cmd.c_str()); - if (!flags_cmd.empty()) - source.Reply(_("See \002%s%s HELP %s\002 for more information\n" - "about the flags system."), Config->StrictPrivmsg.c_str(), flags_bi->nick.c_str(), flags_cmd.c_str()); - } return true; } }; diff --git a/modules/commands/gl_global.cpp b/modules/commands/gl_global.cpp index 5d2d6b61b..d6106b2be 100644 --- a/modules/commands/gl_global.cpp +++ b/modules/commands/gl_global.cpp @@ -37,10 +37,8 @@ class CommandGLGlobal : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Allows Administrators to send messages to all users on the\n" - "network. The message will be sent from the nick \002%s\002."), source.service->nick.c_str()); + source.Reply(_("Allows Services Operators to send a message to all users on the network." + " The message will be sent from \002{0}\002."), source.service->nick); return true; } }; diff --git a/modules/commands/greet.cpp b/modules/commands/greet.cpp index e35ba5b19..dfb486486 100644 --- a/modules/commands/greet.cpp +++ b/modules/commands/greet.cpp @@ -25,24 +25,25 @@ class CommandBSSetGreet : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { - ChanServ::Channel *ci = ChanServ::Find(params[0]); + const Anope::string &chan = params[0]; const Anope::string &value = params[1]; - if (ci == NULL) + if (Anope::ReadOnly) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Services are in read-only mode.")); return; } - if (!source.HasPriv("botserv/administration") && !source.AccessFor(ci).HasPriv("SET")) + ChanServ::Channel *ci = ChanServ::Find(chan); + if (ci == NULL) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } - if (Anope::ReadOnly) + if (!source.HasPriv("botserv/administration") && !source.AccessFor(ci).HasPriv("SET")) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->name); return; } @@ -52,7 +53,7 @@ class CommandBSSetGreet : public Command Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable greets"; ci->Extend<bool>("BS_GREET"); - source.Reply(_("Greet mode is now \002on\002 on channel %s."), ci->name.c_str()); + source.Reply(_("Greet mode for \002{0}\002 is now \002on\002."), ci->name); } else if (value.equals_ci("OFF")) { @@ -60,7 +61,7 @@ class CommandBSSetGreet : public Command Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable greets"; ci->Shrink<bool>("BS_GREET"); - source.Reply(_("Greet mode is now \002off\002 on channel %s."), ci->name.c_str()); + source.Reply(_("Greet mode for \002{0}\002 is now \002off\002."), ci->name); } else this->OnSyntaxError(source, source.command); @@ -68,13 +69,10 @@ class CommandBSSetGreet : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(_(" \n" - "Enables or disables \002greet\002 mode on a channel.\n" - "When it is enabled, the bot will display greet\n" - "messages of users joining the channel, provided\n" - "they have enough access to the channel.")); - return true; + source.Reply(_("Enables or disables \002greet\002 mode on \037channel\037." + " When \002greet\002 mode is enabled, the assigned service bot will display the greet messages of users joining the channel, if they have the \002{0}\002 privilege."), + "GREET"); + return true; } }; @@ -91,14 +89,14 @@ class CommandNSSetGreet : public Command { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } const NickServ::Nick *na = NickServ::FindNick(user); if (!na) { - source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), user); return; } NickServ::Account *nc = na->nc; @@ -111,13 +109,13 @@ class CommandNSSetGreet : public Command { Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the greet of " << nc->display; nc->Extend<Anope::string>("greet", param); - source.Reply(_("Greet message for \002%s\002 changed to \002%s\002."), nc->display.c_str(), param.c_str()); + source.Reply(_("Greet message for \002{0}\002 changed to \002{1}\002."), nc->display, param); } else { Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to unset the greet of " << nc->display; nc->Shrink<Anope::string>("greet"); - source.Reply(_("Greet message for \002%s\002 unset."), nc->display.c_str()); + source.Reply(_("Greet message for \002{0}\002 unset."), nc->display); } } @@ -128,12 +126,8 @@ class CommandNSSetGreet : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Makes the given message the greet of your nickname, that\n" - "will be displayed when joining a channel that has GREET\n" - "option enabled, provided that you have the necessary\n" - "access on it.")); + source.Reply(_("Sets your greet to \037message\037. Your greet is displayed when you enter channels that have the greet option enabled if you have the \002{0}\002 privilege on the channel."), + "GREET"); return true; } }; @@ -144,7 +138,7 @@ class CommandNSSASetGreet : public CommandNSSetGreet CommandNSSASetGreet(Module *creator) : CommandNSSetGreet(creator, "nickserv/saset/greet", 1) { this->ClearSyntax(); - this->SetSyntax(_("\037nickname\037 \037message\037")); + this->SetSyntax(_("\037user\037 \037message\037")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -154,12 +148,8 @@ class CommandNSSASetGreet : public CommandNSSetGreet bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Makes the given message the greet of the nickname, that\n" - "will be displayed when joining a channel that has GREET\n" - "option enabled, provided that the user has the necessary\n" - "access on it.")); + source.Reply(_("Sets the greet for \037user\037 to \037message\037. Greet messages are displayed when users enter channels that have the greet option enabiled if they have the \002{0}\002 privilege on the channel."), + "GREET"); return true; } }; diff --git a/modules/commands/help.cpp b/modules/commands/help.cpp index ba743f661..4d8ee27bb 100644 --- a/modules/commands/help.cpp +++ b/modules/commands/help.cpp @@ -56,7 +56,7 @@ class CommandHelp : public Command GroupInfo groups; if (all) - source.Reply(_("All available commands for \002%s\002:"), source.service->nick.c_str()); + source.Reply(_("All available commands for \002{0}\002:"), source.service->nick); for (CommandInfo::map::const_iterator it = map.begin(), it_end = map.end(); it != it_end; ++it) { @@ -102,7 +102,7 @@ class CommandHelp : public Command CommandGroup *gr = it->first; source.Reply(" "); - source.Reply("%s", gr->description.c_str()); + source.Reply("{0}", gr->description); Anope::string buf; for (std::list<Anope::string>::iterator it2 = it->second.begin(), it2_end = it->second.end(); it2 != it2_end; ++it2) @@ -113,20 +113,20 @@ class CommandHelp : public Command if (buf.length() > help_wrap_len) { - source.Reply(" %s", buf.substr(2).c_str()); + source.Reply(" {0}", buf.substr(2)); buf.clear(); } } if (buf.length() > 2) { - source.Reply(" %s", buf.substr(2).c_str()); + source.Reply(" {0}", buf.substr(2)); buf.clear(); } } if (!groups.empty()) { source.Reply(" "); - source.Reply(_("Use the \002%s ALL\002 command to list all commands and their descriptions."), source_command.c_str()); + source.Reply(_("Use the \002{0} ALL\002 command to list all commands and their descriptions."), source_command); } } else @@ -155,7 +155,7 @@ class CommandHelp : public Command // Allow unregistered users to see help for commands that they explicitly request help for const Anope::string &subcommand = params.size() > max ? params[max] : ""; - source.command = full_command; + source.command = it->first; if (!c->OnHelp(source, subcommand)) continue; @@ -165,7 +165,7 @@ class CommandHelp : public Command if (!info.permission.empty()) { source.Reply(" "); - source.Reply(_("Access to this command requires the permission \002%s\002 to be present in your opertype."), info.permission.c_str()); + source.Reply(_("Access to this command requires the permission \002{0}\002 to be present in your opertype."), info.permission); } if (!c->AllowUnregistered() && !source.nc) { @@ -183,7 +183,7 @@ class CommandHelp : public Command } if (helped == false) - source.Reply(_("No help available for \002%s\002."), params[0].c_str()); + source.Reply(_("No help available for \002{0}\002."), params[0]); } this->onhelp(&Event::Help::OnPostHelp, source, params); diff --git a/modules/commands/hs_del.cpp b/modules/commands/hs_del.cpp index d527c772b..02727185e 100644 --- a/modules/commands/hs_del.cpp +++ b/modules/commands/hs_del.cpp @@ -20,16 +20,13 @@ class CommandHSDel : public Command CommandHSDel(Module *creator, EventHandlers<Event::DeleteVhost> &onDeleteVhost) : Command(creator, "hostserv/del", 1, 1), OnDeleteVhost(onDeleteVhost) { this->SetDesc(_("Delete the vhost of another user")); - this->SetSyntax(_("\037nick\037")); + this->SetSyntax(_("\037user\037")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) - { - source.Reply(READ_ONLY_MODE); - return; - } + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); const Anope::string &nick = params[0]; NickServ::Nick *na = NickServ::FindNick(nick); @@ -38,18 +35,15 @@ class CommandHSDel : public Command Log(LOG_ADMIN, source, this) << "for user " << na->nick; this->OnDeleteVhost(&Event::DeleteVhost::OnDeleteVhost, na); na->RemoveVhost(); - source.Reply(_("Vhost for \002%s\002 removed."), nick.c_str()); + source.Reply(_("Vhost for \002{0}\002 has been removed."), na->nick); } else - source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), nick); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Deletes the vhost assigned to the given nick from the\n" - "database.")); + source.Reply(_("Removes the vhost of \037user\037.")); return true; } }; @@ -62,16 +56,13 @@ class CommandHSDelAll : public Command CommandHSDelAll(Module *creator, EventHandlers<Event::DeleteVhost> &event) : Command(creator, "hostserv/delall", 1, 1), ondeletevhost(event) { this->SetDesc(_("Delete the vhost for all nicks in a group")); - this->SetSyntax(_("\037nick\037")); + this->SetSyntax(_("\037group\037")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) - { - source.Reply(READ_ONLY_MODE); - return; - } + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); const Anope::string &nick = params[0]; NickServ::Nick *na = NickServ::FindNick(nick); @@ -85,18 +76,15 @@ class CommandHSDelAll : public Command na->RemoveVhost(); } Log(LOG_ADMIN, source, this) << "for all nicks in group " << nc->display; - source.Reply(_("vhosts for group \002%s\002 have been removed."), nc->display.c_str()); + source.Reply(_("Vhosts for group \002{0}\002 have been removed."), nc->display); } else - source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), nick); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Deletes the vhost for all nicks in the same group as\n" - "that of the given nick.")); + source.Reply(_("Removes the vhost of all nicks in the group \037group\037.")); return true; } }; diff --git a/modules/commands/hs_group.cpp b/modules/commands/hs_group.cpp index 47e4c03de..8b84d0f65 100644 --- a/modules/commands/hs_group.cpp +++ b/modules/commands/hs_group.cpp @@ -47,7 +47,7 @@ class CommandHSGroup : public Command { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } @@ -56,23 +56,17 @@ class CommandHSGroup : public Command { this->Sync(na); if (!na->GetVhostIdent().empty()) - source.Reply(_("All vhost's in the group \002%s\002 have been set to \002%s\002@\002%s\002."), source.nc->display.c_str(), na->GetVhostIdent().c_str(), na->GetVhostHost().c_str()); + source.Reply(_("All vhosts in the group \002{0}\002 have been set to \002{1}\002@\002{2}\002."), source.nc->display, na->GetVhostIdent(), na->GetVhostHost()); else - source.Reply(_("All vhost's in the group \002%s\002 have been set to \002%s\002."), source.nc->display.c_str(), na->GetVhostHost().c_str()); + source.Reply(_("All vhosts in the group \002{0}\002 have been set to \002{1}\002."), source.nc->display, na->GetVhostHost()); } else - source.Reply(HOST_NOT_ASSIGNED); - - return; + source.Reply(_("There is no vhost assigned to this nickname.")); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("This command allows users to set the vhost of their\n" - "CURRENT nick to be the vhost for all nicks in the same\n" - "group.")); + source.Reply(_("Sets the vhost of all nicks in your group to the vhost of your current nick.")); return true; } }; diff --git a/modules/commands/hs_list.cpp b/modules/commands/hs_list.cpp index f662ebbf1..778f2cefb 100644 --- a/modules/commands/hs_list.cpp +++ b/modules/commands/hs_list.cpp @@ -34,14 +34,14 @@ class CommandHSList : public Command size_t tmp = key.find('-'); if (tmp == Anope::string::npos || tmp == key.length() || tmp == 1) { - source.Reply(LIST_INCORRECT_RANGE); + source.Reply(_("Incorrect range specified. The correct syntax is \002#\037from\037-\037to\037\002.")); return; } for (unsigned i = 1, end = key.length(); i < end; ++i) { if (!isdigit(key[i]) && i != tmp) { - source.Reply(LIST_INCORRECT_RANGE); + source.Reply(_("Incorrect range specified. The correct syntax is \002#\037from\037-\037to\037\002.")); return; } try @@ -113,13 +113,13 @@ class CommandHSList : public Command } if (!key.empty()) - source.Reply(_("Displayed records matching key \002%s\002 (count: \002%d\002)."), key.c_str(), display_counter); + source.Reply(_("Displayed records matching key \002{0}\002 (count: \002{1}\002)."), key, display_counter); else { if (from) - source.Reply(_("Displayed records from \002%d\002 to \002%d\002."), from, to); + source.Reply(_("Displayed records from \002{0}\002 to \002{1}\002."), from, to); else - source.Reply(_("Displayed all records (count: \002%d\002)."), display_counter); + source.Reply(_("Displayed all records (count: \002{0}\002)."), display_counter); } std::vector<Anope::string> replies; @@ -131,15 +131,16 @@ class CommandHSList : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("This command lists registered vhosts to the operator\n" - "if a \037key\037 is specified, only entries whos nick or vhost match\n" - "the pattern given in \037key\037 are displayed e.g. Rob* for all\n" - "entries beginning with \"Rob\"\n" - "If a \037#X-Y\037 style is used, only entries between the range of \002X\002\n" - "and \002Y\002 will be displayed, e.g. \002#1-3\002 will display the first 3\n" - "nick/vhost entries.")); + source.Reply(_("Lists all vhosts. If \037key\037 is specified, only entries whose nick or vhost match the pattern given in \037key\037 are displayed." + "If a \037#X-Y\037 style is used, only entries between the range of \002X\002 and \002Y\002 will be displayed.\n" + "\n" + "Examples:\n" + " {0} Rob*\n" + " Lists all entries with the nick or vhost beginning with \"Rob\"\n" + "\n" + " {0} #1-3\n" + " Lists the first three entries."), + source.command); return true; } }; diff --git a/modules/commands/hs_off.cpp b/modules/commands/hs_off.cpp index 4923d390d..2d8c23b80 100644 --- a/modules/commands/hs_off.cpp +++ b/modules/commands/hs_off.cpp @@ -26,24 +26,18 @@ class CommandHSOff : public Command const NickServ::Nick *na = NickServ::FindNick(u->nick); if (!na || !na->HasVhost()) - source.Reply(HOST_NOT_ASSIGNED); + source.Reply(_("There is no vhost assigned to this nickname.")); else { IRCD->SendVhostDel(u); Log(LOG_COMMAND, source, this) << "to disable their vhost"; source.Reply(_("Your vhost was removed and the normal cloaking restored.")); } - - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Deactivates the vhost currently assigned to the nick in use.\n" - "When you use this command any user who performs a /whois\n" - "on you will see your real host/IP address.")); + source.Reply(_("Deactivates your vhost.")); return true; } }; diff --git a/modules/commands/hs_on.cpp b/modules/commands/hs_on.cpp index 7331dd355..c9e686131 100644 --- a/modules/commands/hs_on.cpp +++ b/modules/commands/hs_on.cpp @@ -30,9 +30,9 @@ class CommandHSOn : public Command if (na && u->Account() == na->nc && na->HasVhost()) { if (!na->GetVhostIdent().empty()) - source.Reply(_("Your vhost of \002%s\002@\002%s\002 is now activated."), na->GetVhostIdent().c_str(), na->GetVhostHost().c_str()); + source.Reply(_("Your vhost of \002{0}\002@\002{1}\002 is now activated."), na->GetVhostIdent(), na->GetVhostHost()); else - source.Reply(_("Your vhost of \002%s\002 is now activated."), na->GetVhostHost().c_str()); + source.Reply(_("Your vhost of \002{0}\002 is now activated."), na->GetVhostHost()); Log(LOG_COMMAND, source, this) << "to enable their vhost of " << (!na->GetVhostIdent().empty() ? na->GetVhostIdent() + "@" : "") << na->GetVhostHost(); IRCD->SendVhost(u, na->GetVhostIdent(), na->GetVhostHost()); u->vhost = na->GetVhostHost(); @@ -41,18 +41,12 @@ class CommandHSOn : public Command u->UpdateHost(); } else - source.Reply(HOST_NOT_ASSIGNED); - - return; + source.Reply(_("There is no vhost assigned to this nickname.")); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Activates the vhost currently assigned to the nick in use.\n" - "When you use this command any user who performs a /whois\n" - "on you will see the vhost instead of your real host/IP address.")); + source.Reply(_("Activates your vhost.")); return true; } }; diff --git a/modules/commands/hs_request.cpp b/modules/commands/hs_request.cpp index 119cc5a6d..1d9207e05 100644 --- a/modules/commands/hs_request.cpp +++ b/modules/commands/hs_request.cpp @@ -65,13 +65,6 @@ struct HostRequest : Serializable class CommandHSRequest : public Command { - bool isvalidchar(char c) - { - if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '.' || c == '-') - return true; - return false; - } - public: CommandHSRequest(Module *creator) : Command(creator, "hostserv/request", 1, 1) { @@ -83,7 +76,7 @@ class CommandHSRequest : public Command { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } @@ -91,7 +84,7 @@ class CommandHSRequest : public Command NickServ::Nick *na = NickServ::FindNick(source.GetNick()); if (!na || na->nc != source.GetAccount()) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied.")); //XXX with nonickownership this should be allowed. return; } @@ -118,31 +111,32 @@ class CommandHSRequest : public Command { if (user.length() > Config->GetBlock("networkinfo")->Get<unsigned>("userlen")) { - source.Reply(HOST_SET_IDENTTOOLONG, Config->GetBlock("networkinfo")->Get<unsigned>("userlen")); + source.Reply(_("The username \002{0}\002 is too long, please use a username shorter than %d characters."), Config->GetBlock("networkinfo")->Get<unsigned>("userlen")); + return; + } + + if (!IRCD->CanSetVIdent) + { + source.Reply(_("Vhosts may not contain a username.")); return; } - else if (!IRCD->CanSetVIdent) + + if (!IRCD->IsIdentValid(user)) { - source.Reply(HOST_NO_VIDENT); + source.Reply(_("The requested username is not valid.")); return; } - for (Anope::string::iterator s = user.begin(), s_end = user.end(); s != s_end; ++s) - if (!isvalidchar(*s)) - { - source.Reply(HOST_SET_IDENT_ERROR); - return; - } } if (host.length() > Config->GetBlock("networkinfo")->Get<unsigned>("hostlen")) { - source.Reply(HOST_SET_TOOLONG, Config->GetBlock("networkinfo")->Get<unsigned>("hostlen")); + source.Reply(_("The requested vhost is too long, please use a hostname no longer than {0} characters."), Config->GetBlock("networkinfo")->Get<unsigned>("hostlen")); return; } if (!IRCD->IsHostValid(host)) { - source.Reply(HOST_SET_ERROR); + source.Reply(_("The requested hostname is not valid.")); return; } @@ -161,18 +155,14 @@ class CommandHSRequest : public Command req.time = Anope::CurTime; na->Extend<HostRequest>("hostrequest", req); - source.Reply(_("Your vHost has been requested.")); + source.Reply(_("Your vhost has been requested.")); req_send_memos(owner, source, user, host); Log(LOG_COMMAND, source, this) << "to request new vhost " << (!user.empty() ? user + "@" : "") << host; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Request the given vHost to be actived for your nick by the\n" - "network administrators. Please be patient while your request\n" - "is being considered.")); + source.Reply(_("Request the given \036vhost\037 to be actived for your nick by the network administrators. Please be patient while your request is being considered.")); return true; } }; @@ -183,14 +173,14 @@ class CommandHSActivate : public Command CommandHSActivate(Module *creator) : Command(creator, "hostserv/activate", 1, 1) { this->SetDesc(_("Approve the requested vHost of a user")); - this->SetSyntax(_("\037nick\037")); + this->SetSyntax(_("\037user\037")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } @@ -206,19 +196,17 @@ class CommandHSActivate : public Command if (Config->GetModule(this->owner)->Get<bool>("memouser") && MemoServ::service) MemoServ::service->Send(source.service->nick, na->nick, _("[auto memo] Your requested vHost has been approved."), true); - source.Reply(_("vHost for %s has been activated."), na->nick.c_str()); + source.Reply(_("Vhost for \002{0}\002 has been activated."), na->nick); Log(LOG_COMMAND, source, this) << "for " << na->nick << " for vhost " << (!req->ident.empty() ? req->ident + "@" : "") << req->host; na->Shrink<HostRequest>("hostrequest"); } else - source.Reply(_("No request for nick %s found."), nick.c_str()); + source.Reply(_("\002{0}\002 does not have a pending vhost request."), nick); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Activate the requested vHost for the given nick.")); + source.Reply(_("Activate the requested vhost for the given user.")); if (Config->GetModule(this->owner)->Get<bool>("memouser")) source.Reply(_("A memo informing the user will also be sent.")); @@ -232,14 +220,14 @@ class CommandHSReject : public Command CommandHSReject(Module *creator) : Command(creator, "hostserv/reject", 1, 2) { this->SetDesc(_("Reject the requested vHost of a user")); - this->SetSyntax(_("\037nick\037 [\037reason\037]")); + this->SetSyntax(_("\037user\037 [\037reason\037]")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } @@ -263,18 +251,16 @@ class CommandHSReject : public Command MemoServ::service->Send(source.service->nick, nick, Language::Translate(source.GetAccount(), message.c_str()), true); } - source.Reply(_("vHost for %s has been rejected."), nick.c_str()); + source.Reply(_("Vhost for \002{0}\002 has been rejected."), na->nick); Log(LOG_COMMAND, source, this) << "to reject vhost for " << nick << " (" << (!reason.empty() ? reason : "no reason") << ")"; } else - source.Reply(_("No request for nick %s found."), nick.c_str()); + source.Reply(_("\002{0}\002 does not have a pending vhost request."), nick); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Reject the requested vHost for the given nick.")); + source.Reply(_("Reject the requested vhost for the given user.")); if (Config->GetModule(this->owner)->Get<bool>("memouser")) source.Reply(_("A memo informing the user will also be sent, which includes the reason for the rejection if supplied.")); @@ -328,14 +314,12 @@ class CommandHSWaiting : public Command for (unsigned i = 0; i < replies.size(); ++i) source.Reply(replies[i]); - source.Reply(_("Displayed \002%d\002 records (\002%d\002 total)."), display_counter, counter); + source.Reply(_("Displayed \002{0}\002 records (\002{1}\002 total)."), display_counter, counter); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("This command retrieves the vhost requests.")); + source.Reply(_("Lists the vhost requests.")); return true; } diff --git a/modules/commands/hs_set.cpp b/modules/commands/hs_set.cpp index 614bfc2e9..93040fc91 100644 --- a/modules/commands/hs_set.cpp +++ b/modules/commands/hs_set.cpp @@ -17,14 +17,14 @@ class CommandHSSet : public Command CommandHSSet(Module *creator) : Command(creator, "hostserv/set", 2, 2) { this->SetDesc(_("Set the vhost of another user")); - this->SetSyntax(_("\037nick\037 \037hostmask\037")); + this->SetSyntax(_("\037user\037 \037hostmask\037")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } @@ -33,7 +33,7 @@ class CommandHSSet : public Command NickServ::Nick *na = NickServ::FindNick(nick); if (na == NULL) { - source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), nick); return; } @@ -60,25 +60,26 @@ class CommandHSSet : public Command { if (!IRCD->CanSetVIdent) { - source.Reply(HOST_NO_VIDENT); + source.Reply(_("Vhosts may not contain a username.")); return; } - else if (!IRCD->IsIdentValid(user)) + + if (!IRCD->IsIdentValid(user)) { - source.Reply(HOST_SET_IDENT_ERROR); + source.Reply(_("The requested username is not valid.")); return; } } if (host.length() > Config->GetBlock("networkinfo")->Get<unsigned>("hostlen")) { - source.Reply(HOST_SET_TOOLONG, Config->GetBlock("networkinfo")->Get<unsigned>("hostlen")); + source.Reply(_("The requested vhost is too long, please use a hostname no longer than {0} characters."), Config->GetBlock("networkinfo")->Get<unsigned>("hostlen")); return; } if (!IRCD->IsHostValid(host)) { - source.Reply(HOST_SET_ERROR); + source.Reply(_("The requested hostname is not valid.")); return; } @@ -87,19 +88,14 @@ class CommandHSSet : public Command na->SetVhost(user, host, source.GetNick()); Event::OnSetVhost(&Event::SetVhost::OnSetVhost, na); if (!user.empty()) - source.Reply(_("VHost for \002%s\002 set to \002%s\002@\002%s\002."), nick.c_str(), user.c_str(), host.c_str()); + source.Reply(_("Vhost for \002{0}\002 set to \002{0}\002@\002{1}\002."), nick, user, host); else - source.Reply(_("VHost for \002%s\002 set to \002%s\002."), nick.c_str(), host.c_str()); + source.Reply(_("Vhost for \002{0}\002 set to \002{0}\002."), nick, host); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Sets the vhost for the given nick to that of the given\n" - "hostmask. If your IRCD supports vIdents, then using\n" - "SET <nick> <ident>@<hostmask> set idents for users as\n" - "well as vhosts.")); + source.Reply(_("Sets the vhost of the given \037user\037 to the given \037hostmask\037.")); return true; } }; @@ -123,23 +119,22 @@ class CommandHSSetAll : public Command CommandHSSetAll(Module *creator) : Command(creator, "hostserv/setall", 2, 2) { this->SetDesc(_("Set the vhost for all nicks in a group")); - this->SetSyntax(_("\037nick\037 \037hostmask\037")); + this->SetSyntax(_("\037user\037 \037hostmask\037")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } - Anope::string nick = params[0]; - + const Anope::string &nick = params[0]; NickServ::Nick *na = NickServ::FindNick(nick); if (na == NULL) { - source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), nick); return; } @@ -166,25 +161,26 @@ class CommandHSSetAll : public Command { if (!IRCD->CanSetVIdent) { - source.Reply(HOST_NO_VIDENT); + source.Reply(_("Vhosts may not contain a username.")); return; } - else if (!IRCD->IsIdentValid(user)) + + if (!IRCD->IsIdentValid(user)) { - source.Reply(HOST_SET_IDENT_ERROR); + source.Reply(_("The requested username is not valid.")); return; } } if (host.length() > Config->GetBlock("networkinfo")->Get<unsigned>("hostlen")) { - source.Reply(HOST_SET_TOOLONG, Config->GetBlock("networkinfo")->Get<unsigned>("hostlen")); + source.Reply(_("The requested vhost is too long, please use a hostname no longer than {0} characters."), Config->GetBlock("networkinfo")->Get<unsigned>("hostlen")); return; } if (!IRCD->IsHostValid(host)) { - source.Reply(HOST_SET_ERROR); + source.Reply(_("The requested hostname is not valid.")); return; } @@ -194,21 +190,14 @@ class CommandHSSetAll : public Command this->Sync(na); Event::OnSetVhost(&Event::SetVhost::OnSetVhost, na); if (!user.empty()) - source.Reply(_("VHost for group \002%s\002 set to \002%s\002@\002%s\002."), nick.c_str(), user.c_str(), host.c_str()); + source.Reply(_("Vhost for group \002{0}\002 set to \002{1}\002@\002{2}\002."), nick.c_str(), user.c_str(), host.c_str()); else - source.Reply(_("VHost for group \002%s\002 set to \002%s\002."), nick.c_str(), host.c_str()); + source.Reply(_("host for group \002{0}\002 set to \002{1}\002."), nick.c_str(), host.c_str()); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Sets the vhost for all nicks in the same group as that\n" - "of the given nick. If your IRCD supports vIdents, then\n" - "using SETALL <nick> <ident>@<hostmask> will set idents\n" - "for users as well as vhosts.\n" - "* NOTE, this will not update the vhost for any nicks\n" - "added to the group after this command was used.")); + source.Reply(_("Sets the vhost for all nicknames in the group of \037user\037.")); return true; } }; diff --git a/modules/commands/ms_cancel.cpp b/modules/commands/ms_cancel.cpp index 0de3ae0ea..6412834be 100644 --- a/modules/commands/ms_cancel.cpp +++ b/modules/commands/ms_cancel.cpp @@ -18,14 +18,14 @@ class CommandMSCancel : public Command CommandMSCancel(Module *creator) : Command(creator, "memoserv/cancel", 1, 1) { this->SetDesc(_("Cancel the last memo you sent")); - this->SetSyntax(_("{\037nick\037 | \037channel\037}")); + this->SetSyntax(_("{\037user\037 | \037channel\037}")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { - if (Anope::ReadOnly || !MemoServ::service) + if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } @@ -35,7 +35,12 @@ class CommandMSCancel : public Command MemoServ::MemoInfo *mi = MemoServ::service->GetMemoInfo(name, ischan, isregistered, false); if (!isregistered) - source.Reply(ischan ? CHAN_X_NOT_REGISTERED : _(NICK_X_NOT_REGISTERED), nname.c_str()); + { + if (ischan) + source.Reply(_("Channel \002{0}\002 isn't registered."), nname); + else + source.Reply(_("\002{0}\002 isn't registered."), nname); + } else { ChanServ::Channel *ci = NULL; @@ -51,20 +56,17 @@ class CommandMSCancel : public Command if (MemoServ::Event::OnMemoDel) MemoServ::Event::OnMemoDel(&MemoServ::Event::MemoDel::OnMemoDel, ischan ? ci->name : na->nc->display, mi, mi->GetMemo(i)); mi->Del(i); - source.Reply(_("Last memo to \002%s\002 has been cancelled."), nname.c_str()); + source.Reply(_("Your last memo to \002{0}\002 has been cancelled."), nname); return; } - source.Reply(_("No memo was cancelable.")); + source.Reply(_("No memo to \002{0}\002 was cancelable."), nname); } } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Cancels the last memo you sent to the given nick or channel,\n" - "provided it has not been read at the time you use the command.")); + source.Reply(_("Cancels the last memo you sent to \037user\037, provided it has not yet been read.")); return true; } }; diff --git a/modules/commands/ms_check.cpp b/modules/commands/ms_check.cpp index f20724a45..43a03f86d 100644 --- a/modules/commands/ms_check.cpp +++ b/modules/commands/ms_check.cpp @@ -16,13 +16,12 @@ class CommandMSCheck : public Command public: CommandMSCheck(Module *creator) : Command(creator, "memoserv/check", 1, 1) { - this->SetDesc(_("Checks if last memo to a nick was read")); - this->SetSyntax(_("\037nick\037")); + this->SetDesc(_("Checks if last memo to a user was read")); + this->SetSyntax(_("\037user\037")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { - const Anope::string &recipient = params[0]; bool found = false; @@ -30,16 +29,14 @@ class CommandMSCheck : public Command const NickServ::Nick *na = NickServ::FindNick(recipient); if (!na) { - source.Reply(NICK_X_NOT_REGISTERED, recipient.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), recipient); return; } MemoServ::MemoInfo *mi = na->nc->memos; - /* Okay, I know this looks strange but we wanna get the LAST memo, so we - have to loop backwards */ - if (mi) + /* find the last memo */ for (unsigned i = mi->memos->size(); i > 0; --i) { MemoServ::Memo *m = mi->GetMemo(i - 1); @@ -50,25 +47,20 @@ class CommandMSCheck : public Command found = true; /* Yes, we've found the memo */ if (m->unread) - source.Reply(_("The last memo you sent to %s (sent on %s) has not yet been read."), na->nick.c_str(), Anope::strftime(m->time, source.GetAccount()).c_str()); + source.Reply(_("The last memo you sent to \002{0}\002 (sent on \002{1}\002) has not yet been read."), na->nick, Anope::strftime(m->time, source.GetAccount())); else - source.Reply(_("The last memo you sent to %s (sent on %s) has been read."), na->nick.c_str(), Anope::strftime(m->time, source.GetAccount()).c_str()); + source.Reply(_("The last memo you sent to \002{0}\002 (sent on \002{1}\002) has been read."), na->nick, Anope::strftime(m->time, source.GetAccount())); break; } } if (!found) - source.Reply(_("Nick %s doesn't have a memo from you."), na->nick.c_str()); - - return; + source.Reply(_("\002{0}\002 doesn't have a memo from you."), na->nick); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Checks whether the _last_ memo you sent to \037nick\037 has been read\n" - "or not. Note that this does only work with nicks, not with channels.")); + source.Reply(_("Checks whether the last memo you sent to \037user\037 has been read or not.")); return true; } }; diff --git a/modules/commands/ms_del.cpp b/modules/commands/ms_del.cpp index 9089dd6a1..4e4ca5ed4 100644 --- a/modules/commands/ms_del.cpp +++ b/modules/commands/ms_del.cpp @@ -31,7 +31,7 @@ class MemoDelCallback : public NumberList MemoServ::Event::OnMemoDel(&MemoServ::Event::MemoDel::OnMemoDel, ci ? ci->name : source.nc->display, mi, mi->GetMemo(number - 1)); mi->Del(number - 1); - source.Reply(_("Memo %d has been deleted."), number); + source.Reply(_("Memo \002{0}\002 has been deleted."), number); } }; @@ -48,7 +48,7 @@ class CommandMSDel : public Command { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } @@ -64,26 +64,28 @@ class CommandMSDel : public Command ci = ChanServ::Find(chan); if (!ci) { - source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } - else if (!source.AccessFor(ci).HasPriv("MEMO")) + + if (!source.AccessFor(ci).HasPriv("MEMO")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "MEMO", ci->name); return; } mi = ci->memos; } else mi = source.nc->memos; + if (numstr.empty() || (!isdigit(numstr[0]) && !numstr.equals_ci("ALL") && !numstr.equals_ci("LAST"))) this->OnSyntaxError(source, numstr); else if (!mi || mi->memos->empty()) { if (!chan.empty()) - source.Reply(MEMO_X_HAS_NO_MEMOS, chan.c_str()); + source.Reply(_("\002{0}\002 has no memos."), chan); else - source.Reply(MEMO_HAVE_NO_MEMOS); + source.Reply(_("You have no memos.")); } else { @@ -98,7 +100,7 @@ class CommandMSDel : public Command if (MemoServ::Event::OnMemoDel) MemoServ::Event::OnMemoDel(&MemoServ::Event::MemoDel::OnMemoDel, ci ? ci->name : source.nc->display, mi, mi->GetMemo(mi->memos->size() - 1)); mi->Del(mi->memos->size() - 1); - source.Reply(_("Memo %d has been deleted."), mi->memos->size() + 1); + source.Reply(_("Memo \002{0}\002 has been deleted."), mi->memos->size() + 1); } else { @@ -110,32 +112,28 @@ class CommandMSDel : public Command mi->Del(i - 1); } if (!chan.empty()) - source.Reply(_("All memos for channel %s have been deleted."), chan.c_str()); + source.Reply(_("All memos for channel \002{0}\002 have been deleted."), chan); else source.Reply(_("All of your memos have been deleted.")); } } - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Deletes the specified memo or memos. You can supply\n" - "multiple memo numbers or ranges of numbers instead of a\n" - "single number, as in the second example below.\n" - " \n" - "If \002LAST\002 is given, the last memo will be deleted.\n" - "If \002ALL\002 is given, deletes all of your memos.\n" - " \n" - "Examples:\n" - " \n" - " \002DEL 1\002\n" - " Deletes your first memo.\n" - " \n" - " \002DEL 2-5,7-9\002\n" - " Deletes memos numbered 2 through 5 and 7 through 9.")); + source.Reply(_("Deletes the specified memo or memos." + " You can supply multiple memo numbers or ranges of numbers instead of a single number, as in the second example below." + " If \002LAST\002 is given, the last memo will be deleted." + " If \002ALL\002 is given, deletes all of your memos.\n" + "\n" + "Examples:\n" + "\n" + " {0} 1\n" + " Deletes your first memo.\n" + "\n" + " {0} 2-5,7-9\n" + " Deletes memos numbered 2 through 5 and 7 through 9."), + source.command); return true; } }; diff --git a/modules/commands/ms_ignore.cpp b/modules/commands/ms_ignore.cpp index 98b4a2f9e..18d4143c0 100644 --- a/modules/commands/ms_ignore.cpp +++ b/modules/commands/ms_ignore.cpp @@ -26,9 +26,10 @@ class CommandMSIgnore : public Command { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } + if (!MemoServ::service) return; @@ -47,18 +48,23 @@ class CommandMSIgnore : public Command MemoServ::MemoInfo *mi = MemoServ::service->GetMemoInfo(channel, ischan, isregistered, true); ChanServ::Channel *ci = ChanServ::Find(channel); if (!isregistered) - source.Reply(ischan ? CHAN_X_NOT_REGISTERED : _(NICK_X_NOT_REGISTERED), channel.c_str()); + { + if (ischan) + source.Reply(_("Channel \002{0}\002 isn't registered."), channel); + else + source.Reply(_("\002{0}\002 isn't registered."), channel); + } else if (ischan && !source.AccessFor(ci).HasPriv("MEMO")) - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "MEMO", ci->name); else if (command.equals_ci("ADD") && !param.empty()) { if (std::find(mi->ignores.begin(), mi->ignores.end(), param.ci_str()) == mi->ignores.end()) { mi->ignores.push_back(param.ci_str()); - source.Reply(_("\002%s\002 added to ignore list."), param.c_str()); + source.Reply(_("\002{0}\002 has been added to your memo ignore list."), param); } else - source.Reply(_("\002%s\002 is already on the ignore list."), param.c_str()); + source.Reply(_("\002{0}\002 is already on your memo ignore list."), param); } else if (command.equals_ci("DEL") && !param.empty()) { @@ -67,15 +73,15 @@ class CommandMSIgnore : public Command if (it != mi->ignores.end()) { mi->ignores.erase(it); - source.Reply(_("\002%s\002 removed from the ignore list."), param.c_str()); + source.Reply(_("\002{0}\002 has been removed from your memo ignore list."), param); } else - source.Reply(_("\002%s\002 is not on the ignore list."), param.c_str()); + source.Reply(_("\002{0}\002 is not on your memo ignore list."), param); } else if (command.equals_ci("LIST")) { if (mi->ignores.empty()) - source.Reply(_("Memo ignore list is empty.")); + source.Reply(_("Your memo ignore list is empty.")); else { ListFormatter list(source.GetAccount()); @@ -87,7 +93,7 @@ class CommandMSIgnore : public Command list.AddEntry(entry); } - source.Reply(_("Ignore list:")); + source.Reply(_("Memo ignore list:")); std::vector<Anope::string> replies; list.Process(replies); @@ -98,18 +104,12 @@ class CommandMSIgnore : public Command } else this->OnSyntaxError(source, ""); - - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Allows you to ignore users by nick or host from memoing\n" - "you or a channel. If someone on the memo ignore list tries\n" - "to memo you or a channel, they will not be told that you have\n" - "them ignored.")); + source.Reply(_("Allows you to ignore users from memoing you or a channel." + " If someone on the memo ignore list tries to memo you or a channel, they will not be told that you have them ignored.")); return true; } }; diff --git a/modules/commands/ms_info.cpp b/modules/commands/ms_info.cpp index 9544be3c7..a56c997e1 100644 --- a/modules/commands/ms_info.cpp +++ b/modules/commands/ms_info.cpp @@ -17,7 +17,7 @@ class CommandMSInfo : public Command CommandMSInfo(Module *creator) : Command(creator, "memoserv/info", 0, 1) { this->SetDesc(_("Displays information about your memos")); - this->SetSyntax(_("[\037nick\037 | \037channel\037]")); + this->SetSyntax(_("[\037user\037 | \037channel\037]")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -34,7 +34,7 @@ class CommandMSInfo : public Command na = NickServ::FindNick(nname); if (!na) { - source.Reply(NICK_X_NOT_REGISTERED, nname.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), nname); return; } mi = na->nc->memos; @@ -45,20 +45,22 @@ class CommandMSInfo : public Command ci = ChanServ::Find(nname); if (!ci) { - source.Reply(CHAN_X_NOT_REGISTERED, nname.c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), nname); return; } - else if (!source.AccessFor(ci).HasPriv("MEMO")) + + if (!source.AccessFor(ci).HasPriv("MEMO")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "MEMO", ci->name); return; } + mi = ci->memos; hardmax = ci->HasExt("MEMO_HARDMAX"); } - else if (!nname.empty()) /* It's not a chan and we aren't services admin */ + else if (!nname.empty()) /* It's not a chan and we aren't an oper */ { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have the correct operator privilege to see the memo info of \002{0}\002."), nname); return; } else @@ -76,9 +78,9 @@ class CommandMSInfo : public Command else if (mi->memos->size() == 1) { if (mi->GetMemo(0)->unread) - source.Reply(_("%s currently has \0021\002 memo, and it has not yet been read."), nname.c_str()); + source.Reply(_("\002{0}\002 currently has \0021\002 memo, and it has not yet been read."), nname); else - source.Reply(_("%s currently has \0021\002 memo."), nname.c_str()); + source.Reply(_("\002{0}\002 currently has \0021\002 memo."), nname); } else { @@ -87,46 +89,37 @@ class CommandMSInfo : public Command if (mi->GetMemo(i)->unread) ++count; if (count == mi->memos->size()) - source.Reply(_("%s currently has \002%d\002 memos; all of them are unread."), nname.c_str(), count); + source.Reply(_("\002{0}\002 currently has \002{1]\002 memos; all of them are unread."), nname, count); else if (!count) - source.Reply(_("%s currently has \002%d\002 memos."), nname.c_str(), mi->memos->size()); + source.Reply(_("\002{0}\002 currently has \002{1}\002 memos."), nname, mi->memos->size()); else if (count == 1) - source.Reply(_("%s currently has \002%d\002 memos, of which \0021\002 is unread."), nname.c_str(), mi->memos->size()); + source.Reply(_("\002{0}\002 currently has \002{1}\002 memos, of which \0021\002 is unread."), nname, mi->memos->size()); else - source.Reply(_("%s currently has \002%d\002 memos, of which \002%d\002 are unread."), nname.c_str(), mi->memos->size(), count); + source.Reply(_("\002{0}\002 currently has \002{1]\002 memos, of which \002{2}\002 are unread."), nname, mi->memos->size(), count); } - if (!mi->memomax) + if (mi->memomax >= 0) { if (hardmax) - source.Reply(_("%s's memo limit is \002%d\002, and may not be changed."), nname.c_str(), mi->memomax); + source.Reply(_("The memo limit of \002{0}\002 is \002{1}\002, and may not be changed."), nname, mi->memomax); else - source.Reply(_("%s's memo limit is \002%d\002."), nname.c_str(), mi->memomax); - } - else if (mi->memomax > 0) - { - if (hardmax) - source.Reply(_("%s's memo limit is \002%d\002, and may not be changed."), nname.c_str(), mi->memomax); - else - source.Reply(_("%s's memo limit is \002%d\002."), nname.c_str(), mi->memomax); + source.Reply(_("The memo limit of \002{0}\002 is \002{1}\002."), nname, mi->memomax); } else - source.Reply(_("%s has no memo limit."), nname.c_str()); + source.Reply(_("\002{0}\002 has no memo limit."), nname); - /* I ripped this code out of ircservices 4.4.5, since I didn't want - to rewrite the whole thing (it pisses me off). */ if (na) { if (na->nc->HasExt("MEMO_RECEIVE") && na->nc->HasExt("MEMO_SIGNON")) - source.Reply(_("%s is notified of new memos at logon and when they arrive."), nname.c_str()); + source.Reply(_("\002{0}\002 is notified of new memos at logon and when they arrive."), nname); else if (na->nc->HasExt("MEMO_RECEIVE")) - source.Reply(_("%s is notified when new memos arrive."), nname.c_str()); + source.Reply(_("\002{0}\002 is notified when new memos arrive."), nname); else if (na->nc->HasExt("MEMO_SIGNON")) - source.Reply(_("%s is notified of news memos at logon."), nname.c_str()); + source.Reply(_("\002{0}\002 is notified of news memos at logon."), nname); else - source.Reply(_("%s is not notified of new memos."), nname.c_str()); + source.Reply(_("\002{0}\002 is not notified of new memos."), nname); } } - else /* !nname || (!ci || na->nc == nc) */ + else { if (mi->memos->empty()) source.Reply(_("You currently have no memos.")); @@ -144,13 +137,13 @@ class CommandMSInfo : public Command if (mi->GetMemo(i)->unread) ++count; if (count == mi->memos->size()) - source.Reply(_("You currently have \002%d\002 memos; all of them are unread."), count); + source.Reply(_("You currently have \002{0}\002 memos; all of them are unread."), count); else if (!count) - source.Reply(_("You currently have \002%d\002 memos."), mi->memos->size()); + source.Reply(_("You currently have \002{0}\002 memos."), mi->memos->size()); else if (count == 1) - source.Reply(_("You currently have \002%d\002 memos, of which \0021\002 is unread."), mi->memos->size()); + source.Reply(_("You currently have \002{0}\002 memos, of which \0021\002 is unread."), mi->memos->size()); else - source.Reply(_("You currently have \002%d\002 memos, of which \002%d\002 are unread."), mi->memos->size(), count); + source.Reply(_("You currently have \002{0}\002 memos, of which \002{1}\002 are unread."), mi->memos->size(), count); } if (!mi->memomax) @@ -163,14 +156,13 @@ class CommandMSInfo : public Command else if (mi->memomax > 0) { if (!source.IsServicesOper() && hardmax) - source.Reply(_("Your memo limit is \002%d\002, and may not be changed."), mi->memomax); + source.Reply(_("Your memo limit is \002{0}\002, and may not be changed."), mi->memomax); else - source.Reply(_("Your memo limit is \002%d\002."), mi->memomax); + source.Reply(_("Your memo limit is \002{0}\002."), mi->memomax); } else source.Reply(_("You have no limit on the number of memos you may keep.")); - /* Ripped too. But differently because of a seg fault (loughs) */ if (nc->HasExt("MEMO_RECEIVE") && nc->HasExt("MEMO_SIGNON")) source.Reply(_("You will be notified of new memos at logon and when they arrive.")); else if (nc->HasExt("MEMO_RECEIVE")) @@ -184,18 +176,11 @@ class CommandMSInfo : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Without a parameter, displays information on the number of\n" - "memos you have, how many of them are unread, and how many\n" - "total memos you can receive.\n" - " \n" - "With a channel parameter, displays the same information for\n" - "the given channel.\n" - " \n" - "With a nickname parameter, displays the same information\n" - "for the given nickname. This is limited to \002Services\002\n" - "\002Operators\002.")); + source.Reply(_("Without a parameter, displays information on the number of memos you have, how many of them are unread, and how many total memos you can receive." + " With a parameter, displays the same information for the given \037user\037 or \037channel\037, if you have the appropriate privilege.\n" + "\n" + "Use of this command on a channel requires the \002{0}\002 privilege on \037channel\037."), + source.command); return true; } diff --git a/modules/commands/ms_list.cpp b/modules/commands/ms_list.cpp index 758bb08be..89f3dc7a5 100644 --- a/modules/commands/ms_list.cpp +++ b/modules/commands/ms_list.cpp @@ -35,14 +35,16 @@ class CommandMSList : public Command ci = ChanServ::Find(chan); if (!ci) { - source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } - else if (!source.AccessFor(ci).HasPriv("MEMO")) + + if (!source.AccessFor(ci).HasPriv("MEMO")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "MEMO", ci->name); return; } + mi = ci->memos; } else @@ -53,9 +55,9 @@ class CommandMSList : public Command else if (!mi->memos->size()) { if (!chan.empty()) - source.Reply(MEMO_X_HAS_NO_MEMOS, chan.c_str()); + source.Reply(_("\002{0}\002 has no memos."), chan); else - source.Reply(MEMO_HAVE_NO_MEMOS); + source.Reply(_("You have no memos.")); } else { @@ -103,9 +105,9 @@ class CommandMSList : public Command if (i == end) { if (!chan.empty()) - source.Reply(MEMO_X_HAS_NO_NEW_MEMOS, chan.c_str()); + source.Reply(_("\002{0}\002 has no new memos."), chan); else - source.Reply(MEMO_HAVE_NO_NEW_MEMOS); + source.Reply(_("You have no new memos.")); return; } } @@ -128,23 +130,23 @@ class CommandMSList : public Command std::vector<Anope::string> replies; list.Process(replies); - source.Reply(_("Memos for %s:"), ci ? ci->name.c_str() : source.GetNick().c_str()); + source.Reply(_("Memos for \002{0}\002:"), ci ? ci->name.c_str() : source.GetNick().c_str()); for (unsigned i = 0; i < replies.size(); ++i) source.Reply(replies[i]); } - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Lists any memos you currently have. With \002NEW\002, lists only\n" - "new (unread) memos. Unread memos are marked with a \"*\"\n" - "to the left of the memo number. You can also specify a list\n" - "of numbers, as in the example below:\n" - " \002LIST 2-5,7-9\002\n" - " Lists memos numbered 2 through 5 and 7 through 9.")); + source.Reply(_("Lists the memos you currently have." + " With \002NEW\002, lists only new (unread) memos." + " Unread memos are marked with a \"*\" to the left of the memo number." + " You can also specify a list of numbers, as in the example below:\n" + "\n" + "Example:\n" + "\n" + " {0} 2-5,7-9\n" + " Lists memos numbered 2 through 5 and 7 through 9.")); return true; } }; diff --git a/modules/commands/ms_read.cpp b/modules/commands/ms_read.cpp index 32852a29f..2cbecf70b 100644 --- a/modules/commands/ms_read.cpp +++ b/modules/commands/ms_read.cpp @@ -31,15 +31,14 @@ static void rsend_notify(CommandSource &source, MemoServ::MemoInfo *mi, MemoServ /* Text of the memo varies if the recepient was a nick or channel */ - Anope::string text = Anope::printf(Language::Translate(na->nc, _("\002[auto-memo]\002 The memo you sent to %s has been viewed.")), targ.c_str()); + Anope::string text = Anope::printf(Language::Translate(na->nc, _("\002[auto-memo]\002 The memo you sent to \002%s\002 has been viewed.")), targ.c_str()); /* Send notification */ MemoServ::service->Send(source.GetNick(), m->sender, text, true); /* Notify recepient of the memo that a notification has been sent to the sender */ - source.Reply(_("A notification memo has been sent to %s informing him/her you have\n" - "read his/her memo."), nc->display.c_str()); + source.Reply(_("A notification memo has been sent to \002{0}\002 informing him/her you have read his/her memo."), nc->display); } /* Remove receipt flag from the original memo */ @@ -51,6 +50,7 @@ class MemoListCallback : public NumberList CommandSource &source; MemoServ::MemoInfo *mi; const ChanServ::Channel *ci; + public: MemoListCallback(CommandSource &_source, MemoServ::MemoInfo *_mi, const ChanServ::Channel *_ci, const Anope::string &numlist) : NumberList(numlist, false), source(_source), mi(_mi), ci(_ci) { @@ -71,21 +71,21 @@ class MemoListCallback : public NumberList return; if (ci) - source.Reply(_("Memo %d from %s (%s)."), index + 1, m->sender.c_str(), Anope::strftime(m->time, source.GetAccount()).c_str()); + source.Reply(_("Memo \002{0}\002 from \002{1}\002 (\002{2}\002)."), index + 1, m->sender, Anope::strftime(m->time, source.GetAccount())); else - source.Reply(_("Memo %d from %s (%s)."), index + 1, m->sender.c_str(), Anope::strftime(m->time, source.GetAccount()).c_str()); + source.Reply(_("Memo \002{0}\002 from \002{1}\002 (\002{2}\002)."), index + 1, m->sender, Anope::strftime(m->time, source.GetAccount())); BotInfo *bi; Anope::string cmd; if (Command::FindCommandFromService("memoserv/del", bi, cmd)) { if (ci) - source.Reply(_("To delete, type: \002%s%s %s %s %d\002"), Config->StrictPrivmsg.c_str(), bi->nick.c_str(), cmd.c_str(), ci->name.c_str(), index + 1); + source.Reply(_("To delete, use \002{0}{1} {2} {3} {4}\002"), Config->StrictPrivmsg, bi->nick, cmd, ci->name, index + 1); else - source.Reply(_("To delete, type: \002%s%s %s %d\002"), Config->StrictPrivmsg.c_str(), bi->nick.c_str(), cmd.c_str(), index + 1); + source.Reply(_("To delete, use \002{0}{1} {2} {3}\002"), Config->StrictPrivmsg, bi->nick, cmd, index + 1); } - source.Reply("%s", m->text.c_str()); + source.Reply(m->text); m->unread = false; /* Check if a receipt notification was requested */ @@ -118,14 +118,16 @@ class CommandMSRead : public Command ci = ChanServ::Find(chan); if (!ci) { - source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } - else if (!source.AccessFor(ci).HasPriv("MEMO")) + + if (!source.AccessFor(ci).HasPriv("MEMO")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "MEMO", ci->name); return; } + mi = ci->memos; } else @@ -136,9 +138,9 @@ class CommandMSRead : public Command else if (mi->memos->empty()) { if (!chan.empty()) - source.Reply(MEMO_X_HAS_NO_MEMOS, chan.c_str()); + source.Reply(_("\002{0}\002 has no memos."), chan); else - source.Reply(MEMO_HAVE_NO_MEMOS); + source.Reply(_("You have no memos.")); } else { @@ -156,9 +158,9 @@ class CommandMSRead : public Command if (!readcount) { if (!chan.empty()) - source.Reply(MEMO_X_HAS_NO_NEW_MEMOS, chan.c_str()); + source.Reply(_("\002{0}\002 has no new memos."), chan); else - source.Reply(MEMO_HAVE_NO_NEW_MEMOS); + source.Reply(_("You have no new memos.")); } } else if (numstr.equals_ci("LAST")) @@ -172,21 +174,21 @@ class CommandMSRead : public Command list.Process(); } } - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Sends you the text of the memos specified. If LAST is\n" - "given, sends you the memo you most recently received. If\n" - "NEW is given, sends you all of your new memos. Otherwise,\n" - "sends you memo number \037num\037. You can also give a list of\n" - "numbers, as in this example:\n" - " \n" - " \002READ 2-5,7-9\002\n" - " Displays memos numbered 2 through 5 and 7 through 9.")); + source.Reply(_("Sends you the text of the memos specified." + " If LAST is given, sends you the memo you most recently received." + " If NEW is given, sends you all of your new memos." + " Otherwise, sends you memo number \037num\037." + " You can also give a list of numbers, as in the example:\n" + "\n" + "Example:\n" + "\n" + " {0} 2-5,7-9\n" + " Displays memos numbered 2 through 5 and 7 through 9."), + source.command); return true; } }; diff --git a/modules/commands/ms_rsend.cpp b/modules/commands/ms_rsend.cpp index 98315845c..101a67816 100644 --- a/modules/commands/ms_rsend.cpp +++ b/modules/commands/ms_rsend.cpp @@ -28,7 +28,7 @@ class CommandMSRSend : public Command if (Anope::ReadOnly && !source.IsOper()) { - source.Reply(MEMO_SEND_DISABLED); + source.Reply(_("Sorry, memo sending is temporarily disabled.")); return; } @@ -44,19 +44,19 @@ class CommandMSRSend : public Command } if (Config->GetModule(this->owner)->Get<bool>("operonly") && !source.IsServicesOper()) - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. This command is for operators only.")); else { MemoServ::MemoServService::MemoResult result = MemoServ::service->Send(source.GetNick(), nick, text); if (result == MemoServ::MemoServService::MEMO_INVALID_TARGET) - source.Reply(_("\002%s\002 is not a registered unforbidden nick or channel."), nick.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), nick); else if (result == MemoServ::MemoServService::MEMO_TOO_FAST) - source.Reply(_("Please wait %d seconds before using the %s command again."), Config->GetModule("memoserv")->Get<time_t>("senddelay"), source.command.c_str()); + source.Reply(_("Please wait \002{0}\002 seconds before using the \002{1}\002 command again."), Config->GetModule("memoserv")->Get<time_t>("senddelay"), source.command); else if (result == MemoServ::MemoServService::MEMO_TARGET_FULL) - source.Reply(_("Sorry, %s currently has too many memos and cannot receive more."), nick.c_str()); + source.Reply(_("Sorry, \002{0}\002 currently has too many memos and cannot receive more."), nick); else { - source.Reply(_("Memo sent to \002%s\002."), nick.c_str()); + source.Reply(_("Memo sent to \002{0}\002."), nick); bool ischan, isregistered; MemoServ::MemoInfo *mi = MemoServ::service->GetMemoInfo(nick, ischan, isregistered, false); @@ -71,6 +71,7 @@ class CommandMSRSend : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { +#if 0 this->SendSyntax(source); source.Reply(" "); source.Reply(_("Sends the named \037nick\037 or \037channel\037 a memo containing\n" @@ -81,6 +82,7 @@ class CommandMSRSend : public Command "memo will be sent to the sender informing him/her that the memo\n" "has been read.")); return true; +#endif } }; diff --git a/modules/commands/ms_send.cpp b/modules/commands/ms_send.cpp index 2cf7d476e..9e5ada796 100644 --- a/modules/commands/ms_send.cpp +++ b/modules/commands/ms_send.cpp @@ -18,7 +18,7 @@ class CommandMSSend : public Command CommandMSSend(Module *creator) : Command(creator, "memoserv/send", 2, 2) { this->SetDesc(_("Send a memo to a nick or channel")); - this->SetSyntax(_("{\037nick\037 | \037channel\037} \037memo-text\037")); + this->SetSyntax(_("{\037user\037 | \037channel\037} \037memo-text\037")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -31,29 +31,26 @@ class CommandMSSend : public Command if (Anope::ReadOnly && !source.IsOper()) { - source.Reply(MEMO_SEND_DISABLED); + source.Reply(_("Sorry, memo sending is temporarily disabled.")); return; } MemoServ::MemoServService::MemoResult result = MemoServ::service->Send(source.GetNick(), nick, text); if (result == MemoServ::MemoServService::MEMO_SUCCESS) - source.Reply(_("Memo sent to \002%s\002."), nick.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), nick); else if (result == MemoServ::MemoServService::MEMO_INVALID_TARGET) source.Reply(_("\002%s\002 is not a registered unforbidden nick or channel."), nick.c_str()); else if (result == MemoServ::MemoServService::MEMO_TOO_FAST) - source.Reply(_("Please wait %d seconds before using the %s command again."), Config->GetModule("memoserv")->Get<time_t>("senddelay"), source.command.c_str()); + source.Reply(_("Please wait \002{0}\002 seconds before using the \002{1}\002 command again."), Config->GetModule("memoserv")->Get<time_t>("senddelay"), source.command); else if (result == MemoServ::MemoServService::MEMO_TARGET_FULL) - source.Reply(_("Sorry, %s currently has too many memos and cannot receive more."), nick.c_str()); + source.Reply(_("Sorry, \002{0}\002 currently has too many memos and cannot receive more."), nick); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Sends the named \037nick\037 or \037channel\037 a memo containing\n" - "\037memo-text\037. When sending to a nickname, the recipient will\n" - "receive a notice that he/she has a new memo. The target\n" - "nickname/channel must be registered.")); + source.Reply(_("Sends the named \037user\037 or \037channel\037 a memo containing \037memo-text\037." + " The recipient will receive a notice that they have a new memo." + " The target user or channel must be registered.")); return true; } }; diff --git a/modules/commands/ms_sendall.cpp b/modules/commands/ms_sendall.cpp index a1c545ec2..92b3c208c 100644 --- a/modules/commands/ms_sendall.cpp +++ b/modules/commands/ms_sendall.cpp @@ -38,13 +38,11 @@ class CommandMSSendAll : public Command MemoServ::service->Send(source.GetNick(), nc->display, text); } - source.Reply(_("A massmemo has been sent to all registered users.")); + source.Reply(_("A mass memo has been sent to all registered users.")); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); source.Reply(_("Sends all registered users a memo containing \037memo-text\037.")); return true; } diff --git a/modules/commands/ms_set.cpp b/modules/commands/ms_set.cpp index 47acb177d..42bce16cf 100644 --- a/modules/commands/ms_set.cpp +++ b/modules/commands/ms_set.cpp @@ -27,19 +27,19 @@ class CommandMSSet : public Command { nc->Extend<bool>("MEMO_SIGNON"); nc->Extend<bool>("MEMO_RECEIVE"); - source.Reply(_("%s will now notify you of memos when you log on and when they are sent to you."), MemoServ->nick.c_str()); + source.Reply(_("\002{0}\002 will now notify you of memos when you log on and when they are sent to you."), MemoServ->nick); } else if (param.equals_ci("LOGON")) { nc->Extend<bool>("MEMO_SIGNON"); nc->Shrink<bool>("MEMO_RECEIVE"); - source.Reply(_("%s will now notify you of memos when you log on or unset /AWAY."), MemoServ->nick.c_str()); + source.Reply(_("\002{0}\002 will now notify you of memos when you log on or unset /AWAY."), MemoServ->nick); } else if (param.equals_ci("NEW")) { nc->Shrink<bool>("MEMO_SIGNON"); nc->Extend<bool>("MEMO_RECEIVE"); - source.Reply(_("%s will now notify you of memos when they are sent to you."), MemoServ->nick.c_str()); + source.Reply(_("\002{0}\002 will now notify you of memos when they are sent to you."), MemoServ->nick); } else if (param.equals_ci("MAIL")) { @@ -61,7 +61,7 @@ class CommandMSSet : public Command nc->Shrink<bool>("MEMO_SIGNON"); nc->Shrink<bool>("MEMO_RECEIVE"); nc->Shrink<bool>("MEMO_MAIL"); - source.Reply(_("%s will not send you any notification of memos."), MemoServ->nick.c_str()); + source.Reply(_("\002{0}\002 will not send you any notification of memos."), MemoServ->nick); } else this->OnSyntaxError(source, ""); @@ -89,12 +89,13 @@ class CommandMSSet : public Command ci = ChanServ::Find(chan); if (!ci) { - source.Reply(CHAN_X_NOT_REGISTERED, chan.c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), chan); return; } - else if (!is_servadmin && !source.AccessFor(ci).HasPriv("MEMO")) + + if (!is_servadmin && !source.AccessFor(ci).HasPriv("MEMO")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "MEMO", ci->name); return; } mi = ci->memos; @@ -106,7 +107,7 @@ class CommandMSSet : public Command const NickServ::Nick *na; if (!(na = NickServ::FindNick(p1))) { - source.Reply(NICK_X_NOT_REGISTERED, p1.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), p1); return; } user = p1; @@ -150,7 +151,7 @@ class CommandMSSet : public Command } if (!chan.empty() && ci->HasExt("MEMO_HARDMAX")) { - source.Reply(_("The memo limit for %s may not be changed."), chan.c_str()); + source.Reply(_("The memo limit for \002{0}\002 may not be changed."), chan); return; } else if (chan.empty() && nc->HasExt("MEMO_HARDMAX")) @@ -170,9 +171,9 @@ class CommandMSSet : public Command if (limit < 0 || (max_memos > 0 && limit > max_memos)) { if (!chan.empty()) - source.Reply(_("You cannot set the memo limit for %s higher than %d."), chan.c_str(), max_memos); + source.Reply(_("You cannot set the memo limit for \002{0}\002 higher than \002{1}\002."), chan, max_memos); else - source.Reply(_("You cannot set your memo limit higher than %d."), max_memos); + source.Reply(_("You cannot set your memo limit higher than \002{0}\002."), max_memos); return; } } @@ -180,25 +181,24 @@ class CommandMSSet : public Command if (limit > 0) { if (chan.empty() && nc == source.nc) - source.Reply(_("Your memo limit has been set to \002%d\002."), limit); + source.Reply(_("Your memo limit has been set to \002{0}\002."), limit); else - source.Reply(_("Memo limit for %s set to \002%d\002."), !chan.empty() ? chan.c_str() : user.c_str(), limit); + source.Reply(_("Memo limit for \002{0}\002 set to \002{1}\002."), !chan.empty() ? chan : user, limit); } else if (!limit) { if (chan.empty() && nc == source.nc) source.Reply(_("You will no longer be able to receive memos.")); else - source.Reply(_("Memo limit for %s set to \0020\002."), !chan.empty() ? chan.c_str() : user.c_str()); + source.Reply(_("Memo limit for \002{0}\002 set to \0020\002."), !chan.empty() ? chan : user); } else { if (chan.empty() && nc == source.nc) source.Reply(_("Your memo limit has been disabled.")); else - source.Reply(_("Memo limit \002disabled\002 for %s."), !chan.empty() ? chan.c_str() : user.c_str()); + source.Reply(_("Memo limit \002disabled\002 for \002{0}\002."), !chan.empty() ? chan : user); } - return; } public: CommandMSSet(Module *creator) : Command(creator, "memoserv/set", 2, 5) @@ -226,66 +226,64 @@ class CommandMSSet : public Command { if (subcommand.empty()) { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Sets various memo options. \037option\037 can be one of:\n" - " \n" - " NOTIFY Changes when you will be notified about\n" - " new memos (only for nicknames)\n" - " LIMIT Sets the maximum number of memos you can\n" - " receive\n" - " \n" - "Type \002%s%s HELP %s \037option\037\002 for more information\n" - "on a specific option."), Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), source.command.c_str()); + CommandInfo *help = source.service->FindCommand("generic/help"); + if (!help) + return false; + source.Reply(_("Sets various memo options. \037option\037 can be one of:\n" + "\n" + " NOTIFY Changes when you will be notified about\n" + " new memos (only for nicknames)\n" + " LIMIT Sets the maximum number of memos you can\n" + " receive\n" + "\n" + "Type \002{0}{1} {2} {3} \037option\037\002 for more information on a specific option."), + Config->StrictPrivmsg, source.service->nick, help->cname, source.command); } else if (subcommand.equals_ci("NOTIFY")) source.Reply(_("Syntax: \002NOTIFY {ON | LOGON | NEW | MAIL | NOMAIL | OFF}\002\n" - " \n" - "Changes when you will be notified about new memos:\n" - " \n" - " ON You will be notified of memos when you log on,\n" - " when you unset /AWAY, and when they are sent\n" - " to you.\n" - " LOGON You will only be notified of memos when you log\n" - " on or when you unset /AWAY.\n" - " NEW You will only be notified of memos when they\n" - " are sent to you.\n" - " MAIL You will be notified of memos by email aswell as\n" - " any other settings you have.\n" - " NOMAIL You will not be notified of memos by email.\n" - " OFF You will not receive any notification of memos.\n" - " \n" - "\002ON\002 is essentially \002LOGON\002 and \002NEW\002 combined.")); + "\n" + "Changes when you will be notified about new memos:\n" + "\n" + " ON You will be notified of memos when you log on,\n" + " when you unset /AWAY, and when they are sent\n" + " to you.\n" + "\n" + " LOGON You will only be notified of memos when you log\n" + " on or when you unset /AWAY.\n" + "\n" + " NEW You will only be notified of memos when they\n" + " are sent to you.\n" + "\n" + " MAIL You will be notified of memos by email aswell as\n" + " any other settings you have.\n" + "\n" + " NOMAIL You will not be notified of memos by email.\n" + "\n" + " OFF You will not receive any notification of memos.\n" + "\n" + "\002ON\002 is essentially \002LOGON\002 and \002NEW\002 combined.")); else if (subcommand.equals_ci("LIMIT")) { int max_memos = Config->GetModule("memoserv")->Get<int>("maxmemos"); if (source.IsServicesOper()) source.Reply(_("Syntax: \002LIMIT [\037user\037 | \037channel\037] {\037limit\037 | NONE} [HARD]\002\n" - " \n" - "Sets the maximum number of memos a user or channel is\n" - "allowed to have. Setting the limit to 0 prevents the user\n" - "from receiving any memos; setting it to \002NONE\002 allows the\n" - "user to receive and keep as many memos as they want. If\n" - "you do not give a nickname or channel, your own limit is\n" - "set.\n" - " \n" - "Adding \002HARD\002 prevents the user from changing the limit. Not\n" - "adding \002HARD\002 has the opposite effect, allowing the user to\n" - "change the limit (even if a previous limit was set with\n" - "\002HARD\002).\n" - " \n" - "This use of the \002SET LIMIT\002 command is limited to \002Services\002\n" - "\002Operators\002. Other users may only enter a limit for themselves\n" - "or a channel on which they have such privileges, may not\n" - "remove their limit, may not set a limit above %d, and may\n" - "not set a hard limit."), max_memos); + "\n" + "Sets the maximum number of memos a user or channel is allowed to have." + " Setting the limit to 0 prevents the user from receiving any memos; setting it to \002NONE\002 allows the user to receive and keep as many memos as they want." + " If you do not give a nickname or channel, your own limit is set.\n" + "\n" + "Adding \002HARD\002 prevents the user from changing the limit." + " Not adding \002HARD\002 has the opposite effect, allowing the user to change the limit, even if a previous limit was set.\n" + " \n" + "This use of the \002{0} LIMIT\002 command is limited to \002Services Operators\002." + " Other users may only enter a limit for themselves or a channel on which they have the \002MEMO\002 privilege on, may not remove their limit, may not set a limit above {1}, and may not set a hard limit."), + source.command, max_memos); else source.Reply(_("Syntax: \002LIMIT [\037channel\037] \037limit\037\002\n" - " \n" - "Sets the maximum number of memos you (or the given channel)\n" - "are allowed to have. If you set this to 0, no one will be\n" - "able to send any memos to you. However, you cannot set\n" - "this any higher than %d."), max_memos); + "\n" + "Sets the maximum number of memos you, or the given channel, are allowed to have." + " If you set this to 0, no one will be able to send any memos to you." + "However, you cannot set this any higher than {0}."), max_memos); } else return false; diff --git a/modules/commands/ms_staff.cpp b/modules/commands/ms_staff.cpp index 7e33b76b3..aff70fd83 100644 --- a/modules/commands/ms_staff.cpp +++ b/modules/commands/ms_staff.cpp @@ -39,8 +39,6 @@ class CommandMSStaff : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); source.Reply(_("Sends all services staff a memo containing \037memo-text\037.")); return true; diff --git a/modules/commands/ns_access.cpp b/modules/commands/ns_access.cpp index e15f2abfd..95a93fea1 100644 --- a/modules/commands/ns_access.cpp +++ b/modules/commands/ns_access.cpp @@ -25,27 +25,25 @@ class CommandNSAccess : public Command if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } if (nc->access.size() >= Config->GetModule(this->owner)->Get<unsigned>("accessmax", "32")) { - source.Reply(_("Sorry, the maximum of %d access entries has been reached."), Config->GetModule(this->owner)->Get<unsigned>("accessmax")); + source.Reply(_("Sorry, the maximum of \002{0}\002 access entries has been reached."), Config->GetModule(this->owner)->Get<unsigned>("accessmax")); return; } if (nc->FindAccess(mask)) { - source.Reply(_("Mask \002%s\002 already present on %s's access list."), mask.c_str(), nc->display.c_str()); + source.Reply(_("Mask \002{0}\002 already present on the access list of \002{1}\002."), mask, nc->display); return; } 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; + source.Reply(_("\002{0}\002 added to the access list of \002{1}\002."), mask, nc->display); } void DoDel(CommandSource &source, NickServ::Account *nc, const Anope::string &mask) @@ -58,21 +56,19 @@ class CommandNSAccess : public Command if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } if (!nc->FindAccess(mask)) { - source.Reply(_("\002%s\002 not found on %s's access list."), mask.c_str(), nc->display.c_str()); + source.Reply(_("\002{0}\002 not found on the access list of \002{1}\002."), mask, nc->display); return; } 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; + source.Reply(_("\002{0}\002 deleted from the access list of \002{1}\002."), mask, nc->display); } void DoList(CommandSource &source, NickServ::Account *nc, const Anope::string &mask) @@ -81,20 +77,18 @@ class CommandNSAccess : public Command if (nc->access.empty()) { - source.Reply(_("%s's access list is empty."), nc->display.c_str()); + source.Reply(_("The access list of \002{0}\002 is empty."), nc->display); return; } - source.Reply(_("Access list for %s:"), nc->display.c_str()); + source.Reply(_("Access list for \002{0}\002:"), nc->display); for (i = 0, end = nc->access.size(); i < end; ++i) { Anope::string access = nc->GetAccess(i); if (!mask.empty() && !Anope::Match(access, mask)) continue; - source.Reply(" %s", access.c_str()); + source.Reply(" {0}", access); } - - return; } public: CommandNSAccess(Module *creator) : Command(creator, "nickserv/access", 1, 3) @@ -119,20 +113,16 @@ class CommandNSAccess : public Command } NickServ::Account *nc; - if (!nick.empty()) + if (!nick.empty() && source.HasPriv("nickserv/access")) { const NickServ::Nick *na = NickServ::FindNick(nick); if (na == NULL) { - source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), nick); return; } - else if (na->nc != source.GetAccount() && !source.HasPriv("nickserv/access")) - { - source.Reply(ACCESS_DENIED); - return; - } - else if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && source.GetAccount() != na->nc && na->nc->IsServicesOper() && !cmd.equals_ci("LIST")) + + if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && source.GetAccount() != na->nc && na->nc->IsServicesOper() && !cmd.equals_ci("LIST")) { source.Reply(_("You may view but not modify the access list of other Services Operators.")); return; @@ -145,13 +135,13 @@ class CommandNSAccess : public Command if (!mask.empty() && (mask.find('@') == Anope::string::npos || mask.find('!') != Anope::string::npos)) { - source.Reply(BAD_USERHOST_MASK); - source.Reply(MORE_INFO, Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), source.command.c_str()); + source.Reply(_("Mask must be in the form \037user\037@\037host\037.")); + source.Reply(_("\002%s%s HELP %s\002 for more information."), Config->StrictPrivmsg, source.service->nick, source.command); // XXX } else if (cmd.equals_ci("LIST")) return this->DoList(source, nc, mask); else if (nc->HasExt("NS_SUSPENDED")) - source.Reply(NICK_X_SUSPENDED, nc->display.c_str()); + source.Reply(_("\002{0}\002 is suspended."), nc->display); else if (cmd.equals_ci("ADD")) return this->DoAdd(source, nc, mask); else if (cmd.equals_ci("DEL")) @@ -162,27 +152,24 @@ class CommandNSAccess : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Modifies or displays the access list for your nick. This\n" - "is the list of addresses which will be automatically\n" - "recognized by %s as allowed to use the nick. If\n" - "you want to use the nick from a different address, you\n" - "need to send an \002IDENTIFY\002 command to make %s\n" - "recognize you. Services Operators may provide a nick\n" - "to modify other users' access lists.\n" - " \n" - "Examples:\n" - " \n" - " \002ACCESS ADD anyone@*.bepeg.com\002\n" - " Allows access to user \002anyone\002 from any machine in\n" - " the \002bepeg.com\002 domain.\n" - " \n" - " \002ACCESS DEL anyone@*.bepeg.com\002\n" - " Reverses the previous command.\n" - " \n" - " \002ACCESS LIST\002\n" - " Displays the current access list."), source.service->nick.c_str(), source.service->nick.c_str()); + source.Reply(_("Modifies or displays the access list for your account." + " The access list is a list of addresses that {1} uses to recognize you." + " If you match one of the hosts on the access list, services will not force you to change your nickname if the \002KILL\002 option is set." + " Furthermore, if the \002SECURE\002 option is disabled, services will recognize you just based on your hostmask, without having to supply a password." + " To gain access to channels when only recognized by your hostmask, the channel must too have the \002SECURE\002 option off." + " Services Operators may provide \037nickname\037 to modify other user's access lists.\n" + "\n" + "Examples:\n" + " \n" + " {command} ADD anyone@*.bepeg.com\n" + " Allows access to user \"anyone\" from any machine in the \"bepeg.com\" domain.\n" + "\n" + " {command} DEL anyone@*.bepeg.com\n" + " Reverses the previous command.\n" + "\n" + " {command} LIST\n" + " Displays the current access list."), + source.command, source.service->nick); return true; } }; diff --git a/modules/commands/ns_ajoin.cpp b/modules/commands/ns_ajoin.cpp index 834607028..94df860d6 100644 --- a/modules/commands/ns_ajoin.cpp +++ b/modules/commands/ns_ajoin.cpp @@ -93,7 +93,7 @@ class CommandNSAJoin : public Command AJoinList *channels = nc->Require<AJoinList>("ajoinlist"); if ((*channels)->empty()) - source.Reply(_("%s's auto join list is empty."), nc->display.c_str()); + source.Reply(_("The auto join list of \002{0}\002 is empty."), nc->display); else { ListFormatter list(source.GetAccount()); @@ -108,7 +108,7 @@ class CommandNSAJoin : public Command list.AddEntry(entry); } - source.Reply(_("%s's auto join list:"), nc->display.c_str()); + source.Reply(_("Auto join list of \002{0}\002:"), nc->display); std::vector<Anope::string> replies; list.Process(replies); @@ -138,13 +138,14 @@ class CommandNSAJoin : public Command if ((*channels)->size() >= Config->GetModule(this->owner)->Get<unsigned>("ajoinmax")) { - source.Reply(_("Sorry, the maximum of %d auto join entries has been reached."), Config->GetModule(this->owner)->Get<unsigned>("ajoinmax")); + source.Reply(_("Sorry, the maximum of \002{0}\002 auto join entries has been reached."), Config->GetModule(this->owner)->Get<unsigned>("ajoinmax")); return; } - else if (i != (*channels)->size()) + + if (i != (*channels)->size()) alreadyadded += chan + ", "; else if (IRCD->IsChannelValid(chan) == false) - source.Reply(CHAN_X_INVALID, chan.c_str()); + source.Reply(_("\002{0}\002 isn't a valid channel."), chan); else { Channel *c = Channel::Find(chan); @@ -167,13 +168,13 @@ class CommandNSAJoin : public Command if (!alreadyadded.empty()) { alreadyadded = alreadyadded.substr(0, alreadyadded.length() - 2); - source.Reply(_("%s is already on %s's auto join list."), alreadyadded.c_str(), nc->display.c_str()); + source.Reply(_("\002{0}\002 is already on the auto join list of \002{1}\002."), alreadyadded, nc->display); } if (!invalidkey.empty()) { invalidkey = invalidkey.substr(0, invalidkey.length() - 2); - source.Reply(_("%s had an invalid key specified, and was thus ignored."), invalidkey.c_str()); + source.Reply(_("\002{0}\002 had an invalid key specified, and was ignored."), invalidkey); } if (addedchans.empty()) @@ -181,7 +182,7 @@ class CommandNSAJoin : public Command addedchans = addedchans.substr(0, addedchans.length() - 2); Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to ADD channel " << addedchans << " to " << nc->display; - source.Reply(_("%s added to %s's auto join list."), addedchans.c_str(), nc->display.c_str()); + source.Reply(_("\002{0}\002 added to the auto join list of \002{1}\002."), addedchans, nc->display); } void DoDel(CommandSource &source, NickServ::Account *nc, const Anope::string &chans) @@ -210,7 +211,7 @@ class CommandNSAJoin : public Command if (!notfoundchans.empty()) { notfoundchans = notfoundchans.substr(0, notfoundchans.length() - 2); - source.Reply(_("%s was not found on %s's auto join list."), notfoundchans.c_str(), nc->display.c_str()); + source.Reply(_("\002{0}\002 was not found on the auto join list of \002{1}\002."), notfoundchans, nc->display); } if (delchans.empty()) @@ -218,7 +219,7 @@ class CommandNSAJoin : public Command delchans = delchans.substr(0, delchans.length() - 2); Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to DELETE channel " << delchans << " from " << nc->display; - source.Reply(_("%s was removed from %s's auto join list."), delchans.c_str(), nc->display.c_str()); + source.Reply(_("\002{0}\002 was removed from the auto join list of \002{1}\002."), delchans, nc->display); if ((*channels)->empty()) nc->Shrink<AJoinList>("ajoinlist"); @@ -244,17 +245,12 @@ class CommandNSAJoin : public Command nick = (params.size() > 2 && IRCD->IsChannelValid(params[2])) ? params[1] : ""; NickServ::Account *nc; - if (!nick.empty()) + if (!nick.empty() && !source.HasCommand("nickserv/ajoin")) { const NickServ::Nick *na = NickServ::FindNick(nick); if (na == NULL) { - source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); - return; - } - else if (na->nc != source.GetAccount() && !source.HasCommand("nickserv/ajoin")) - { - source.Reply(ACCESS_DENIED); + source.Reply(_("\002{0}\002 isn't registered."), nick); return; } @@ -272,11 +268,11 @@ class CommandNSAJoin : public Command if (cmd.equals_ci("LIST")) return this->DoList(source, nc); else if (nc->HasExt("NS_SUSPENDED")) - source.Reply(NICK_X_SUSPENDED, nc->display.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), nc->display); else if (param.empty()) this->OnSyntaxError(source, ""); else if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); else if (cmd.equals_ci("ADD")) return this->DoAdd(source, nc, param, param2); else if (cmd.equals_ci("DEL")) @@ -287,12 +283,9 @@ class CommandNSAJoin : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("This command manages your auto join list. When you identify\n" - "you will automatically join the channels on your auto join list.\n" - "Services Operators may provide a nick to modify other users'\n" - "auto join lists.")); + source.Reply(_("This command manages your auto join list." + " When you identify you will automatically join the channels on your auto join list." + " Services Operators may provide \037nickname\037 to modify other users' auto join lists.")); return true; } }; diff --git a/modules/commands/ns_alist.cpp b/modules/commands/ns_alist.cpp index ff3b5d037..58ec600fe 100644 --- a/modules/commands/ns_alist.cpp +++ b/modules/commands/ns_alist.cpp @@ -36,7 +36,7 @@ class CommandNSAList : public Command const NickServ::Nick *na = NickServ::FindNick(nick); if (!na) { - source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), nick); return; } nc = na->nc; @@ -98,28 +98,24 @@ class CommandNSAList : public Command if (!chan_count) { - source.Reply(_("\002%s\002 has no access in any channels."), nc->display.c_str()); + source.Reply(_("\002{0}\002 has no access in any channels."), nc->display); } else { - source.Reply(_("Channels that \002%s\002 has access on:"), nc->display.c_str()); + source.Reply(_("Channels that \002{0}\002 has access on:"), nc->display); for (unsigned i = 0; i < replies.size(); ++i) source.Reply(replies[i]); - source.Reply(_("End of list - %d channels shown."), chan_count); + source.Reply(_("End of list - \002{0}\002 channels shown."), chan_count); } } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); source.Reply(_("Lists all channels you have access on.\n" - " \n" - "Channels that have the \037NOEXPIRE\037 option set will be\n" - "prefixed by an exclamation mark. The nickname parameter is\n" - "limited to Services Operators")); + " \n" + "Channels that have the \037NOEXPIRE\037 option set will be prefixed by an exclamation mark. The nickname parameter is limited to Services Operators")); return true; } diff --git a/modules/commands/ns_cert.cpp b/modules/commands/ns_cert.cpp index 4f2ab5270..ae479eaa6 100644 --- a/modules/commands/ns_cert.cpp +++ b/modules/commands/ns_cert.cpp @@ -172,7 +172,7 @@ class CommandNSCert : public Command if (cl->GetCertCount() >= max) { - source.Reply(_("Sorry, the maximum of %d certificate entries has been reached."), max); + source.Reply(_("Sorry, the maximum of \002{0}\002 certificate entries has been reached."), max); return; } @@ -191,19 +191,19 @@ class CommandNSCert : public Command if (cl->FindCert(certfp)) { - source.Reply(_("Fingerprint \002%s\002 already present on %s's certificate list."), certfp.c_str(), nc->display.c_str()); + source.Reply(_("Fingerprint \002{0}\002 already present on the certificate list of \002{0}\002."), certfp, nc->display); return; } if (certmap.find(certfp) != certmap.end()) { - source.Reply(_("Fingerprint \002%s\002 is already in use."), certfp.c_str()); + source.Reply(_("Fingerprint \002{0}\002 is already in use."), certfp); return; } 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()); + source.Reply(_("\002{0}\002 added to the certificate list of \002{1}\002."), certfp, nc->display); } void DoDel(CommandSource &source, NickServ::Account *nc, Anope::string certfp) @@ -225,14 +225,14 @@ class CommandNSCert : public Command if (!cl->FindCert(certfp)) { - source.Reply(_("\002%s\002 not found on %s's certificate list."), certfp.c_str(), nc->display.c_str()); + source.Reply(_("\002{0}\002 not found on the certificate list of \002{1}\002."), certfp, nc->display); return; } 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()); + source.Reply(_("\002{0}\002 deleted from the access list of \002{1}\002."), certfp, nc->display); } void DoList(CommandSource &source, const NickServ::Account *nc) @@ -241,15 +241,15 @@ class CommandNSCert : public Command if (!cl || !cl->GetCertCount()) { - source.Reply(_("%s's certificate list is empty."), nc->display.c_str()); + source.Reply(_("The certificate list of \002{0}\002 is empty."), nc->display); return; } - source.Reply(_("Certificate list for %s:"), nc->display.c_str()); + source.Reply(_("Certificate list for \002{0}\002:"), nc->display); for (unsigned i = 0; i < cl->GetCertCount(); ++i) { Anope::string fingerprint = cl->GetCert(i); - source.Reply(" %s", fingerprint.c_str()); + source.Reply(" {0}", fingerprint); } } @@ -276,22 +276,18 @@ class CommandNSCert : public Command } NickServ::Account *nc; - if (!nick.empty()) + if (!nick.empty() && source.HasPriv("nickserv/access")) { const NickServ::Nick *na = NickServ::FindNick(nick); if (na == NULL) { - source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), nick); return; } - else if (na->nc != source.GetAccount() && !source.HasPriv("nickserv/access")) - { - source.Reply(ACCESS_DENIED); - return; - } - else if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && source.GetAccount() != na->nc && na->nc->IsServicesOper() && !cmd.equals_ci("LIST")) + + if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && source.GetAccount() != na->nc && na->nc->IsServicesOper() && !cmd.equals_ci("LIST")) { - source.Reply(_("You may view but not modify the certificate list of other Services Operators.")); + source.Reply(_("You may view, but not modify, the certificate list of other Services Operators.")); return; } @@ -303,9 +299,9 @@ class CommandNSCert : public Command if (cmd.equals_ci("LIST")) return this->DoList(source, nc); else if (nc->HasExt("NS_SUSPENDED")) - source.Reply(NICK_X_SUSPENDED, nc->display.c_str()); + source.Reply(_("\002{0}\002 is suspended."), nc->display); else if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); else if (cmd.equals_ci("ADD")) return this->DoAdd(source, nc, certfp); else if (cmd.equals_ci("DEL")) @@ -316,26 +312,17 @@ class CommandNSCert : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Modifies or displays the certificate list for your nick.\n" - "If you connect to IRC and provide a client certificate with a\n" - "matching fingerprint in the cert list, your nick will be\n" - "automatically identified to services. Services Operators\n" - "may provide a nick to modify other users' certificate lists.\n" - " \n")); - source.Reply(_("Examples:\n" - " \n" - " \002CERT ADD <fingerprint>\002\n" - " Adds this fingerprint to the certificate list and\n" - " automatically identifies you when you connect to IRC\n" - " using this certificate.\n" - " \n" - " \002CERT DEL <fingerprint>\002\n" - " Reverses the previous command.\n" - " \n" - " \002CERT LIST\002\n" - " Displays the current certificate list.")); + source.Reply(_("Modifies or displays the certificate list for your account." + "If you connect to IRC and provide a client certificate with a matching fingerprint in the certificate list, you will be automatically identified to services." + " Services Operators may provide \037nickname\037 to modify other users' certificate lists.\n" + "\n" + "Examples:\n" + "\n" + " {0} ADD\n" + " Adds your current fingerprint to the certificate list and automatically identifies you when you connect to IRC using this certificate.\n" + "\n" + " {0} DEL <fingerprint>\n" + " Removes \"<fingerprint>\" from your certificate list.")); return true; } }; diff --git a/modules/commands/ns_drop.cpp b/modules/commands/ns_drop.cpp index bd5fd7305..345521504 100644 --- a/modules/commands/ns_drop.cpp +++ b/modules/commands/ns_drop.cpp @@ -36,14 +36,14 @@ class CommandNSDrop : public Command NickServ::Nick *na = NickServ::FindNick(nick); if (!na) { - source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), nick); return; } bool is_mine = source.GetAccount() == na->nc; if (!is_mine && !source.HasPriv("nickserv/drop")) - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have the correct operator privileges to drop other user's nicknames.")); else if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && !is_mine && na->nc->IsServicesOper()) source.Reply(_("You may not drop other Services Operators' nicknames.")); else @@ -53,20 +53,15 @@ class CommandNSDrop : public Command Log(!is_mine ? LOG_ADMIN : LOG_COMMAND, source, this) << "to drop nickname " << na->nick << " (group: " << na->nc->display << ") (email: " << (!na->nc->email.empty() ? na->nc->email : "none") << ")"; delete na; - source.Reply(_("Nickname \002%s\002 has been dropped."), nick.c_str()); + source.Reply(_("\002{0}\002 has been dropped."), nick); } } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Drops the given nick from the database. Once your nickname\n" - "is dropped you may lose all of your access and channels that\n" - "you may own. Any other user will be able to gain control of\n" - "this nick.")); + source.Reply(_("Unregisters \037nickname\037. Once your nickname is dropped you may lose all of your access and channels that you may own. Any other user will be free to register \037nickname\037.")); if (!source.HasPriv("nickserv/drop")) - source.Reply(_("You may drop any nick within your group.")); + source.Reply(_("You may drop any nickname within your group.")); else source.Reply(_("As a Services Operator, you may drop any nick.")); diff --git a/modules/commands/ns_getemail.cpp b/modules/commands/ns_getemail.cpp index b926b6756..8288443c3 100644 --- a/modules/commands/ns_getemail.cpp +++ b/modules/commands/ns_getemail.cpp @@ -38,27 +38,19 @@ class CommandNSGetEMail : public Command if (!nc->email.empty() && nc->email.equals_ci(email)) { ++j; - source.Reply(_("Email matched: \002%s\002 to \002%s\002."), nc->display.c_str(), email.c_str()); + source.Reply(_("Email matched: \002{0}\002 to \002{1}\002."), nc->display, email); } } if (j <= 0) { - source.Reply(_("No nick registrations matching \002%s\002 found."), email.c_str()); - return; + source.Reply(_("There are no accounts with an email that matches \002{0}\002."), email); } - - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Returns the matching nicks that used given email. \002Note\002 that\n" - "you can not use wildcards. Whenever this command is used, a message\n" - "including the person who issued the command and the email it was used\n" - "on will be logged.")); + source.Reply(_("Returns the matching accounts whose email address is \037email\037.")); return true; } }; diff --git a/modules/commands/ns_getpass.cpp b/modules/commands/ns_getpass.cpp index 344947988..166dded78 100644 --- a/modules/commands/ns_getpass.cpp +++ b/modules/commands/ns_getpass.cpp @@ -17,7 +17,7 @@ class CommandNSGetPass : public Command CommandNSGetPass(Module *creator) : Command(creator, "nickserv/getpass", 1, 1) { this->SetDesc(_("Retrieve the password for a nickname")); - this->SetSyntax(_("\037nickname\037")); + this->SetSyntax(_("\037account\037")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -27,7 +27,7 @@ class CommandNSGetPass : public Command const NickServ::Nick *na; if (!(na = NickServ::FindNick(nick))) - source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), nick); else if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && na->nc->IsServicesOper()) source.Reply(_("You may not get the password of other Services Operators.")); else @@ -35,22 +35,16 @@ class CommandNSGetPass : public Command if (Anope::Decrypt(na->nc->pass, tmp_pass) == 1) { Log(LOG_ADMIN, source, this) << "for " << nick; - source.Reply(_("Password for %s is \002%s\002."), nick.c_str(), tmp_pass.c_str()); + source.Reply(_("Password of \002{0}\02 is \002%s\002."), nick, tmp_pass); } else - source.Reply(_("GETPASS command unavailable because encryption is in use.")); + source.Reply(_("The \002{0}\002 command is unavailable because encryption is in use."), source.command); } - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Returns the password for the given nickname. \002Note\002 that\n" - "whenever this command is used, a message including the\n" - "person who issued the command and the nickname it was used\n" - "on will be logged and sent out as a WALLOPS/GLOBOPS.")); + source.Reply(_("Returns the password for the given account. This command may not be available if password encryption is in use.")); return true; } }; diff --git a/modules/commands/ns_group.cpp b/modules/commands/ns_group.cpp index bc61ee099..62620f7c4 100644 --- a/modules/commands/ns_group.cpp +++ b/modules/commands/ns_group.cpp @@ -49,7 +49,7 @@ class NSGroupRequestListener : public NickServ::IdentifyRequestListener this->onnickgroup(&Event::NickGroup::OnNickGroup, u, target); 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()); + source.Reply(_("You are now in the group of \002{0}\002."), target->nick); u->lastnickreg = Anope::CurTime; @@ -61,7 +61,7 @@ class NSGroupRequestListener : public NickServ::IdentifyRequestListener return; Log(LOG_COMMAND, source, cmd) << "and failed to group to " << target->nick; - source.Reply(PASSWORD_INCORRECT); + source.Reply(_("Password incorrect.")); source.GetUser()->BadPassword(); } }; @@ -109,7 +109,7 @@ class CommandNSGroup : public Command if (!IRCD->IsNickValid(u->nick)) { - source.Reply(NICK_CANNOT_BE_REGISTERED, u->nick.c_str()); + source.Reply(_("\002{0}\002 may not be registered."), u->nick); return; } @@ -120,7 +120,7 @@ class CommandNSGroup : public Command if (!u->HasMode("OPER") && u->nick.find_ci(o->name) != Anope::string::npos) { - source.Reply(NICK_CANNOT_BE_REGISTERED, u->nick.c_str()); + source.Reply(_("\002{0}\002 may not be registered because it is too similar to an operator nick."), u->nick); return; } } @@ -130,27 +130,27 @@ class CommandNSGroup : public Command time_t reg_delay = Config->GetModule("nickserv")->Get<time_t>("regdelay"); unsigned maxaliases = Config->GetModule(this->owner)->Get<unsigned>("maxaliases"); if (!(target = NickServ::FindNick(nick))) - source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), nick); else if (Anope::CurTime < u->lastnickreg + reg_delay) - source.Reply(_("Please wait %d seconds before using the GROUP command again."), (reg_delay + u->lastnickreg) - Anope::CurTime); + source.Reply(_("Please wait \002{0}\002 seconds before using the \002{1}\002 command again."), (reg_delay + u->lastnickreg) - Anope::CurTime, source.command); else if (target->nc->HasExt("NS_SUSPENDED")) { - Log(LOG_COMMAND, source, this) << "and tried to group to SUSPENDED nick " << target->nick; - source.Reply(NICK_X_SUSPENDED, target->nick.c_str()); + Log(LOG_COMMAND, source, this) << "and tried to group to suspended nick " << target->nick; + source.Reply(_("\002{0}\002 is suspended."), target->nick); } else if (na && *target->nc == *na->nc) - source.Reply(_("You are already a member of the group of \002%s\002."), target->nick.c_str()); + source.Reply(_("You are already a member of the group of \002{0}\002."), target->nick); else if (na && na->nc != u->Account()) - source.Reply(NICK_IDENTIFY_REQUIRED); + source.Reply(_("\002{0}\002 is already registered."), na->nick); else if (na && Config->GetModule(this->owner)->Get<bool>("nogroupchange")) source.Reply(_("Your nick is already registered.")); else if (maxaliases && target->nc->aliases->size() >= maxaliases && !target->nc->IsServicesOper()) - source.Reply(_("There are too many nicks in your group.")); + source.Reply(_("There are too many nicknames in your group.")); else if (u->nick.length() <= guestnick.length() + 7 && u->nick.length() >= guestnick.length() + 1 && !u->nick.find_ci(guestnick) && !u->nick.substr(guestnick.length()).find_first_not_of("1234567890")) { - source.Reply(NICK_CANNOT_BE_REGISTERED, u->nick.c_str()); + source.Reply(_("\002{0}\002 may not be registered."), u->nick); } else { @@ -182,34 +182,13 @@ class CommandNSGroup : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("This command makes your nickname join the \037target\037 nickname's\n" - "group. \037password\037 is the password of the target nickname.\n" - " \n" - "Joining a group will allow you to share your configuration,\n" - "memos, and channel privileges with all the nicknames in the\n" - "group, and much more!\n" - " \n" - "A group exists as long as it is useful. This means that even\n" - "if a nick of the group is dropped, you won't lose the\n" - "shared things described above, as long as there is at\n" - "least one nick remaining in the group.\n" - " \n" - "You may be able to use this command even if you have not registered\n" - "your nick yet. If your nick is already registered, you'll\n" - "need to identify yourself before using this command.\n" - " \n" - "It is recommended to use this command with a non-registered\n" - "nick because it will be registered automatically when\n" - "using this command. You may use it with a registered nick (to\n" - "change your group) only if your network administrators allowed\n" - "it.\n" - " \n" - "You can only be in one group at a time. Group merging is\n" - "not possible.\n" - " \n" - "\037Note\037: all the nicknames of a group have the same password.")); + source.Reply(_("This command makes your nickname join the \037target\037 nickname's group." + " \037password\037 is the password of the target nickname.\n" + "\n" + "Nicknames in the same group share channel privileges, memos, and most settings, including password." + "\n" + "You may be able to use this command even if you have not registered your nick yet." + " If your nick is already registered, you'll need to identify yourself before using this command.")); return true; } }; @@ -220,7 +199,7 @@ class CommandNSUngroup : public Command CommandNSUngroup(Module *creator) : Command(creator, "nickserv/ungroup", 0, 1) { this->SetDesc(_("Remove a nick from a group")); - this->SetSyntax(_("[\037nick\037]")); + this->SetSyntax(_("[\037nickname\037]")); this->RequireUser(true); } @@ -231,11 +210,11 @@ class CommandNSUngroup : public Command NickServ::Nick *na = NickServ::FindNick(!nick.empty() ? nick : u->nick); if (u->Account()->aliases->size() == 1) - source.Reply(_("Your nick is not grouped to anything, you can't ungroup it.")); + source.Reply(_("Your nickname is not grouped to anything, so you can't ungroup it.")); else if (!na) - source.Reply(NICK_X_NOT_REGISTERED, !nick.empty() ? nick.c_str() : u->nick.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), !nick.empty() ? nick : u->nick); else if (na->nc != u->Account()) - source.Reply(_("Nick %s is not in your group."), na->nick.c_str()); + source.Reply(_("\002{0}\002 is not in your group."), na->nick); else { NickServ::Account *oldcore = na->nc; @@ -256,7 +235,7 @@ class CommandNSUngroup : public Command nc->email = oldcore->email; nc->language = oldcore->language; - source.Reply(_("Nick %s has been ungrouped from %s."), na->nick.c_str(), oldcore->display.c_str()); + source.Reply(_("\002{0}\002 has been ungrouped from \002{1}\002."), na->nick, oldcore->display); User *user = User::Find(na->nick); if (user) @@ -267,13 +246,9 @@ class CommandNSUngroup : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("This command ungroups your nick, or if given, the specificed nick,\n" - "from the group it is in. The ungrouped nick keeps its registration\n" - "time, password, email, greet, language, and url. Everything else\n" - "is reset. You may not ungroup yourself if there is only one nick in\n" - "your group.")); + source.Reply(_("This command ungroups your nickname, or if given, the specificed \037nickname\037, from the group it is in." + " The ungrouped nick keeps its registration time, password, email, and language. Everything else is reset." + " You may not ungroup yourself if there is only one nickname in your group.")); return true; } }; @@ -291,17 +266,12 @@ class CommandNSGList : public Command const Anope::string &nick = !params.empty() ? params[0] : ""; const NickServ::Account *nc; - if (!nick.empty()) + if (!nick.empty() && source.IsServicesOper()) { const NickServ::Nick *na = NickServ::FindNick(nick); if (!na) { - source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); - return; - } - else if (na->nc != source.GetAccount() && !source.IsServicesOper()) - { - source.Reply(ACCESS_DENIED); + source.Reply(_("\002{0}\002 isn't registered."), nick); return; } @@ -334,7 +304,7 @@ class CommandNSGList : public Command list.AddEntry(entry); } - source.Reply(!nick.empty() ? _("List of nicknames in the group of \002%s\002:") : _("List of nicknames in your group:"), nc->display.c_str()); + source.Reply(nc != source.GetAccount() ? _("List of nicknames in the group of \002%s\002:") : _("List of nicknames in your group:"), nc->display.c_str()); std::vector<Anope::string> replies; list.Process(replies); @@ -347,19 +317,13 @@ class CommandNSGList : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { if (source.IsServicesOper()) - source.Reply(_("Syntax: \002%s [\037nickname\037]\002\n" - " \n" - "Without a parameter, lists all nicknames that are in\n" - "your group.\n" - " \n" - "With a parameter, lists all nicknames that are in the\n" - "group of the given nick.\n" + source.Reply(_("Without a parameter, lists all nicknames that are in your group.\n" + "\n" + "With a parameter, lists all nicknames that are in the group of the given nick.\n" "Specifying a nick is limited to \002Services Operators\002."), - source.command.c_str()); + source.command); else - source.Reply(_("Syntax: \002%s\002\n" - " \n" - "Lists all nicks in your group."), source.command.c_str()); + source.Reply(_("Lists all nicknames in your group.")); return true; } diff --git a/modules/commands/ns_identify.cpp b/modules/commands/ns_identify.cpp index 03c79c623..07616635e 100644 --- a/modules/commands/ns_identify.cpp +++ b/modules/commands/ns_identify.cpp @@ -28,14 +28,14 @@ class NSIdentifyRequestListener : public NickServ::IdentifyRequestListener NickServ::Nick *na = NickServ::FindNick(req->GetAccount()); if (!na) - source.Reply(NICK_X_NOT_REGISTERED, req->GetAccount().c_str()); + source.Reply(_("\002{0}\002 isn't registered."), req->GetAccount()); else { if (u->IsIdentified()) Log(LOG_COMMAND, source, cmd) << "to log out of account " << u->Account()->display; Log(LOG_COMMAND, source, cmd) << "and identified for account " << na->nc->display; - source.Reply(_("Password accepted - you are now recognized.")); + source.Reply(_("Password accepted - you are now recognized as \002{0}\002."), na->nc->display); u->Identify(na); } } @@ -48,11 +48,11 @@ class NSIdentifyRequestListener : public NickServ::IdentifyRequestListener Log(LOG_COMMAND, source, cmd) << "and failed to identify to" << (accountexists ? " " : " nonexistent ") << "account " << req->GetAccount(); if (accountexists) { - source.Reply(PASSWORD_INCORRECT); + source.Reply(_("Password incorrect.")); source.GetUser()->BadPassword(); } else - source.Reply(NICK_X_NOT_REGISTERED, req->GetAccount().c_str()); + source.Reply("\002{0}\002 isn't registered.", req->GetAccount()); } } }; @@ -77,7 +77,7 @@ class CommandNSIdentify : public Command NickServ::Nick *na = NickServ::FindNick(nick); if (na && na->nc->HasExt("NS_SUSPENDED")) - source.Reply(NICK_X_SUSPENDED, na->nick.c_str()); + source.Reply(_("\002{0}\002 is suspended."), na->nick); else if (u->Account() && na && u->Account() == na->nc) source.Reply(_("You are already identified.")); else @@ -86,18 +86,12 @@ class CommandNSIdentify : public Command Event::OnCheckAuthentication(&Event::CheckAuthentication::OnCheckAuthentication, u, req); req->Dispatch(); } - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Tells %s that you are really the owner of this\n" - "nick. Many commands require you to authenticate yourself\n" - "with this command before you use them. The password\n" - "should be the same one you sent with the \002REGISTER\002\n" - "command."), source.service->nick.c_str()); + source.Reply(_("Logs you in to account \037account\037. If no \037account\037 is given, your current nickname is used." + " Many commands require you to authenticate with this command before you use them. \037password\037 should be the same one you registered with.")); return true; } }; diff --git a/modules/commands/ns_info.cpp b/modules/commands/ns_info.cpp index 5bf413591..a5bf571fc 100644 --- a/modules/commands/ns_info.cpp +++ b/modules/commands/ns_info.cpp @@ -35,9 +35,9 @@ class CommandNSInfo : public Command if (!na) { if (BotInfo::Find(nick, true)) - source.Reply(_("Nick \002%s\002 is part of this Network's Services."), nick.c_str()); + source.Reply(_("\002{0}\002 is part of this Network's Services."), nick); else - source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), nick); } else { @@ -54,13 +54,13 @@ class CommandNSInfo : public Command if (has_auspex || na->nc == source.GetAccount()) show_hidden = true; - source.Reply(_("%s is %s"), na->nick.c_str(), na->last_realname.c_str()); + source.Reply(_("\002{0}\002 is \002{1}\002"), na->nick, na->last_realname); if (na->nc->HasExt("UNCONFIRMED")) - source.Reply(_("%s is an unconfirmed nickname."), na->nick.c_str()); + source.Reply(_("\002{0}\002 has not confirmed their account."), na->nick); if (na->nc->IsServicesOper() && (show_hidden || !na->nc->HasExt("HIDE_STATUS"))) - source.Reply(_("%s is a Services Operator of type %s."), na->nick.c_str(), na->nc->o->ot->GetName().c_str()); + source.Reply(_("\002{0}\002 is a Services Operator of type \002{0}\002."), na->nick, na->nc->o->ot->GetName()); InfoFormatter info(source.nc); @@ -71,7 +71,7 @@ class CommandNSInfo : public Command if (show_hidden || !na->nc->HasExt("HIDE_MASK")) info[_("Online from")] = na->last_usermask; else - source.Reply(_("%s is currently online."), na->nick.c_str()); + source.Reply(_("\002{0}\002 is currently online."), na->nick); } else { @@ -146,14 +146,14 @@ class CommandNSSetHide : public Command { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } const NickServ::Nick *na = NickServ::FindNick(user); if (!na) { - source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), user); return; } NickServ::Account *nc = na->nc; @@ -162,31 +162,31 @@ class CommandNSSetHide : public Command if (MOD_RESULT == EVENT_STOP) return; - Anope::string onmsg, offmsg, flag; + const char *onmsg, *offmsg, *flag; if (param.equals_ci("EMAIL")) { flag = "HIDE_EMAIL"; - onmsg = _("The E-mail address of \002%s\002 will now be hidden from %s INFO displays."); - offmsg = _("The E-mail address of \002%s\002 will now be shown in %s INFO displays."); + onmsg = _("The \002e-mail address\002 of \002{0}\002 will now be \002hidden\002."); + offmsg = _("The \002e-mail address\002 of \002{0}\002 will now be \002shown\002."); } else if (param.equals_ci("USERMASK")) { flag = "HIDE_MASK"; - onmsg = _("The last seen user@host mask of \002%s\002 will now be hidden from %s INFO displays."); - offmsg = _("The last seen user@host mask of \002%s\002 will now be shown in %s INFO displays."); + onmsg = _("The \002last seen host mask\002 of \002{0}\002 will now be \002hidden\002."); + offmsg = _("The \002last seen host mask\002 of \002{0}\002 will now be \002shown\002."); } else if (param.equals_ci("STATUS")) { flag = "HIDE_STATUS"; - onmsg = _("The services access status of \002%s\002 will now be hidden from %s INFO displays."); - offmsg = _("The services access status of \002%s\002 will now be shown in %s INFO displays."); + onmsg = _("The \002services operator status\002 of \002{0}\002 will now be \002hidden\002."); + offmsg = _("The \002services operator status\002 of \002{0}\002 will now be \002shown\002."); } else if (param.equals_ci("QUIT")) { flag = "HIDE_QUIT"; - onmsg = _("The last quit message of \002%s\002 will now be hidden from %s INFO displays."); - offmsg = _("The last quit message of \002%s\002 will now be shown in %s INFO displays."); + onmsg = _("The \002last quit message\002 of \002{0}\002 will now be \002hidden\002."); + offmsg = _("The \002last quit message\002 of \002{0}\002 will now be \002shown\002."); } else { @@ -198,13 +198,13 @@ class CommandNSSetHide : public Command { 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()); + source.Reply(onmsg, nc->display, 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->display; nc->Shrink<bool>(flag); - source.Reply(offmsg.c_str(), nc->display.c_str(), source.service->nick.c_str()); + source.Reply(offmsg, nc->display, source.service->nick); } else this->OnSyntaxError(source, "HIDE"); @@ -217,15 +217,10 @@ class CommandNSSetHide : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Allows you to prevent certain pieces of information from\n" - "being displayed when someone does a %s \002INFO\002 on your\n" - "nick. You can hide your E-mail address (\002EMAIL\002), last seen\n" - "user@host mask (\002USERMASK\002), your services access status\n" - "(\002STATUS\002) and last quit message (\002QUIT\002).\n" + source.Reply(_("Allows you to prevent certain pieces of information from being displayed when someone does a %s \002INFO\002 on you." //XXX + " You can hide the e-mail address (\002EMAIL\002), last seen hostmask (\002USERMASK\002), the services access status (\002STATUS\002) and last quit message (\002QUIT\002)." "The second parameter specifies whether the information should\n" - "be displayed (\002OFF\002) or hidden (\002ON\002)."), source.service->nick.c_str()); + "be displayed (\002OFF\002) or hidden (\002ON\002)."), source.service->nick); return true; } }; @@ -246,15 +241,10 @@ class CommandNSSASetHide : public CommandNSSetHide bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Allows you to prevent certain pieces of information from\n" - "being displayed when someone does a %s \002INFO\002 on the\n" - "nick. You can hide the E-mail address (\002EMAIL\002), last seen\n" - "user@host mask (\002USERMASK\002), the services access status\n" - "(\002STATUS\002) and last quit message (\002QUIT\002).\n" - "The second parameter specifies whether the information should\n" - "be displayed (\002OFF\002) or hidden (\002ON\002)."), source.service->nick.c_str()); + source.Reply(_("Allows you to prevent certain pieces of information from being displayed when someone does a %s \002INFO\002 on the \037nickname\037. " + " You can hide the e-mail address (\002EMAIL\002), last seen hostmask (\002USERMASK\002), the services access status (\002STATUS\002) and last quit message (\002QUIT\002)." + " The second parameter specifies whether the information should be displayed (\002OFF\002) or hidden (\002ON\002)."), + source.service->nick); return true; } }; diff --git a/modules/commands/ns_list.cpp b/modules/commands/ns_list.cpp index 78daff7ef..0ad8d751b 100644 --- a/modules/commands/ns_list.cpp +++ b/modules/commands/ns_list.cpp @@ -47,7 +47,7 @@ class CommandNSList : public Command } catch (const ConvertException &) { - source.Reply(LIST_INCORRECT_RANGE); + source.Reply(_("Incorrect range specified. The correct syntax is \002#\037from\037-\037to\037\002.")); return; } @@ -122,7 +122,7 @@ class CommandNSList : public Command } } - source.Reply(_("List of entries matching \002%s\002:"), pattern.c_str()); + source.Reply(_("List of entries matching \002{0}\002:"), pattern); std::vector<Anope::string> replies; list.Process(replies); @@ -130,49 +130,43 @@ class CommandNSList : public Command for (unsigned i = 0; i < replies.size(); ++i) source.Reply(replies[i]); - source.Reply(_("End of list - %d/%d matches shown."), nnicks > listmax ? listmax : nnicks, nnicks); + source.Reply(_("End of list - \002{0}\002/\002{1}\002 matches shown."), nnicks > listmax ? listmax : nnicks, nnicks); return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Lists all registered nicknames which match the given\n" - "pattern, in \037nick!user@host\037 format. Nicks with the \002PRIVATE\002\n" - "option set will only be displayed to Services Operators with the\n" - "proper access. Nicks with the \002NOEXPIRE\002 option set will have\n" - "a \002!\002 prefixed to the nickname for Services Operators to see.\n" - " \n" - "Note that a preceding '#' specifies a range.\n" - " \n" - "If the SUSPENDED, UNCONFIRMED or NOEXPIRE options are given, only\n" - "nicks which, respectively, are SUSPENDED, UNCONFIRMED or have the\n" - "NOEXPIRE flag set will be displayed. If multiple options are\n" - "given, all nicks matching at least one option will be displayed.\n" - "Note that these options are limited to \037Services Operators\037.\n" - " \n" - "Examples:\n" - " \n" - " \002LIST *!joeuser@foo.com\002\n" - " Lists all registered nicks owned by joeuser@foo.com.\n" - " \n" - " \002LIST *Bot*!*@*\002\n" - " Lists all registered nicks with \002Bot\002 in their\n" - " names (case insensitive).\n" - " \n" - " \002LIST * NOEXPIRE\002\n" - " Lists all registered nicks which have been set to not expire.\n" - " \n" - " \002LIST #51-100\002\n" - " Lists all registered nicks within the given range (51-100).")); + source.Reply(_("Lists all registered nicknames which match the given pattern, in \037nick!user@host\037 format." + " Nicks with the \002PRIVATE\002 option set will only be displayed to Services Operators with the proper access." + " Nicks with the \002NOEXPIRE\002 option set will have a \002!\002 prefixed to the nickname for Services Operators to see.\n" + "\n" + "Note that a preceding '#' specifies a range.\n" + "\n" + "If the SUSPENDED, UNCONFIRMED or NOEXPIRE options are given, only\n" + "nicks which, respectively, are SUSPENDED, UNCONFIRMED or have the\n" + "NOEXPIRE flag set will be displayed. If multiple options are\n" + "given, all nicks matching at least one option will be displayed.\n" + "Note that these options are limited to \037Services Operators\037.\n" + "\n" + "Examples:\n" + "\n" + " {0} *!joeuser@foo.com\n" + " Lists all registered nicks owned by joeuser@foo.com.\n" + "\n" + " {0} *Bot*!*@*\n" + " Lists all registered nicks with \002Bot\002 in their names (case insensitive).\n" + "\n" + " {0} * NOEXPIRE\n" + " Lists all registered nicks which have been set to not expire.\n" + "\n" + " {0} #51-100\n" + " Lists all registered nicks within the given range (51-100).")); const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine"); if (!regexengine.empty()) { source.Reply(" "); - source.Reply(_("Regex matches are also supported using the %s engine.\n" - "Enclose your pattern in // if this is desired."), regexengine.c_str()); + source.Reply(_("Regex matches are also supported using the {0} engine. Enclose your pattern in // if this is desired."), regexengine); } return true; @@ -185,7 +179,7 @@ class CommandNSSetPrivate : public Command public: CommandNSSetPrivate(Module *creator, const Anope::string &sname = "nickserv/set/private", size_t min = 1) : Command(creator, sname, min, min + 1) { - this->SetDesc(_("Prevent the nickname from appearing in the LIST command")); + this->SetDesc(_("Prevent your account from appearing in the LIST command")); this->SetSyntax("{ON | OFF}"); } @@ -193,14 +187,14 @@ class CommandNSSetPrivate : public Command { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } const NickServ::Nick *na = NickServ::FindNick(user); if (!na) { - source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), user); return; } NickServ::Account *nc = na->nc; @@ -213,13 +207,13 @@ class CommandNSSetPrivate : public Command { Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable private for " << nc->display; nc->Extend<bool>("NS_PRIVATE"); - source.Reply(_("Private option is now \002on\002 for \002%s\002."), nc->display.c_str()); + source.Reply(_("Private option is now \002on\002 for \002{0}\002."), nc->display); } else if (param.equals_ci("OFF")) { Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable private for " << nc->display; nc->Shrink<bool>("NS_PRIVATE"); - source.Reply(_("Private option is now \002off\002 for \002%s\002."), nc->display.c_str()); + source.Reply(_("Private option is now \002off\002 for \002{0}\002."), nc->display); } else this->OnSyntaxError(source, "PRIVATE"); @@ -232,14 +226,9 @@ class CommandNSSetPrivate : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Turns %s's privacy option on or off for your nick.\n" - "With \002PRIVATE\002 set, your nickname will not appear in\n" - "nickname lists generated with %s's \002LIST\002 command.\n" - "(However, anyone who knows your nickname can still get\n" - "information on it using the \002INFO\002 command.)"), - source.service->nick.c_str(), source.service->nick.c_str()); + source.Reply(_("Turns the privacy option on or off for your account." + " When \002PRIVATE\002 is set, your account will not appear in the account list." + " However, anyone who knows your account can still request information about it.")); return true; } }; @@ -250,7 +239,7 @@ class CommandNSSASetPrivate : public CommandNSSetPrivate CommandNSSASetPrivate(Module *creator) : CommandNSSetPrivate(creator, "nickserv/saset/private", 2) { this->ClearSyntax(); - this->SetSyntax(_("\037nickname\037 {ON | OFF}")); + this->SetSyntax(_("\037account\037 {ON | OFF}")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -260,14 +249,9 @@ class CommandNSSASetPrivate : public CommandNSSetPrivate bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Turns %s's privacy option on or off for the nick.\n" - "With \002PRIVATE\002 set, the nickname will not appear in\n" - "nickname lists generated with %s's \002LIST\002 command.\n" - "(However, anyone who knows the nickname can still get\n" - "information on it using the \002INFO\002 command.)"), - source.service->nick.c_str(), source.service->nick.c_str()); + source.Reply(_("Turns the privacy option on or off for \037account\037." + " When \002PRIVATE\002 is set, the account will not appear in the account list." + " However, anyone who knows your account can still request information about it.")); return true; } }; diff --git a/modules/commands/ns_logout.cpp b/modules/commands/ns_logout.cpp index a23fd26d2..70f2171af 100644 --- a/modules/commands/ns_logout.cpp +++ b/modules/commands/ns_logout.cpp @@ -31,9 +31,9 @@ class CommandNSLogout : public Command if (!source.IsServicesOper() && !nick.empty()) this->OnSyntaxError(source, ""); else if (!(u2 = (!nick.empty() ? User::Find(nick, true) : source.GetUser()))) - source.Reply(NICK_X_NOT_IN_USE, !nick.empty() ? nick.c_str() : source.GetNick().c_str()); + source.Reply(_("\002{0}\002 isn't currently online."), !nick.empty() ? nick : source.GetNick()); else if (!nick.empty() && u2->IsServicesOper()) - source.Reply(_("You can't logout %s, they are a Services Operator."), nick.c_str()); + source.Reply(_("You can't logout \002{0}\002, they are a Services Operator."), nick); else { if (!nick.empty() && !param.empty() && param.equals_ci("REVALIDATE") && NickServ::service) @@ -42,11 +42,10 @@ class CommandNSLogout : public Command u2->super_admin = false; /* Dont let people logout and remain a SuperAdmin */ Log(LOG_COMMAND, source, this) << "to logout " << u2->nick; - /* Remove founder status from this user in all channels */ if (!nick.empty()) - source.Reply(_("Nick %s has been logged out."), nick.c_str()); + source.Reply(_("\002{0}\002 has been logged out."), nick); else - source.Reply(_("Your nick has been logged out.")); + source.Reply(_("You have been logged out.")); IRCD->SendLogout(u2); u2->RemoveMode(source.service, "REGISTERED"); @@ -55,13 +54,12 @@ class CommandNSLogout : public Command /* Send out an event */ Event::OnNickLogout(&Event::NickLogout::OnNickLogout, u2); } - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); + source.Reply(_("Logs you out of your account")); + #if 0 source.Reply(_("Without a parameter, reverses the effect of the \002IDENTIFY\002\n" "command, i.e. make you not recognized as the real owner of the nick\n" "anymore. Note, however, that you won't be asked to reidentify\n" @@ -70,6 +68,7 @@ class CommandNSLogout : public Command "With a parameter, does the same for the given nick. If you\n" "specify \002REVALIDATE\002 as well, Services will ask the given nick\n" "to re-identify. This is limited to \002Services Operators\002.")); + #endif return true; } diff --git a/modules/commands/ns_recover.cpp b/modules/commands/ns_recover.cpp index 3307c6668..7d0637c60 100644 --- a/modules/commands/ns_recover.cpp +++ b/modules/commands/ns_recover.cpp @@ -41,7 +41,7 @@ class NSRecoverRequestListener : public NickServ::IdentifyRequestListener if (na->HasExt("HELD")) { NickServ::service->Release(na); - source.Reply(_("Service's hold on \002%s\002 has been released."), na->nick.c_str()); + source.Reply(_("Service's hold on \002{0}\002 has been released."), na->nick); } else if (!u) { @@ -67,9 +67,8 @@ class NSRecoverRequestListener : public NickServ::IdentifyRequestListener } } - u->SendMessage(*source.service, _("This nickname has been recovered by %s. If you did not do\n" - "this then %s may have your password, and you should change it."), - source.GetNick().c_str(), source.GetNick().c_str()); + u->SendMessage(*source.service, _("This nickname has been recovered by \002{0}\002. If you did not do this, then \002{0}\002 may have your password, and you should change it."), + source.GetNick()); Anope::string buf = source.command.upper() + " command used by " + source.GetNick(); u->Kill(source.service->nick, buf); @@ -88,7 +87,7 @@ class NSRecoverRequestListener : public NickServ::IdentifyRequestListener Log(LOG_COMMAND, source, cmd) << "and was automatically identified to " << na->nick << " (" << na->nc->display << ")"; } - u->SendMessage(*source.service, _("This nickname has been recovered by %s."), source.GetNick().c_str()); + u->SendMessage(*source.service, _("This nickname has been recovered by \002{0}\002."), source.GetNick()); if (NickServ::service) NickServ::service->Collide(u, na); @@ -99,8 +98,7 @@ class NSRecoverRequestListener : public NickServ::IdentifyRequestListener IRCD->SendForceNickChange(source.GetUser(), user, Anope::CurTime); } else - source.Reply(_("The user with your nick has been removed. Use this command again\n" - "to release services's hold on your nick.")); + source.Reply(_("The user with your nick has been removed. Use this command again to release services's hold on your nick.")); } } @@ -108,7 +106,7 @@ class NSRecoverRequestListener : public NickServ::IdentifyRequestListener { if (NickServ::FindNick(user) != NULL) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied.")); if (!pass.empty()) { Log(LOG_COMMAND, source, cmd) << "with an invalid password for " << user; @@ -117,7 +115,7 @@ class NSRecoverRequestListener : public NickServ::IdentifyRequestListener } } else - source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), user); } }; @@ -148,12 +146,13 @@ class CommandNSRecover : public Command if (!na) { - source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), nick); return; } - else if (na->nc->HasExt("NS_SUSPENDED")) + + if (na->nc->HasExt("NS_SUSPENDED")) { - source.Reply(NICK_X_SUSPENDED, na->nick.c_str()); + source.Reply(_("\002{0}\002 is suspended."), na->nick); return; } @@ -186,14 +185,10 @@ class CommandNSRecover : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Recovers your nick from another user or from services.\n" - "If services are currently holding your nick, the hold\n" - "will be released. If another user is holding your nick\n" - "and is identified they will be killed (similar to the old\n" - "GHOST command). If they are not identified they will be\n" - "forced off of the nick.")); + source.Reply(_("Recovers your nickname from another user or from services." + "If services are currently holding your nickname, the hold will be released." + " If another user is holding your nickname and is identified they will be killed." + " If they are not identified they will be forced off of the nickname.")); return true; } }; diff --git a/modules/commands/ns_register.cpp b/modules/commands/ns_register.cpp index 590ced8dc..1aa0595d4 100644 --- a/modules/commands/ns_register.cpp +++ b/modules/commands/ns_register.cpp @@ -32,14 +32,14 @@ class CommandNSConfirm : public Command { NickServ::Nick *na = NickServ::FindNick(passcode); if (na == NULL) - source.Reply(NICK_X_NOT_REGISTERED, passcode.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), passcode); else if (na->nc->HasExt("UNCONFIRMED") == false) - source.Reply(_("Nick \002%s\002 is already confirmed."), na->nick.c_str()); + source.Reply(_("\002{0}\002 is already confirmed."), na->nick); else { na->nc->Shrink<bool>("UNCONFIRMED"); Log(LOG_ADMIN, source, this) << "to confirm nick " << na->nick << " (" << na->nc->display << ")"; - source.Reply(_("Nick \002%s\002 has been confirmed."), na->nick.c_str()); + source.Reply(_("\002{0}\002 has been confirmed."), na->nick); } } else if (source.nc) @@ -50,7 +50,7 @@ class CommandNSConfirm : public Command NickServ::Account *nc = source.nc; nc->Shrink<Anope::string>("passcode"); Log(LOG_COMMAND, source, this) << "to confirm their email"; - source.Reply(_("Your email address of \002%s\002 has been confirmed."), source.nc->email.c_str()); + source.Reply(_("Your email address of \002{0}\002 has been confirmed."), source.nc->email); nc->Shrink<bool>("UNCONFIRMED"); if (source.GetUser()) @@ -75,26 +75,16 @@ class CommandNSConfirm : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("This command is used by several commands as a way to confirm\n" - "changes made to your account.\n" - " \n" - "This is most commonly used to confirm your email address once\n" - "you register or change it.\n" - " \n" - "This is also used after the RESETPASS command has been used to\n" - "force identify you to your nick so you may change your password.")); + source.Reply(_("This command is used by several commands as a way to confirm changes made to your account.\n" + "\n" + "This is most commonly used to confirm your email address once you register or change it.\n" + "\n" + "This is also used after when resetting your password to force identify you to your account so you may change your password.")); if (source.HasPriv("nickserv/confirm")) source.Reply(_("Additionally, Services Operators with the \037nickserv/confirm\037 permission can\n" "replace \037passcode\037 with a users nick to force validate them.")); return true; } - - void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) override - { - source.Reply(NICK_CONFIRM_INVALID); - } }; class CommandNSRegister : public Command @@ -147,13 +137,13 @@ class CommandNSRegister : public Command const Anope::string &guestnick = Config->GetModule("nickserv")->Get<const Anope::string>("guestnickprefix", "Guest"); if (nicklen <= guestnick.length() + 7 && nicklen >= guestnick.length() + 1 && !u_nick.find_ci(guestnick) && u_nick.substr(guestnick.length()).find_first_not_of("1234567890") == Anope::string::npos) { - source.Reply(NICK_CANNOT_BE_REGISTERED, u_nick.c_str()); + source.Reply(_("\002{0}\002 may not be registered."), u_nick); return; } if (!IRCD->IsNickValid(u_nick)) { - source.Reply(NICK_CANNOT_BE_REGISTERED, u_nick.c_str()); + source.Reply(_("\002{0}\002 may not be registered."), u_nick); return; } @@ -164,7 +154,7 @@ class CommandNSRegister : public Command if (!source.IsOper() && u_nick.find_ci(o->name) != Anope::string::npos) { - source.Reply(NICK_CANNOT_BE_REGISTERED, u_nick.c_str()); + source.Reply(_("\002{0}\002 may not be registered."), u_nick); return; } } @@ -172,15 +162,16 @@ class CommandNSRegister : public Command if (Config->GetModule("nickserv")->Get<bool>("forceemail", "yes") && email.empty()) this->OnSyntaxError(source, ""); else if (u && Anope::CurTime < u->lastnickreg + reg_delay) - source.Reply(_("Please wait %d seconds before using the REGISTER command again."), (u->lastnickreg + reg_delay) - Anope::CurTime); + source.Reply(_("Please wait \002{0}\002 seconds before using the {1} command again."), (u->lastnickreg + reg_delay) - Anope::CurTime, source.command); else if (NickServ::FindNick(u_nick) != NULL) - source.Reply(NICK_ALREADY_REGISTERED, u_nick.c_str()); + source.Reply(_("\002{0}\002 is already registered."), u_nick); else if (pass.equals_ci(u_nick) || (Config->GetBlock("options")->Get<bool>("strictpasswords") && pass.length() < 5)) - source.Reply(MORE_OBSCURE_PASSWORD); + source.Reply(_("Please try again with a more obscure password. Passwords should be at least five characters long, should not be something easily guessed" + " (e.g. your real name or your nickname), and cannot contain the space or tab characters.")); else if (pass.length() > Config->GetModule("nickserv")->Get<unsigned>("passlen", "32")) - source.Reply(PASSWORD_TOO_LONG); + source.Reply(_("Your password is too long, it can not contain more than \002{0}\002 characters."), Config->GetModule("nickserv")->Get<unsigned>("passlen", "32")); else if (!email.empty() && !Mail::Validate(email)) - source.Reply(MAIL_X_INVALID, email.c_str()); + source.Reply(_("\002{0}\002 is not a valid e-mail address."), email); else { NickServ::Account *nc = NickServ::service->CreateAccount(u_nick); @@ -203,13 +194,13 @@ class CommandNSRegister : public Command NickServ::Event::OnNickRegister(&NickServ::Event::NickRegister::OnNickRegister, source.GetUser(), na); if (na->nc->GetAccessCount()) - source.Reply(_("Nickname \002%s\002 registered under your user@host-mask: %s"), u_nick.c_str(), na->nc->GetAccess(0).c_str()); + source.Reply(_("\002{0}\002 has been registered under your hostmask: \002{1}\002"), u_nick, na->nc->GetAccess(0)); else - source.Reply(_("Nickname \002%s\002 registered."), u_nick.c_str()); + source.Reply(_("\002{0}\002 has been registered."), u_nick); Anope::string tmp_pass; if (Anope::Decrypt(na->nc->pass, tmp_pass) == 1) - source.Reply(_("Your password is \002%s\002 - remember this for later use."), tmp_pass.c_str()); + source.Reply(_("Your password is \002{0}\002 - remember this for later use."), tmp_pass); if (nsregister.equals_ci("admin")) { @@ -235,26 +226,8 @@ class CommandNSRegister : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Registers your nickname in the %s database. Once\n" - "your nick is registered, you can use the \002SET\002 and \002ACCESS\002\n" - "commands to configure your nick's settings as you like\n" - "them. Make sure you remember the password you use when\n" - "registering - you'll need it to make changes to your nick\n" - "later. (Note that \002case matters!\002 \037ANOPE\037, \037Anope\037, and\n" - "\037anope\037 are all different passwords!)\n" - " \n" - "Guidelines on choosing passwords:\n" - " \n" - "Passwords should not be easily guessable. For example,\n" - "using your real name as a password is a bad idea. Using\n" - "your nickname as a password is a much worse idea ;) and,\n" - "in fact, %s will not allow it. Also, short\n" - "passwords are vulnerable to trial-and-error searches, so\n" - "you should choose a password at least 5 characters long.\n" - "Finally, the space character cannot be used in passwords."), - source.service->nick.c_str(), source.service->nick.c_str()); + source.Reply(_("Registers your nickname. Once your nickname is registered, you will be able to use most features of services, including owning and managing channels." + "Make sure you remember the password - you'll need it to identify yourself later. Your email address will only be used if you forget your password.")); if (!Config->GetModule("nickserv")->Get<bool>("forceemail", "yes")) { @@ -266,11 +239,11 @@ class CommandNSRegister : public Command "after registering if it isn't the default setting already.")); } - source.Reply(" "); - source.Reply(_("This command also creates a new group for your nickname,\n" - "that will allow you to register other nicks later sharing\n" - "the same configuration, the same set of memos and the\n" - "same channel privileges.")); + if (!Config->GetModule("nickserv")->Get<bool>("nonicknameownership")) + { + source.Reply(" "); + source.Reply(_("This command also creates a new group for your nickname, which will allow you to group other nicknames later, which share the same configuration, the same set of memos and the same channel privileges.")); + } return true; } }; @@ -287,14 +260,14 @@ class CommandNSResend : public Command { if (!Config->GetModule(this->owner)->Get<const Anope::string>("registration").equals_ci("mail")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied.")); return; } const NickServ::Nick *na = NickServ::FindNick(source.GetNick()); if (na == NULL) - source.Reply(NICK_NOT_REGISTERED); + source.Reply(_("Your nickname isn't registered.")); else if (na->nc != source.GetAccount() || !source.nc->HasExt("UNCONFIRMED")) source.Reply(_("Your account is already confirmed.")); else @@ -304,14 +277,12 @@ class CommandNSResend : public Command else if (SendRegmail(source.GetUser(), na, source.service)) { na->nc->lastmail = Anope::CurTime; - source.Reply(_("Your passcode has been re-sent to %s."), na->nc->email.c_str()); + source.Reply(_("Your passcode has been re-sent to \002{0}\002."), na->nc->email); Log(LOG_COMMAND, source, this) << "to resend registration verification code"; } else Log(this->owner) << "Unable to resend registration verification code for " << source.GetNick(); } - - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override @@ -319,8 +290,6 @@ class CommandNSResend : public Command if (!Config->GetModule(this->owner)->Get<const Anope::string>("registration").equals_ci("mail")) return false; - this->SendSyntax(source); - source.Reply(" "); source.Reply(_("This command will resend you the registration confirmation email.")); return true; } diff --git a/modules/commands/ns_resetpass.cpp b/modules/commands/ns_resetpass.cpp index d4171807d..848fcc337 100644 --- a/modules/commands/ns_resetpass.cpp +++ b/modules/commands/ns_resetpass.cpp @@ -19,7 +19,7 @@ class CommandNSResetPass : public Command CommandNSResetPass(Module *creator) : Command(creator, "nickserv/resetpass", 2, 2) { this->SetDesc(_("Helps you reset lost passwords")); - this->SetSyntax(_("\037nickname\037 \037email\037")); + this->SetSyntax(_("\037account\037 \037email\037")); this->AllowUnregistered(true); } @@ -28,7 +28,7 @@ class CommandNSResetPass : public Command const NickServ::Nick *na; if (!(na = NickServ::FindNick(params[0]))) - source.Reply(NICK_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("\002{0}\002 isn't registered."), params[0]); else if (!na->nc->email.equals_ci(params[1])) source.Reply(_("Incorrect email address.")); else @@ -36,20 +36,14 @@ class CommandNSResetPass : public Command if (SendResetEmail(source.GetUser(), na, source.service)) { Log(LOG_COMMAND, source, this) << "for " << na->nick << " (group: " << na->nc->display << ")"; - source.Reply(_("Password reset email for \002%s\002 has been sent."), na->nick.c_str()); + source.Reply(_("Password reset email for \002{0}\002 has been sent."), na->nick); } } - - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Sends a passcode to the nickname with instructions on how to\n" - "reset their password. Email must be the email address associated\n" - "to the nickname.")); + source.Reply(_("Sends a passcode to the email address of \037account\037 with instructions on how to reset their password. \037email\037 must be the email address associated to \037account\037.")); return true; } }; @@ -81,7 +75,7 @@ class NSResetPass : public Module { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return EVENT_STOP; } @@ -107,7 +101,7 @@ class NSResetPass : public Module if (source.GetUser()) { source.GetUser()->Identify(na); - source.Reply(_("You are now identified for your nick. Change your password now.")); + source.Reply(_("You are now identified for \002{0}\002. Change your password now."), na->nc->display); } } else diff --git a/modules/commands/ns_set.cpp b/modules/commands/ns_set.cpp index e0d0299a3..58311f0af 100644 --- a/modules/commands/ns_set.cpp +++ b/modules/commands/ns_set.cpp @@ -33,7 +33,9 @@ class CommandNSSet : public Command { this->SendSyntax(source); source.Reply(" "); - source.Reply(_("Sets various nickname options. \037option\037 can be one of:")); + source.Reply(_("Sets various options on your account\n" + "\n" + "Available options:")); Anope::string this_name = source.command; bool hide_privileged_commands = Config->GetBlock("options")->Get<bool>("hideprivilegedcommands"); @@ -59,8 +61,10 @@ class CommandNSSet : public Command } } - source.Reply(_("Type \002%s%s HELP %s \037option\037\002 for more information\n" - "on a specific option."), Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), this_name.c_str()); + CommandInfo *help = source.service->FindCommand("generic/help"); + if (help) + source.Reply(_("Type \002{0}{1} {2} {3} \037option\037\002 for more information on a particular option."), + Config->StrictPrivmsg, source.service->nick, help->cname, this_name); return true; } @@ -85,7 +89,9 @@ class CommandNSSASet : public Command { this->SendSyntax(source); source.Reply(" "); - source.Reply(_("Sets various nickname options. \037option\037 can be one of:")); + source.Reply(_("Sets various options on other users accounts\n" + "\n" + "Available options:")); Anope::string this_name = source.command; for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it) @@ -104,9 +110,11 @@ class CommandNSSASet : public Command } } - source.Reply(_("Type \002%s%s HELP %s \037option\037\002 for more information\n" - "on a specific option. The options will be set on the given\n" - "\037nickname\037."), Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), this_name.c_str()); + CommandInfo *help = source.service->FindCommand("generic/help"); + if (help) + source.Reply(_("Type \002{0}{1} {2} {3} \037option\037\002 for more information on a particular option."), + Config->StrictPrivmsg, source.service->nick, help->cname, this_name); + return true; } }; @@ -116,7 +124,7 @@ class CommandNSSetPassword : public Command public: CommandNSSetPassword(Module *creator) : Command(creator, "nickserv/set/password", 1) { - this->SetDesc(_("Set your nickname password")); + this->SetDesc(_("Changes your password")); this->SetSyntax(_("\037new-password\037")); } @@ -127,18 +135,19 @@ class CommandNSSetPassword : public Command if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } if (source.GetNick().equals_ci(param) || (Config->GetBlock("options")->Get<bool>("strictpasswords") && len < 5)) { - source.Reply(MORE_OBSCURE_PASSWORD); + source.Reply(_("Please try again with a more obscure password. Passwords should be at least five characters long, should not be something easily guessed (e.g. your real name or your nick), and cannot contain the space or tab characters.")); return; } - else if (len > Config->GetModule("nickserv")->Get<unsigned>("passlen", "32")) + + if (len > Config->GetModule("nickserv")->Get<unsigned>("passlen", "32")) { - source.Reply(PASSWORD_TOO_LONG); + source.Reply(_("Your password is too long, it can not contain more than \002{0}\002 characters."), Config->GetModule("nickserv")->Get<unsigned>("passlen", "32")); return; } @@ -147,17 +156,14 @@ class CommandNSSetPassword : public Command Anope::Encrypt(param, source.nc->pass); Anope::string tmp_pass; if (Anope::Decrypt(source.nc->pass, tmp_pass) == 1) - source.Reply(_("Password for \002%s\002 changed to \002%s\002."), source.nc->display.c_str(), tmp_pass.c_str()); + source.Reply(_("Password for \002{0}\002 changed to \002{1]\002."), source.nc->display, tmp_pass); else - source.Reply(_("Password for \002%s\002 changed."), source.nc->display.c_str()); + source.Reply(_("Password for \002{0}\002 changed."), source.nc->display); } bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Changes the password used to identify you as the nick's\n" - "owner.")); + source.Reply(_("Changes your password to \037new-password\037.")); return true; } }; @@ -167,22 +173,22 @@ class CommandNSSASetPassword : public Command public: CommandNSSASetPassword(Module *creator) : Command(creator, "nickserv/saset/password", 2, 2) { - this->SetDesc(_("Set the nickname password")); - this->SetSyntax(_("\037nickname\037 \037new-password\037")); + this->SetDesc(_("Changes the password of another user")); + this->SetSyntax(_("\037account\037 \037new-password\037")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } const NickServ::Nick *setter_na = NickServ::FindNick(params[0]); if (setter_na == NULL) { - source.Reply(NICK_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("\002{0}\002 isn't registered."), params[0]); return; } NickServ::Account *nc = setter_na->nc; @@ -194,14 +200,16 @@ class CommandNSSASetPassword : public Command source.Reply(_("You may not change the password of other Services Operators.")); return; } - else if (nc->display.equals_ci(params[1]) || (Config->GetBlock("options")->Get<bool>("strictpasswords") && len < 5)) + + if (nc->display.equals_ci(params[1]) || (Config->GetBlock("options")->Get<bool>("strictpasswords") && len < 5)) { - source.Reply(MORE_OBSCURE_PASSWORD); + source.Reply(_("Please try again with a more obscure password. Passwords should be at least five characters long, should not be something easily guessed (e.g. your real name or your nick), and cannot contain the space or tab characters.")); return; } - else if (len > Config->GetModule("nickserv")->Get<unsigned>("passlen", "32")) + + if (len > Config->GetModule("nickserv")->Get<unsigned>("passlen", "32")) { - source.Reply(PASSWORD_TOO_LONG); + source.Reply(_("Your password is too long, it can not contain more than \002{0}\002 characters."), Config->GetModule("nickserv")->Get<unsigned>("passlen", "32")); return; } @@ -210,16 +218,14 @@ class CommandNSSASetPassword : public Command Anope::Encrypt(params[1], nc->pass); Anope::string tmp_pass; if (Anope::Decrypt(nc->pass, tmp_pass) == 1) - source.Reply(_("Password for \002%s\002 changed to \002%s\002."), nc->display.c_str(), tmp_pass.c_str()); + source.Reply(_("Password for \002{0}\002 changed to \002{1}\002."), nc->display, tmp_pass); else - source.Reply(_("Password for \002%s\002 changed."), nc->display.c_str()); + source.Reply(_("Password for \002{0}\002 changed."), nc->display); } bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Changes the password used to identify as the nick's owner.")); + source.Reply(_("Changes the password of \037account\037 to \037new-password\037.")); return true; } }; @@ -237,14 +243,14 @@ class CommandNSSetAutoOp : public Command { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } const NickServ::Nick *na = NickServ::FindNick(user); if (na == NULL) { - source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), user); return; } NickServ::Account *nc = na->nc; @@ -258,13 +264,13 @@ class CommandNSSetAutoOp : public Command { Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable autoop for " << na->nc->display; nc->Extend<bool>("AUTOOP"); - source.Reply(_("Services will from now on set status modes on %s in channels."), nc->display.c_str()); + source.Reply(_("Services will from now on set status modes on \002{0}\002 in channels."), nc->display); } else if (param.equals_ci("OFF")) { Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable autoop for " << na->nc->display; nc->Shrink<bool>("AUTOOP"); - source.Reply(_("Services will no longer set status modes on %s in channels."), nc->display.c_str()); + source.Reply(_("Services will no longer set status modes on \002{0}\002 in channels."), nc->display); } else this->OnSyntaxError(source, "AUTOOP"); @@ -277,13 +283,8 @@ class CommandNSSetAutoOp : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - BotInfo *bi = Config->GetClient("ChanServ"); - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Sets whether you will be given your channel status modes automatically.\n" - "Set to \002ON\002 to allow %s to set status modes on you automatically\n" - "when entering channels. Note that depending on channel settings some modes\n" - "may not get set automatically."), bi ? bi->nick.c_str() : "ChanServ"); + source.Reply(_("Sets whether you will be given your channel status modes automatically when you join a channel." + " Note that depending on channel settings some modes may not get set automatically.")); return true; } }; @@ -329,7 +330,7 @@ class CommandNSSetDisplay : public Command { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } @@ -340,14 +341,16 @@ class CommandNSSetDisplay : public Command source.Reply(_("This command may not be used on this network because nickname ownership is disabled.")); return; } + if (user_na == NULL) { - source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), user); return; } - else if (!na || *na->nc != *user_na->nc) + + if (!na || *na->nc != *user_na->nc) { - source.Reply(_("The new display MUST be a nickname of the nickname group %s."), user_na->nc->display.c_str()); + source.Reply(_("The new display must be a nickname of the nickname group \002{0}\02."), user_na->nc->display); return; } @@ -359,7 +362,7 @@ class CommandNSSetDisplay : public Command Log(user_na->nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the display of " << user_na->nc->display << " to " << na->nick; user_na->nc->SetDisplay(na); - source.Reply(NICK_SET_DISPLAY_CHANGED, user_na->nc->display.c_str()); + source.Reply(_("The new display is now \002{0}\002."), user_na->nc->display); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -369,10 +372,7 @@ class CommandNSSetDisplay : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Changes the display used to refer to your nickname group in\n" - "Services. The new display MUST be a nick of your group.")); + source.Reply(_("Changes the display used to refer to your nickname group in services. The new display nickname must be a nickname of your group.")); return true; } }; @@ -383,7 +383,7 @@ class CommandNSSASetDisplay : public CommandNSSetDisplay CommandNSSASetDisplay(Module *creator) : CommandNSSetDisplay(creator, "nickserv/saset/display", 2) { this->ClearSyntax(); - this->SetSyntax(_("\037nickname\037 \037new-display\037")); + this->SetSyntax(_("\037account\037 \037new-display\037")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -393,10 +393,7 @@ class CommandNSSASetDisplay : public CommandNSSetDisplay bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Changes the display used to refer to the nickname group in\n" - "Services. The new display MUST be a nick of the group.")); + source.Reply(_("Changes the display used to refer to the nickname group \037account\037 in services. The new display nickname must be a nickname in the group of \037account\037.")); return true; } }; @@ -440,14 +437,14 @@ class CommandNSSetEmail : public Command { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } const NickServ::Nick *na = NickServ::FindNick(user); if (!na) { - source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), user); return; } NickServ::Account *nc = na->nc; @@ -463,14 +460,16 @@ class CommandNSSetEmail : public Command source.Reply(_("You cannot unset the e-mail on this network.")); return; } - else if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && source.nc != nc && nc->IsServicesOper()) + + if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && source.nc != nc && nc->IsServicesOper()) { source.Reply(_("You may not change the e-mail of other Services Operators.")); return; } - else if (!param.empty() && !Mail::Validate(param)) + + if (!param.empty() && !Mail::Validate(param)) { - source.Reply(MAIL_X_INVALID, param.c_str()); + source.Reply(_("\002{0}\002 is not a valid e-mail address."), param); return; } @@ -482,7 +481,7 @@ class CommandNSSetEmail : public Command if (!param.empty() && Config->GetModule("nickserv")->Get<bool>("confirmemailchanges") && !source.IsServicesOper()) { if (SendConfirmMail(source.GetUser(), source.service, param)) - source.Reply(_("A confirmation e-mail has been sent to \002%s\002. Follow the instructions in it to change your e-mail address."), param.c_str()); + source.Reply(_("A confirmation e-mail has been sent to \002{0}\002. Follow the instructions in it to change your e-mail address."), param); } else { @@ -490,13 +489,13 @@ class CommandNSSetEmail : public Command { Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the email of " << nc->display << " to " << param; nc->email = param; - source.Reply(_("E-mail address for \002%s\002 changed to \002%s\002."), nc->display.c_str(), param.c_str()); + source.Reply(_("E-mail address for \002{0}\002 changed to \002{1}\002."), nc->display, param); } else { Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to unset the email of " << nc->display; nc->email.clear(); - source.Reply(_("E-mail address for \002%s\002 unset."), nc->display.c_str()); + source.Reply(_("E-mail address for \002{0}\002 unset."), nc->display); } } } @@ -508,11 +507,7 @@ class CommandNSSetEmail : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Associates the given E-mail address with your nickname.\n" - "This address will be displayed whenever someone requests\n" - "information on the nickname with the \002INFO\002 command.")); + source.Reply(_("Changes your email address to \037address\037.")); return true; } }; @@ -523,7 +518,7 @@ class CommandNSSASetEmail : public CommandNSSetEmail CommandNSSASetEmail(Module *creator) : CommandNSSetEmail(creator, "nickserv/saset/email", 2) { this->ClearSyntax(); - this->SetSyntax(_("\037nickname\037 \037address\037")); + this->SetSyntax(_("\037account\037 \037address\037")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -533,9 +528,7 @@ class CommandNSSASetEmail : public CommandNSSetEmail bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Associates the given E-mail address with the nickname.")); + source.Reply(_("Changes the email address of \037account\037 to \037address\037.")); return true; } }; @@ -553,14 +546,14 @@ class CommandNSSetKeepModes : public Command { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } const NickServ::Nick *na = NickServ::FindNick(user); if (!na) { - source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), user); return; } NickServ::Account *nc = na->nc; @@ -574,13 +567,13 @@ class CommandNSSetKeepModes : public Command { Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable keepmodes for " << nc->display; nc->Extend<bool>("NS_KEEP_MODES"); - source.Reply(_("Keep modes for %s is now \002on\002."), nc->display.c_str()); + source.Reply(_("Keep modes for \002{0}\002 is now \002on\002."), nc->display); } else if (param.equals_ci("OFF")) { Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable keepmodes for " << nc->display; nc->Shrink<bool>("NS_KEEP_MODES"); - source.Reply(_("Keep modes for %s is now \002off\002."), nc->display.c_str()); + source.Reply(_("Keep modes for \002{0}\002 is now \002off\002."), nc->display); } else this->OnSyntaxError(source, ""); @@ -593,11 +586,7 @@ class CommandNSSetKeepModes : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Enables or disables keepmodes for your nick. If keep\n" - "modes is enabled, services will remember your usermodes\n" - "and attempt to re-set them the next time you authenticate.")); + source.Reply(_("Enables or disables keepmodes for your account. If keepmodes is enabled, services will remember your usermodes and attempt to re-set them the next time you log on.")); return true; } }; @@ -608,7 +597,7 @@ class CommandNSSASetKeepModes : public CommandNSSetKeepModes CommandNSSASetKeepModes(Module *creator) : CommandNSSetKeepModes(creator, "nickserv/saset/keepmodes", 2) { this->ClearSyntax(); - this->SetSyntax(_("\037nickname\037 {ON | OFF}")); + this->SetSyntax(_("\037account\037 {ON | OFF}")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -618,11 +607,7 @@ class CommandNSSASetKeepModes : public CommandNSSetKeepModes bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Enables or disables keepmodes for the given nick. If keep\n" - "modes is enabled, services will remember users' usermodes\n" - "and attempt to re-set them the next time they authenticate.")); + source.Reply(_("Enables or disables keepmodes for \037account\037. If keep modes is enabled, services will remember users' usermodes and attempt to re-set them the next time they log pn.")); return true; } }; @@ -640,7 +625,7 @@ class CommandNSSetKill : public Command { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } @@ -653,7 +638,7 @@ class CommandNSSetKill : public Command const NickServ::Nick *na = NickServ::FindNick(user); if (!na) { - source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), user); return; } NickServ::Account *nc = na->nc; @@ -669,7 +654,7 @@ class CommandNSSetKill : public Command nc->Shrink<bool>("KILL_QUICK"); nc->Shrink<bool>("KILL_IMMED"); Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to set kill on for " << nc->display; - source.Reply(_("Protection is now \002on\002 for \002%s\002."), nc->display.c_str()); + source.Reply(_("Protection is now \002on\002 for \002{0}\002."), nc->display); } else if (param.equals_ci("QUICK")) { @@ -677,7 +662,7 @@ class CommandNSSetKill : public Command nc->Extend<bool>("KILL_QUICK"); nc->Shrink<bool>("KILL_IMMED"); Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to set kill quick for " << nc->display; - source.Reply(_("Protection is now \002on\002 for \002%s\002, with a reduced delay."), nc->display.c_str()); + source.Reply(_("Protection is now \002on\002 for \002{0}\002, with a reduced delay."), nc->display); } else if (param.equals_ci("IMMED")) { @@ -687,7 +672,7 @@ class CommandNSSetKill : public Command nc->Shrink<bool>("KILL_QUICK"); nc->Extend<bool>("KILL_IMMED"); Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to set kill immed for " << nc->display; - source.Reply(_("Protection is now \002on\002 for \002%s\002, with no delay."), nc->display.c_str()); + source.Reply(_("Protection is now \002on\002 for \002{0}\002, with no delay."), nc->display); } else source.Reply(_("The \002IMMED\002 option is not available on this network.")); @@ -698,12 +683,10 @@ class CommandNSSetKill : public Command nc->Shrink<bool>("KILL_QUICK"); nc->Shrink<bool>("KILL_IMMED"); Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable kill for " << nc->display; - source.Reply(_("Protection is now \002off\002 for \002%s\002."), nc->display.c_str()); + source.Reply(_("Protection is now \002off\002 for \002{0}\002."), nc->display); } else this->OnSyntaxError(source, "KILL"); - - return; } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -713,20 +696,12 @@ class CommandNSSetKill : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Turns the automatic protection option for your nick\n" - "on or off. With protection on, if another user\n" - "tries to take your nick, they will be given one minute to\n" - "change to another nick, after which %s will forcibly change\n" - "their nick.\n" - " \n" - "If you select \002QUICK\002, the user will be given only 20 seconds\n" - "to change nicks instead of the usual 60. If you select\n" - "\002IMMED\002, the user's nick will be changed immediately \037without\037 being\n" - "warned first or given a chance to change their nick; please\n" - "do not use this option unless necessary. Also, your\n" - "network's administrators may have disabled this option."), source.service->nick.c_str()); + source.Reply(_("Turns the automatic protection option for your account on or off." + " With protection on, if another user tries to use one of your nicknames, they will be given {0} to change to another their nickname, after which {1} will forcibly change their nickname.\n" + "\n" + "If you select \002QUICK\002, the user will be given only {1} to change their nick instead {0}." + " If you select \002IMMED\002, the user's nickname will be changed immediately \037without\037 being warned first or given a chance to change their nick." + " With this set, the only way to use the nickname is to match an entry on the account's access list.")); return true; } }; @@ -737,7 +712,7 @@ class CommandNSSASetKill : public CommandNSSetKill CommandNSSASetKill(Module *creator) : CommandNSSetKill(creator, "nickserv/saset/kill", 2) { this->ClearSyntax(); - this->SetSyntax(_("\037nickname\037 {ON | QUICK | IMMED | OFF}")); + this->SetSyntax(_("\037account\037 {ON | QUICK | IMMED | OFF}")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -747,20 +722,12 @@ class CommandNSSASetKill : public CommandNSSetKill bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Turns the automatic protection option for the nick\n" - "on or off. With protection on, if another user\n" - "tries to take the nick, they will be given one minute to\n" - "change to another nick, after which %s will forcibly change\n" - "their nick.\n" - " \n" - "If you select \002QUICK\002, the user will be given only 20 seconds\n" - "to change nicks instead of the usual 60. If you select\n" - "\002IMMED\002, the user's nick will be changed immediately \037without\037 being\n" - "warned first or given a chance to change their nick; please\n" - "do not use this option unless necessary. Also, your\n" - "network's administrators may have disabled this option."), source.service->nick.c_str()); + source.Reply(_("Turns the automatic protection option for \037account\037 on or off." + " With protection on, if another user tries to use one of the nicknames in the group, they will be given {0} to change to another their nickname, after which {1} will forcibly change their nickname.\n" + "\n" + "If you select \002QUICK\002, the user will be given only {1} to change their nick instead {0}." + " If you select \002IMMED\002, the user's nickname will be changed immediately \037without\037 being warned first or given a chance to change their nick." + " With this set, the only way to use the nickname is to match an entry on the account's access list.")); return true; } }; @@ -778,14 +745,14 @@ class CommandNSSetLanguage : public Command { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } const NickServ::Nick *na = NickServ::FindNick(user); if (!na) { - source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), user); return; } NickServ::Account *nc = na->nc; @@ -820,12 +787,7 @@ class CommandNSSetLanguage : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Changes the language Services uses when sending messages to\n" - "you (for example, when responding to a command you send).\n" - "\037language\037 should be chosen from the following list of\n" - "supported languages:")); + source.Reply(_("Changes the language services will use when sending messages to you (for example, when responding to a command you send). \037language\037 should be chosen from the following list of supported languages:")); source.Reply(" en (English)"); for (unsigned j = 0; j < Language::Languages.size(); ++j) @@ -846,7 +808,7 @@ class CommandNSSASetLanguage : public CommandNSSetLanguage CommandNSSASetLanguage(Module *creator) : CommandNSSetLanguage(creator, "nickserv/saset/language", 2) { this->ClearSyntax(); - this->SetSyntax(_("\037nickname\037 \037language\037")); + this->SetSyntax(_("\037account\037 \037language\037")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -856,12 +818,7 @@ class CommandNSSASetLanguage : public CommandNSSetLanguage bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Changes the language Services uses when sending messages to\n" - "the given user (for example, when responding to a command they send).\n" - "\037language\037 should be chosen from the following list of\n" - "supported languages:")); + source.Reply(_("Changes the language services will use when sending messages to the given user (for example, when responding to a command they send). \037language\037 should be chosen from the following list of supported languages:")); source.Reply(" en (English)"); for (unsigned j = 0; j < Language::Languages.size(); ++j) { @@ -887,21 +844,21 @@ class CommandNSSetMessage : public Command { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } const NickServ::Nick *na = NickServ::FindNick(user); if (!na) { - source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), user); return; } NickServ::Account *nc = na->nc; if (!Config->GetBlock("options")->Get<bool>("useprivmsg")) { - source.Reply(_("You cannot %s on this network."), source.command.c_str()); + source.Reply(_("You cannot %s on this network."), source.command); return; } @@ -914,13 +871,13 @@ class CommandNSSetMessage : public Command { Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable " << source.command << " for " << nc->display; nc->Extend<bool>("MSG"); - source.Reply(_("Services will now reply to \002%s\002 with \002messages\002."), nc->display.c_str()); + source.Reply(_("Services will now reply to \002{0}\002 with \002messages\002."), nc->display); } else if (param.equals_ci("OFF")) { Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable " << source.command << " for " << nc->display; nc->Shrink<bool>("MSG"); - source.Reply(_("Services will now reply to \002%s\002 with \002notices\002."), nc->display.c_str()); + source.Reply(_("Services will now reply to \002{0}\002 with \002notices\002."), nc->display); } else this->OnSyntaxError(source, "MSG"); @@ -938,11 +895,7 @@ class CommandNSSetMessage : public Command if (i != Anope::string::npos) cmd = cmd.substr(i + 1); - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Allows you to choose the way Services are communicating with\n" - "you. With \002%s\002 set, Services will use messages, else they'll\n" - "use notices."), cmd.upper().c_str()); + source.Reply(_("Allows you to choose the way services communicate with you. With \002{0}\002 set, services will use messages instead of notices."), cmd); return true; } @@ -959,16 +912,17 @@ class CommandNSSASetMessage : public CommandNSSetMessage CommandNSSASetMessage(Module *creator) : CommandNSSetMessage(creator, "nickserv/saset/message", 2) { this->ClearSyntax(); - this->SetSyntax(_("\037nickname\037 {ON | OFF}")); + this->SetSyntax(_("\037account\037 {ON | OFF}")); } bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Allows you to choose the way Services are communicating with\n" - "the given user. With \002MSG\002 set, Services will use messages,\n" - "else they'll use notices.")); + Anope::string cmd = source.command; + size_t i = cmd.find_last_of(' '); + if (i != Anope::string::npos) + cmd = cmd.substr(i + 1); + + source.Reply(_("Allows you to choose the way services communicate with the given user. With \002{0}\002 set, services will use messages instead of notices."), cmd); return true; } @@ -991,14 +945,14 @@ class CommandNSSetSecure : public Command { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } const NickServ::Nick *na = NickServ::FindNick(user); if (!na) { - source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), user); return; } NickServ::Account *nc = na->nc; @@ -1012,13 +966,13 @@ class CommandNSSetSecure : public Command { Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable secure for " << nc->display; nc->Extend<bool>("NS_SECURE"); - source.Reply(_("Secure option is now \002on\002 for \002%s\002."), nc->display.c_str()); + source.Reply(_("Secure option is now \002on\002 for \002{0}\002."), nc->display); } else if (param.equals_ci("OFF")) { Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable secure for " << nc->display; nc->Shrink<bool>("NS_SECURE"); - source.Reply(_("Secure option is now \002off\002 for \002%s\002."), nc->display.c_str()); + source.Reply(_("Secure option is now \002off\002 for \002{0}\002."), nc->display); } else this->OnSyntaxError(source, "SECURE"); @@ -1031,15 +985,10 @@ class CommandNSSetSecure : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Turns %s's security features on or off for your\n" - "nick. With \002SECURE\002 set, you must enter your password\n" - "before you will be recognized as the owner of the nick,\n" - "regardless of whether your address is on the access\n" - "list. However, if you are on the access list, %s\n" - "will not auto-kill you regardless of the setting of the\n" - "\002KILL\002 option."), source.service->nick.c_str(), source.service->nick.c_str()); + source.Reply(_("Turns the security feature on or off for your account." + " With \002SECURE\002 set, you must enter your password before you will be recognized as the owner of the account," + " regardless of whether your address is on the access list or not." + " However, if you are on the access list, services will not force you to change your nickname, regardless of the setting of the \002kill\002 option.")); return true; } }; @@ -1050,7 +999,7 @@ class CommandNSSASetSecure : public CommandNSSetSecure CommandNSSASetSecure(Module *creator) : CommandNSSetSecure(creator, "nickserv/saset/secure", 2) { this->ClearSyntax(); - this->SetSyntax(_("\037nickname\037 {ON | OFF}")); + this->SetSyntax(_("\037account\037 {ON | OFF}")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -1060,15 +1009,10 @@ class CommandNSSASetSecure : public CommandNSSetSecure bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Turns %s's security features on or off for your\n" - "nick. With \002SECURE\002 set, you must enter your password\n" - "before you will be recognized as the owner of the nick,\n" - "regardless of whether your address is on the access\n" - "list. However, if you are on the access list, %s\n" - "will not auto-kill you regardless of the setting of the\n" - "\002KILL\002 option."), source.service->nick.c_str(), source.service->nick.c_str()); + source.Reply(_("Turns the security feature on or off for \037account\037." + " With \002SECURE\002 set, you the user must enter their password before they will be recognized as the owner of the account," + " regardless of whether their address address is on the access list or not." + " However, if they are on the access list, services will not force them to change your nickname, regardless of the setting of the \002kill\002 option.")); return true; } }; @@ -1086,16 +1030,18 @@ class CommandNSSASetNoexpire : public Command { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } - NickServ::Nick *na = NickServ::FindNick(params[0]); - if (na == NULL) + const Anope::string &user = params[0]; + NickServ::Nick *na = NickServ::FindNick(user); + if (!na) { - source.Reply(NICK_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("\002{0}\002 isn't registered."), user); return; } + NickServ::Account *nc = na->nc; Anope::string param = params.size() > 1 ? params[1] : ""; @@ -1103,13 +1049,13 @@ class CommandNSSASetNoexpire : public Command { Log(LOG_ADMIN, source, this) << "to enable noexpire for " << na->nc->display; na->Extend<bool>("NS_NO_EXPIRE"); - source.Reply(_("Nick %s \002will not\002 expire."), na->nick.c_str()); + source.Reply(_("\002{0}\002 \002will not\002 expire."), na->nick); } else if (param.equals_ci("OFF")) { Log(LOG_ADMIN, source, this) << "to disable noexpire for " << na->nc->display; na->Shrink<bool>("NS_NO_EXPIRE"); - source.Reply(_("Nick %s \002will\002 expire."), na->nick.c_str()); + source.Reply(_("\002{0}\002 \002will\002 expire."), na->nick); } else this->OnSyntaxError(source, "NOEXPIRE"); @@ -1117,10 +1063,7 @@ class CommandNSSASetNoexpire : public Command bool OnHelp(CommandSource &source, const Anope::string &) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Sets whether the given nickname will expire. Setting this\n" - "to \002ON\002 prevents the nickname from expiring.")); + source.Reply(_("Sets whether the given nickname will expire. Setting this to \002ON\002 prevents the nickname from expiring.")); return true; } }; diff --git a/modules/commands/ns_set_misc.cpp b/modules/commands/ns_set_misc.cpp index 4038b9cc1..fc450b601 100644 --- a/modules/commands/ns_set_misc.cpp +++ b/modules/commands/ns_set_misc.cpp @@ -102,14 +102,14 @@ class CommandNSSetMisc : public Command { if (Anope::ReadOnly) { - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode.")); return; } const NickServ::Nick *na = NickServ::FindNick(user); if (!na) { - source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), user); return; } NickServ::Account *nc = na->nc; @@ -127,12 +127,12 @@ class CommandNSSetMisc : public Command if (!param.empty()) { item->Set(nc, NSMiscData(nc, key, param)); - source.Reply(CHAN_SETTING_CHANGED, scommand.c_str(), nc->display.c_str(), param.c_str()); + source.Reply(_("\002{0}\002 for \002{1}\002 set to \002{2}\002."), scommand, nc->display, param); } else { item->Unset(nc); - source.Reply(CHAN_SETTING_UNSET, scommand.c_str(), nc->display.c_str()); + source.Reply(_("\002{0}\002 for \002{1}\002 unset."), scommand, nc->display); } } @@ -154,7 +154,7 @@ class CommandNSSetMisc : public Command { if (descriptions.count(source.command)) { - source.Reply("%s", Language::Translate(source.nc, descriptions[source.command].c_str())); + source.Reply(Language::Translate(source.nc, descriptions[source.command].c_str())); return true; } return false; diff --git a/modules/commands/ns_status.cpp b/modules/commands/ns_status.cpp index 24c901a52..beb8ff6a0 100644 --- a/modules/commands/ns_status.cpp +++ b/modules/commands/ns_status.cpp @@ -30,6 +30,7 @@ class CommandNSStatus : public Command while (sep.GetToken(nickbuf)) { + #if 0 User *u2 = User::Find(nickbuf, true); if (!u2) /* Nick is not online */ source.Reply("STATUS %s %d %s", nickbuf.c_str(), 0, ""); @@ -44,8 +45,8 @@ class CommandNSStatus : public Command * so we tell the user about it */ source.Reply("STATUS %s %d %s", nickbuf.c_str(), 1, u2->Account() ? u2->Account()->display.c_str() : ""); + #endif } - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override @@ -80,7 +81,7 @@ class NSStatus : public Module NSStatus(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR) , commandnsstatus(this) { - + throw ModuleException("Remind Adam to fix this"); } }; diff --git a/modules/commands/ns_suspend.cpp b/modules/commands/ns_suspend.cpp index ae8dd20ee..1dfc48995 100644 --- a/modules/commands/ns_suspend.cpp +++ b/modules/commands/ns_suspend.cpp @@ -60,7 +60,7 @@ class CommandNSSuspend : public Command CommandNSSuspend(Module *creator, EventHandlers<Event::NickSuspend> &event) : Command(creator, "nickserv/suspend", 2, 3), onnicksuspend(event) { this->SetDesc(_("Suspend a given nick")); - this->SetSyntax(_("\037nickname\037 [+\037expiry\037] [\037reason\037]")); + this->SetSyntax(_("\037account\037 [+\037expiry\037] [\037reason\037]")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -72,7 +72,7 @@ class CommandNSSuspend : public Command time_t expiry_secs = Config->GetModule(this->owner)->Get<time_t>("suspendexpire"); if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); if (expiry[0] != '+') { @@ -85,7 +85,7 @@ class CommandNSSuspend : public Command expiry_secs = Anope::DoTime(expiry); if (expiry_secs == -1) { - source.Reply(BAD_EXPIRY_TIME); + source.Reply(_("Invalid expiry time \002{0}\002."), expiry); return; } } @@ -93,7 +93,7 @@ class CommandNSSuspend : public Command NickServ::Nick *na = NickServ::FindNick(nick); if (!na) { - source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), nick); return; } @@ -137,19 +137,15 @@ 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"); - source.Reply(_("Nick %s is now suspended."), nick.c_str()); + source.Reply(_("\002{0}\002 is now suspended."), na->nick); this->onnicksuspend(&Event::NickSuspend::OnNickSuspend, na); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Suspends a registered nickname, which prevents it from being used\n" - "while keeping all the data for that nick. If an expiry is given\n" - "the nick will be unsuspended after that period of time, else the\n" - "default expiry from the configuration is used.")); + 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 return true; } }; @@ -162,7 +158,7 @@ class CommandNSUnSuspend : public Command CommandNSUnSuspend(Module *creator, EventHandlers<Event::NickUnsuspended> &event) : Command(creator, "nickserv/unsuspend", 1, 1), onnickunsuspend(event) { this->SetDesc(_("Unsuspend a given nick")); - this->SetSyntax(_("\037nickname\037")); + this->SetSyntax(_("\037account\037")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -170,18 +166,18 @@ class CommandNSUnSuspend : public Command const Anope::string &nick = params[0]; if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); NickServ::Nick *na = NickServ::FindNick(nick); if (!na) { - source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), nick); return; } if (!na->nc->HasExt("NS_SUSPENDED")) { - source.Reply(_("Nick %s is not suspended."), na->nick.c_str()); + source.Reply(_("\002{0}\002 is not suspended."), na->nick); return; } @@ -191,16 +187,14 @@ class CommandNSUnSuspend : public Command na->nc->Shrink<NSSuspendInfo>("NS_SUSPENDED"); - source.Reply(_("Nick %s is now released."), nick.c_str()); + source.Reply(_("\002{0}\002 is now released."), na->nick); this->onnickunsuspend(&Event::NickUnsuspended::OnNickUnsuspended, na); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Unsuspends a nickname which allows it to be used again.")); + source.Reply(_("Unsuspends \037account\037, which allows it to be used again.")); return true; } }; @@ -274,7 +268,7 @@ class NSSuspend : public Module if (!s) return EVENT_CONTINUE; - u->SendMessage(Config->GetClient("NickServ"), NICK_X_SUSPENDED, u->nick.c_str()); + u->SendMessage(Config->GetClient("NickServ"), _("\002{0}\002 is suspended."), u->nick); return EVENT_STOP; } }; diff --git a/modules/commands/os_akill.cpp b/modules/commands/os_akill.cpp index bf2a1abe8..0b8bd35fc 100644 --- a/modules/commands/os_akill.cpp +++ b/modules/commands/os_akill.cpp @@ -26,11 +26,11 @@ class AkillDelCallback : public NumberList ~AkillDelCallback() { if (!deleted) - source.Reply(_("No matching entries on the AKILL list.")); + source.Reply(_("No matching entries on the akill list.")); else if (deleted == 1) - source.Reply(_("Deleted 1 entry from the AKILL list.")); + source.Reply(_("Deleted \0021\002 entry from the akill list.")); else - source.Reply(_("Deleted %d entries from the AKILL list."), deleted); + source.Reply(_("Deleted \002{0}\002 entries from the akill list."), deleted); } void HandleNumber(unsigned number) override @@ -86,7 +86,7 @@ class CommandOSAKill : public Command /* Do not allow less than a minute expiry time */ if (expires && expires < 60) { - source.Reply(BAD_EXPIRY_TIME); + source.Reply(_("Invalid expiry time \002{0}\002."), expiry); return; } else if (expires > 0) @@ -148,7 +148,7 @@ class CommandOSAKill : public Command return; else if (mask.find_first_not_of("/~@.*?") == Anope::string::npos) { - source.Reply(USERHOST_MASK_TOO_WIDE, mask.c_str()); + source.Reply(_("\002{0}\002 coverage is too wide; Please use a more specific mask."), mask); return; } @@ -167,7 +167,7 @@ class CommandOSAKill : public Command if (percent > 95) { - source.Reply(USERHOST_MASK_TOO_WIDE, mask.c_str()); + source.Reply(_("\002{0}\002 coverage is too wide; Please use a more specific mask."), mask); Log(LOG_ADMIN, source, this) << "tried to akill " << percent << "% of the network (" << affected << " users)"; delete x; return; @@ -185,11 +185,11 @@ class CommandOSAKill : public Command if (Config->GetModule("operserv")->Get<bool>("akillonadd")) akills->Send(NULL, x); - source.Reply(_("\002%s\002 added to the AKILL list."), mask.c_str()); + source.Reply(_("\002{0}\002 added to the akill list."), mask); Log(LOG_ADMIN, source, this) << "on " << mask << " (" << x->reason << "), expires in " << (expires ? Anope::Duration(expires - Anope::CurTime) : "never") << " [affects " << affected << " user(s) (" << percent << "%)]"; if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); } void DoDel(CommandSource &source, const std::vector<Anope::string> ¶ms) @@ -204,7 +204,7 @@ class CommandOSAKill : public Command if (akills->GetList().empty()) { - source.Reply(_("AKILL list is empty.")); + source.Reply(_("The akill list is empty.")); return; } @@ -219,7 +219,7 @@ class CommandOSAKill : public Command if (!x) { - source.Reply(_("\002%s\002 not found on the AKILL list."), mask.c_str()); + source.Reply(_("\002{0}\002 was not found on the akill list."), mask); return; } @@ -228,7 +228,7 @@ class CommandOSAKill : public Command Event::OnDelXLine(&Event::DelXLine::OnDelXLine, source, x, akills); Log(LOG_ADMIN, source, this) << "to remove " << x->mask << " from the list"; - source.Reply(_("\002%s\002 deleted from the AKILL list."), x->mask.c_str()); + source.Reply(_("\002{0}\002 deleted from the akill list."), x->mask); AkillDelCallback::DoDel(source, x); } while ((x = akills->HasEntry(mask))); @@ -236,9 +236,7 @@ class CommandOSAKill : public Command } if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); - - return; + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); } void ProcessList(CommandSource &source, const std::vector<Anope::string> ¶ms, ListFormatter &list) @@ -300,10 +298,10 @@ class CommandOSAKill : public Command } if (list.IsEmpty()) - source.Reply(_("No matching entries on the AKILL list.")); + source.Reply(_("There are no matching entries on the akill list.")); else { - source.Reply(_("Current AKILL list:")); + source.Reply(_("Current akill list:")); std::vector<Anope::string> replies; list.Process(replies); @@ -311,7 +309,7 @@ class CommandOSAKill : public Command for (unsigned i = 0; i < replies.size(); ++i) source.Reply(replies[i]); - source.Reply(_("End of AKILL list.")); + source.Reply(_("End of akill list.")); } } @@ -319,7 +317,7 @@ class CommandOSAKill : public Command { if (akills->GetList().empty()) { - source.Reply(_("AKILL list is empty.")); + source.Reply(_("The akill list is empty.")); return; } @@ -333,7 +331,7 @@ class CommandOSAKill : public Command { if (akills->GetList().empty()) { - source.Reply(_("AKILL list is empty.")); + source.Reply(_("The akill list is empty.")); return; } @@ -354,10 +352,10 @@ class CommandOSAKill : public Command } Log(LOG_ADMIN, source, this) << "to CLEAR the list"; - source.Reply(_("The AKILL list has been cleared.")); + source.Reply(_("The akill list has been cleared.")); if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); } public: CommandOSAKill(Module *creator) : Command(creator, "operserv/akill", 1, 2) @@ -389,61 +387,65 @@ class CommandOSAKill : public Command return this->DoClear(source); else this->OnSyntaxError(source, ""); - - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Allows Services Operators to manipulate the AKILL list. If\n" - "a user matching an AKILL mask attempts to connect, Services\n" - "will issue a KILL for that user and, on supported server\n" - "types, will instruct all servers to add a ban for the mask\n" - "which the user matched.\n" - " \n" - "\002AKILL ADD\002 adds the given mask to the AKILL\n" - "list for the given reason, which \002must\002 be given.\n" - "Mask should be in the format of nick!user@host#real name,\n" - "though all that is required is user@host. If a real name is specified,\n" - "the reason must be prepended with a :.\n" - "\037expiry\037 is specified as an integer followed by one of \037d\037\n" - "(days), \037h\037 (hours), or \037m\037 (minutes). Combinations (such as\n" - "\0371h30m\037) are not permitted. If a unit specifier is not\n" - "included, the default is days (so \037+30\037 by itself means 30\n" - "days). To add an AKILL which does not expire, use \037+0\037. If the\n" - "usermask to be added starts with a \037+\037, an expiry time must\n" - "be given, even if it is the same as the default. The\n" - "current AKILL default expiry time can be found with the\n" - "\002STATS AKILL\002 command.")); - const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine"); - if (!regexengine.empty()) + if (subcommand.equals_ci("ADD")) + { + source.Reply(_("The \002{0} ADD\002 command adds \037mask\037 to the auto kill list with the given \037reason\037." + "\037mask\037 can be in the format of nickname!username@hostname#realname." + " If a real name is specified, the reason must be prefixed with a :." + " \037expiry\037 is optional, and if specified must be an integer followed by one of \037d\037 (days), \037h\037 (hours), or \037m\037 (minutes)." + " If a unit specifier is not included, the default is days, so \037+30\037 means 30 days." + " To add an auto kill which does not expire, use \037+0\037. " + " The default auto kill expiry time is \002{1}\002"), + source.command, Anope::Duration(Config->GetModule("operserv")->Get<time_t>("autokillexpiry", "30d"), source.GetAccount())); + + const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine"); + if (!regexengine.empty()) + { + source.Reply(" "); + source.Reply(_("Regex matches are also supported using the %s engine. Enclose your mask in // if this is desired."), regexengine); + } + } + else if (subcommand.equals_ci("DEL")) + source.Reply(_("The \002{0} DEL\002 command removes the given \037mask\037 from the auto kill list, if present." + " If a list of entry numbers is given, those entries are deleted."), + source.command); + else if (subcommand.equals_ci("LIST") || subcommand.equals_ci("VIEW")) + source.Reply(_("The \002{0} LIST\002 and \002{0} VIEW\002 commands display the auto kill list." + " If a wildcard \037mask\037 is given, only those entries matching the mask are displayed." + " If a list of entry numbers is given, only those entries are shown." + " \002VIEW\002 is similar to \002LIST\002 but also shows who created the auto kill, when it was created, and when it expires.\n" + "\n" + "Example:\n" + "\n" + " {0} LIST 2-5,7-9\n" + " Lists auto kill entries numbered 2 through 5 and 7 through 9."), + source.command); + else if (subcommand.equals_ci("CLEAR")) + source.Reply(_("The \002{0} CLEAR\002 command removes all auto kills from the auto kill list."), + source.command); + else { - source.Reply(" "); - source.Reply(_("Regex matches are also supported using the %s engine.\n" - "Enclose your mask in // if this is desired."), regexengine.c_str()); + CommandInfo *help = source.service->FindCommand("generic/help"); + source.Reply(_("Allows manipulating the AKILL list." + " If a user matching an AKILL mask connects, services will issue a kill the user and prevent them from reconnecting.\n" + "\n" + "The \002ADD\002 command adds \037mask\037 to the auto kill list.\n" + "\002{msg}{service} {help} {command} ADD\002 for more information.\n" + "\n" + "The \002DEL\002 command removes \037mask\037 from the auto kill list.\n" + "\002{msg}{service} {help} {command} DEL\002 for more information.\n" + "\n" + "The \002LIST\002 and \002VIEW\002 commands both show the auto kill list, but \002VIEW\002 also shows who created the auto kill entry, when it was created, and when it expires.\n" + "\002{msg}{service} {help} {command} [LIST | VIEW]\002 for more information.\n" + "\n" + "The \002CLEAR\002 command clears th auto kill list." + "\002{msg}{service} {help} {command} CLEAR\002 for more information.\n"), + "msg"_kw = Config->StrictPrivmsg, "service"_kw = source.service->nick, "help"_kw = help->cname, "command"_kw = source.command); } - source.Reply(_( - " \n" - "The \002AKILL DEL\002 command removes the given mask from the\n" - "AKILL list if it is present. If a list of entry numbers is\n" - "given, those entries are deleted. (See the example for LIST\n" - "below.)\n" - " \n" - "The \002AKILL LIST\002 command displays the AKILL list.\n" - "If a wildcard mask is given, only those entries matching the\n" - "mask are displayed. If a list of entry numbers is given,\n" - "only those entries are shown; for example:\n" - " \002AKILL LIST 2-5,7-9\002\n" - " Lists AKILL entries numbered 2 through 5 and 7\n" - " through 9.\n" - " \n" - "\002AKILL VIEW\002 is a more verbose version of \002AKILL LIST\002, and\n" - "will show who added an AKILL, the date it was added, and when\n" - "it expires, as well as the user@host/ip mask and reason.\n" - " \n" - "\002AKILL CLEAR\002 clears all entries of the AKILL list.")); return true; } }; diff --git a/modules/commands/os_chankill.cpp b/modules/commands/os_chankill.cpp index 060258705..0143c64af 100644 --- a/modules/commands/os_chankill.cpp +++ b/modules/commands/os_chankill.cpp @@ -44,7 +44,7 @@ class CommandOSChanKill : public Command expires *= 86400; if (expires && expires < 60) { - source.Reply(BAD_EXPIRY_TIME); + source.Reply(_("Invalid expiry time \002{0}\002."), expiry); return; } else if (expires > 0) @@ -84,18 +84,13 @@ class CommandOSChanKill : public Command Log(LOG_ADMIN, source, this) << "on " << c->name << " (" << realreason << ")"; } else - source.Reply(CHAN_X_NOT_IN_USE, channel.c_str()); + source.Reply(_("Channel \002%s\002 doesn't exist."), channel); } - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Puts an AKILL for every nick on the specified channel. It\n" - "uses the entire real ident@host for every nick, and\n" - "then enforces the AKILL.")); + source.Reply(_("Adds an auto kill for every user on \037channel\037, except for IRC operators.")); return true; } }; diff --git a/modules/commands/os_config.cpp b/modules/commands/os_config.cpp index e0ed86e8b..257f8fee4 100644 --- a/modules/commands/os_config.cpp +++ b/modules/commands/os_config.cpp @@ -28,7 +28,7 @@ class CommandOSConfig : public Command { if (!source.HasPriv("operserv/config")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have the operator privilege \002{0}\002."), "operserv/config"); return; } @@ -38,14 +38,14 @@ class CommandOSConfig : public Command if (!block) { - source.Reply(_("There is no such configuration block %s."), params[1].c_str()); + source.Reply(_("There is no such configuration block \002{0}\002."), params[1]); return; } block->Set(params[2], params[3]); Log(LOG_ADMIN, source, this) << "to change the configuration value of " << params[1] << ":" << params[2] << " to " << params[3]; - source.Reply(_("Value of %s:%s changed to %s"), params[1].c_str(), params[2].c_str(), params[3].c_str()); + source.Reply(_("Value of \002{0}:{1}\002 changed to \002{2}\002."), params[1], params[2], params[3]); } else if (what.equals_ci("VIEW")) { @@ -76,7 +76,7 @@ class CommandOSConfig : public Command std::vector<Anope::string> replies; lflist.Process(replies); - source.Reply(_("%s settings:"), block->GetName().c_str()); + source.Reply(_("%s settings:"), block->GetName()); for (unsigned j = 0; j < replies.size(); ++j) source.Reply(replies[j]); @@ -122,15 +122,12 @@ class CommandOSConfig : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Allows you to change and view configuration settings.\n" - "Settings changed by this command are temporary and will not be reflected\n" - "back into the configuration file, and will be lost if Anope is shut down,\n" - "restarted, or the configuration is reloaded.\n" - " \n" - "Example:\n" - " \002MODIFY nickserv forcemail no\002")); + source.Reply(_("Allows you to change and view configuration settings. Settings changed by this command are temporary and will not be reflected back into the configuration file, and will be lost if Anope is shut down, restarted, or the configuration is reloaded.\n" + "Use of the \002MODIFY\002 command requires the \002{0}\002 operator privilege.\n" + "\n" + "Example:\n" + " {0} MODIFY nickserv forcemail no" + " Changes the \"forceemail\" setting of the module configuration for \"nickserv\" to \"no\"")); return true; } }; diff --git a/modules/commands/os_defcon.cpp b/modules/commands/os_defcon.cpp index 2732f1a3e..a5608037d 100644 --- a/modules/commands/os_defcon.cpp +++ b/modules/commands/os_defcon.cpp @@ -156,9 +156,9 @@ class CommandOSDefcon : public Command if (DConfig.Check(DEFCON_NO_MLOCK_CHANGE)) source.Reply(_("* No mode lock changes")); if (DConfig.Check(DEFCON_FORCE_CHAN_MODES) && !DConfig.chanmodes.empty()) - source.Reply(_("* Force channel modes (%s) to be set on all channels"), DConfig.chanmodes.c_str()); + source.Reply(_("* Force channel modes (\002{0}\002) to be set on all channels"), DConfig.chanmodes); if (DConfig.Check(DEFCON_REDUCE_SESSION)) - source.Reply(_("* Use the reduced session limit of %d"), DConfig.sessionlimit); + source.Reply(_("* Use the reduced session limit of \002{0}\002"), DConfig.sessionlimit); if (DConfig.Check(DEFCON_NO_NEW_CLIENTS)) source.Reply(_("* Kill any new clients connecting")); if (DConfig.Check(DEFCON_OPER_ONLY)) @@ -186,7 +186,7 @@ class CommandOSDefcon : public Command if (lvl.empty()) { - source.Reply(_("Services are now at DEFCON \002%d\002."), DConfig.defaultlevel); + source.Reply(_("Services are now at defcon \002{0}\002."), DConfig.defaultlevel); this->SendLevels(source); return; } @@ -213,7 +213,7 @@ class CommandOSDefcon : public Command if (DConfig.timeout) timeout = new DefConTimeout(this->ondefconlevel, this->module, 5); - source.Reply(_("Services are now at DEFCON \002%d\002."), DConfig.defaultlevel); + source.Reply(_("Services are now at defcon \002{0}\002."), DConfig.defaultlevel); this->SendLevels(source); Log(LOG_ADMIN, source, this) << "to change defcon level to " << newLevel; @@ -225,7 +225,7 @@ class CommandOSDefcon : public Command Global::service->SendGlobal(NULL, "", DConfig.offmessage); else if (DConfig.defaultlevel != 5) { - Global::service->SendGlobal(NULL, "", Anope::printf(_("The Defcon level is now at: \002%d\002"), DConfig.defaultlevel)); + Global::service->SendGlobal(NULL, "", Anope::printf(_("The defcon level is now at \002%d\002"), DConfig.defaultlevel)); if (!DConfig.message.empty()) Global::service->SendGlobal(NULL, "", DConfig.message); } @@ -238,11 +238,8 @@ class CommandOSDefcon : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("The defcon system can be used to implement a pre-defined\n" - "set of restrictions to services useful during an attempted\n" - "attack on the network.")); + source.Reply(_("The defcon system can be used to implement a pre-defined set of restrictions to services useful during an attempted attack on the network.")); + // XXX actually explain what this does return true; } }; @@ -468,7 +465,7 @@ class OSDefcon : public Module { if (DConfig.Check(DEFCON_NO_NEW_NICKS)) { - source.Reply(_("Services are in DefCon mode, please try again later.")); + source.Reply(_("Services are in defcon mode, please try again later.")); return EVENT_STOP; } } @@ -476,7 +473,7 @@ class OSDefcon : public Module { if (DConfig.Check(DEFCON_NO_MLOCK_CHANGE)) { - source.Reply(_("Services are in DefCon mode, please try again later.")); + source.Reply(_("Services are in defcon mode, please try again later.")); return EVENT_STOP; } } @@ -484,7 +481,7 @@ class OSDefcon : public Module { if (DConfig.Check(DEFCON_NO_NEW_CHANNELS)) { - source.Reply(_("Services are in DefCon mode, please try again later.")); + source.Reply(_("Services are in defcon mode, please try again later.")); return EVENT_STOP; } } @@ -492,7 +489,7 @@ class OSDefcon : public Module { if (DConfig.Check(DEFCON_NO_NEW_MEMOS)) { - source.Reply(_("Services are in DefCon mode, please try again later.")); + source.Reply(_("Services are in defcon mode, please try again later.")); return EVENT_STOP; } } diff --git a/modules/commands/os_dns.cpp b/modules/commands/os_dns.cpp index 0f47eb3e8..d9dabcc66 100644 --- a/modules/commands/os_dns.cpp +++ b/modules/commands/os_dns.cpp @@ -286,17 +286,17 @@ class CommandOSDNS : public Command if (DNSZone::Find(zone)) { - source.Reply(_("Zone %s already exists."), zone.c_str()); + source.Reply(_("Zone \002{0}\002 already exists."), zone); return; } if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); Log(LOG_ADMIN, source, this) << "to add zone " << zone; new DNSZone(zone); - source.Reply(_("Added zone %s."), zone.c_str()); + source.Reply(_("Added zone \002{0}\002."), zone); } void DelZone(CommandSource &source, const std::vector<Anope::string> ¶ms) @@ -306,12 +306,12 @@ class CommandOSDNS : public Command DNSZone *z = DNSZone::Find(zone); if (!z) { - source.Reply(_("Zone %s does not exist."), zone.c_str()); + source.Reply(_("Zone \002{0}\002 does not exist."), zone); return; } if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); Log(LOG_ADMIN, source, this) << "to delete zone " << z->name; @@ -328,7 +328,7 @@ class CommandOSDNS : public Command dnsmanager->Notify(z->name); } - source.Reply(_("Zone %s removed."), z->name.c_str()); + source.Reply(_("Zone \002{0}\002 removed."), z->name); delete z; } @@ -341,24 +341,25 @@ class CommandOSDNS : public Command { if (zone.empty()) { - source.Reply(_("Server %s already exists."), s->GetName().c_str()); + source.Reply(_("Server \002{0}\002 already exists."), s->GetName()); } else { DNSZone *z = DNSZone::Find(zone); if (!z) { - source.Reply(_("Zone %s does not exist."), zone.c_str()); + source.Reply(_("Zone \002{0}\002 does not exist."), zone); return; } - else if (z->servers.count(s->GetName())) + + if (z->servers.count(s->GetName())) { - source.Reply(_("Server %s is already in zone %s."), s->GetName().c_str(), z->name.c_str()); + source.Reply(_("Server \002{0}\002 is already in zone \002{1}\002."), s->GetName(), z->name); return; } if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); z->servers.insert(s->GetName()); s->zones.insert(zone); @@ -371,7 +372,7 @@ class CommandOSDNS : public Command Log(LOG_ADMIN, source, this) << "to add server " << s->GetName() << " to zone " << z->name; - source.Reply(_("Server %s added to zone %s."), s->GetName().c_str(), z->name.c_str()); + source.Reply(_("Server \002{0}\002 added to zone \002{1}\002."), s->GetName(), z->name); } return; @@ -380,7 +381,7 @@ class CommandOSDNS : public Command Server *serv = Server::Find(params[1], true); if (!serv || serv == Me || serv->IsJuped()) { - source.Reply(_("Server %s is not linked to the network."), params[1].c_str()); + source.Reply(_("Server \002{0}\002 is not linked to the network."), params[1]); return; } @@ -388,23 +389,23 @@ class CommandOSDNS : public Command if (zone.empty()) { if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); Log(LOG_ADMIN, source, this) << "to add server " << s->GetName(); - source.Reply(_("Added server %s."), s->GetName().c_str()); + source.Reply(_("Added server \002{0}\002."), s->GetName()); } else { DNSZone *z = DNSZone::Find(zone); if (!z) { - source.Reply(_("Zone %s does not exist."), zone.c_str()); + source.Reply(_("Zone \002{0}\002 does not exist."), zone); delete s; return; } if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); Log(LOG_ADMIN, source, this) << "to add server " << s->GetName() << " to zone " << zone; @@ -426,25 +427,27 @@ class CommandOSDNS : public Command if (!s) { - source.Reply(_("Server %s does not exist."), params[1].c_str()); + source.Reply(_("Server \002{0}\002 does not exist."), params[1]); return; } - else if (!zone.empty()) + + if (!zone.empty()) { DNSZone *z = DNSZone::Find(zone); if (!z) { - source.Reply(_("Zone %s does not exist."), zone.c_str()); + source.Reply(_("Zone \002{0}\002 does not exist."), zone); return; } - else if (!z->servers.count(s->GetName())) + + if (!z->servers.count(s->GetName())) { - source.Reply(_("Server %s is not in zone %s."), s->GetName().c_str(), z->name.c_str()); + source.Reply(_("Server \002{0}\002 is not in zone \002{1}\002."), s->GetName(), z->name); return; } if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); Log(LOG_ADMIN, source, this) << "to remove server " << s->GetName() << " from zone " << z->name; @@ -455,12 +458,13 @@ class CommandOSDNS : public Command } z->servers.erase(s->GetName()); - source.Reply(_("Removed server %s from zone %s."), s->GetName().c_str(), z->name.c_str()); + source.Reply(_("Removed server \002{0}\002 from zone \002{1}\002."), s->GetName(), z->name); return; } - else if (Server::Find(s->GetName(), true)) + + if (Server::Find(s->GetName(), true)) { - source.Reply(_("Server %s must be quit before it can be deleted."), s->GetName().c_str()); + source.Reply(_("Server \002{0}\002 must be quit before it can be deleted."), s->GetName()); return; } @@ -472,13 +476,13 @@ class CommandOSDNS : public Command } if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); if (dnsmanager) dnsmanager->UpdateSerial(); Log(LOG_ADMIN, source, this) << "to delete server " << s->GetName(); - source.Reply(_("Removed server %s."), s->GetName().c_str()); + source.Reply(_("Removed server \002{0}\002."), s->GetName()); delete s; } @@ -488,29 +492,29 @@ class CommandOSDNS : public Command if (!s) { - source.Reply(_("Server %s does not exist."), params[1].c_str()); + source.Reply(_("Server \002{0}\002 does not exist."), params[1]); return; } for (unsigned i = 0; i < s->GetIPs().size(); ++i) if (params[2].equals_ci(s->GetIPs()[i])) { - source.Reply(_("IP %s already exists for %s."), s->GetIPs()[i].c_str(), s->GetName().c_str()); + source.Reply(_("IP \002{0}\002 already exists for \002{1}\002."), s->GetIPs()[i], s->GetName()); return; } sockaddrs addr(params[2]); if (!addr.valid()) { - source.Reply(_("%s is not a valid IP address."), params[2].c_str()); + source.Reply(_("\002{0}\002 is not a valid IP address."), params[2]); return; } if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); s->GetIPs().push_back(params[2]); - source.Reply(_("Added IP %s to %s."), params[2].c_str(), s->GetName().c_str()); + source.Reply(_("Added IP \002{0}\002 to \002{1}\002."), params[2], s->GetName()); Log(LOG_ADMIN, source, this) << "to add IP " << params[2] << " to " << s->GetName(); if (s->Active() && dnsmanager) @@ -527,18 +531,18 @@ class CommandOSDNS : public Command if (!s) { - source.Reply(_("Server %s does not exist."), params[1].c_str()); + source.Reply(_("Server \002{0}\002 does not exist."), params[1]); return; } if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); for (unsigned i = 0; i < s->GetIPs().size(); ++i) if (params[2].equals_ci(s->GetIPs()[i])) { s->GetIPs().erase(s->GetIPs().begin() + i); - source.Reply(_("Removed IP %s from %s."), params[2].c_str(), s->GetName().c_str()); + source.Reply(_("Removed IP \002{0}\002 from \002{1}\002."), params[2], s->GetName()); Log(LOG_ADMIN, source, this) << "to remove IP " << params[2] << " from " << s->GetName(); if (s->GetIPs().empty()) @@ -557,7 +561,7 @@ class CommandOSDNS : public Command return; } - source.Reply(_("IP %s does not exist for %s."), params[2].c_str(), s->GetName().c_str()); + source.Reply(_("IP \002{0}\002 does not exist for \002{1}\002."), params[2], s->GetName()); } void OnSet(CommandSource &source, const std::vector<Anope::string> ¶ms) @@ -566,12 +570,12 @@ class CommandOSDNS : public Command if (!s) { - source.Reply(_("Server %s does not exist."), params[1].c_str()); + source.Reply(_("Server \002{0}\002 does not exist."), params[1]); return; } if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); if (params[2].equals_ci("LIMIT")) { @@ -580,13 +584,13 @@ class CommandOSDNS : public Command unsigned l = convertTo<unsigned>(params[3]); s->SetLimit(l); if (l) - source.Reply(_("User limit for %s set to %d."), s->GetName().c_str(), l); + source.Reply(_("User limit for \002{0}\002 set to \002{1}\002."), s->GetName(), l); else - source.Reply(_("User limit for %s removed."), s->GetName().c_str()); + source.Reply(_("User limit for \002{0}\002 removed."), s->GetName()); } catch (const ConvertException &ex) { - source.Reply(_("Invalid value for LIMIT. Must be numerical.")); + source.Reply(_("Invalid value for limit. Must be numerical.")); } } else @@ -599,31 +603,34 @@ class CommandOSDNS : public Command if (!s) { - source.Reply(_("Server %s does not exist."), params[1].c_str()); + source.Reply(_("Server \002{0}\002 does not exist."), params[1]); return; } - else if (!Server::Find(s->GetName(), true)) + + if (!Server::Find(s->GetName(), true)) { - source.Reply(_("Server %s is not currently linked."), s->GetName().c_str()); + source.Reply(_("Server \002{0}\002 is not currently linked."), s->GetName()); return; } - else if (s->Pooled()) + + if (s->Pooled()) { - source.Reply(_("Server %s is already pooled."), s->GetName().c_str()); + source.Reply(_("Server \002{0}\002 is already pooled."), s->GetName()); return; } - else if (s->GetIPs().empty()) + + if (s->GetIPs().empty()) { - source.Reply(_("Server %s has no configured IPs."), s->GetName().c_str()); + source.Reply(_("Server \002{0}\002 has no configured IPs."), s->GetName()); return; } if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); s->SetActive(true); - source.Reply(_("Pooled %s."), s->GetName().c_str()); + source.Reply(_("Pooled \002{0}\002."), s->GetName()); Log(LOG_ADMIN, source, this) << "to pool " << s->GetName(); } @@ -634,21 +641,22 @@ class CommandOSDNS : public Command if (!s) { - source.Reply(_("Server %s does not exist."), params[1].c_str()); + source.Reply(_("Server \002{0}\002 does not exist."), params[1]); return; } - else if (!s->Pooled()) + + if (!s->Pooled()) { - source.Reply(_("Server %s is not pooled."), s->GetName().c_str()); + source.Reply(_("Server \002{0}\002 is not pooled."), s->GetName()); return; } if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); s->Pool(false); - source.Reply(_("Depooled %s."), s->GetName().c_str()); + source.Reply(_("Depooled \002{0}\002."), s->GetName()); Log(LOG_ADMIN, source, this) << "to depool " << s->GetName(); } @@ -695,22 +703,19 @@ class CommandOSDNS : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("This command allows managing DNS zones used for controlling what servers users\n" - "are directed to when connecting. Omitting all parameters prints out the status of\n" - "the DNS zone.\n" - " \n" - "\002ADDZONE\002 adds a zone, eg us.yournetwork.tld. Servers can then be added to this\n" - "zone with the \002ADDSERVER\002 command.\n" - " \n" - "The \002ADDSERVER\002 command adds a server to the given zone. When a query is done, the\n" - "zone in question is served if it exists, else all servers in all zones are served.\n" - "A server may be in more than one zone.\n" - " \n" - "The \002ADDIP\002 command associates an IP with a server.\n" - " \n" - "The \002POOL\002 and \002DEPOOL\002 commands actually add and remove servers to their given zones.")); + source.Reply(_("This command allows managing DNS zones used for controlling what servers users are directed to when connecting." + " Omitting all parameters prints out the status of the DNS zone.\n" + "\n" + "\002{0} ADDZONE\002 adds a zone, eg. us.example.com. Servers can then be added to this zone with the \002ADDSERVER\002 command.\n" + "\n" + "The \002{0} ADDSERVER\002 command adds a server to the given zone." + " When a DNS query is done, the zone in question is served if it exists, otherwise all servers in all zones are served." + " A server may be in more than one zone.\n" + "\n" + "The \002{0} ADDIP\002 command associates an IP with a server.\n" + " \n" + "The \002{0} POOL\002 and \002{0} DEPOOL\002 commands actually add and remove servers to their given zones."), + source.command); return true; } }; diff --git a/modules/commands/os_forbid.cpp b/modules/commands/os_forbid.cpp index 212beb1ed..c72c7628a 100644 --- a/modules/commands/os_forbid.cpp +++ b/modules/commands/os_forbid.cpp @@ -159,7 +159,7 @@ class CommandOSForbid : public Command if (!bi) bi = Config->GetClient("OperServ"); if (bi) - u->SendMessage(bi, _("This nickname has been forbidden: %s"), d->reason.c_str()); + u->SendMessage(bi, _("This nickname has been forbidden: \002{0}\002"), d->reason); if (NickServ::service) NickServ::service->Collide(u, NULL); } @@ -207,7 +207,7 @@ class CommandOSForbid : public Command expiryt = Anope::DoTime(expiry); if (expiryt == -1) { - source.Reply(BAD_EXPIRY_TIME); + source.Reply(_("Invalid expiry time \002{0}\002."), expiry); return; } else if (expiryt) @@ -217,7 +217,7 @@ class CommandOSForbid : public Command NickServ::Nick *target = NickServ::FindNick(entry); if (target != NULL && Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && target->nc->IsServicesOper()) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied.")); return; } @@ -239,10 +239,10 @@ class CommandOSForbid : public Command this->fs->AddForbid(d); if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); Log(LOG_ADMIN, source, this) << "to add a forbid on " << entry << " of type " << subcommand; - source.Reply(_("Added a forbid on %s of type %s to expire on %s."), entry.c_str(), subcommand.lower().c_str(), d->expires ? Anope::strftime(d->expires, source.GetAccount()).c_str() : "never"); + source.Reply(_("Added a forbid on \002{0}\002 of type \002{1}\002 to expire on \002{2}\002."), entry, subcommand.lower(), d->expires ? Anope::strftime(d->expires, source.GetAccount()) : "never"); /* apply forbid */ switch (ftype) @@ -268,7 +268,7 @@ class CommandOSForbid : public Command delete na; } - source.Reply(_("\002%d\002 nickname(s) dropped."), na_matches); + source.Reply(_("\002{0}\002 nickname(s) dropped."), na_matches); break; } case FT_CHAN: @@ -306,7 +306,7 @@ class CommandOSForbid : public Command if (u->server == Me || u->HasMode("OPER")) continue; - 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: \002%s\002")), d->reason.c_str()); c->Kick(source.service, u, "%s", reason.c_str()); } @@ -326,7 +326,7 @@ class CommandOSForbid : public Command delete ci; } - source.Reply(_("\002%d\002 channel(s) cleared, and \002%d\002 channel(s) dropped."), chan_matches, ci_matches); + source.Reply(_("\002{0}\002 channel(s) cleared, and \002{1}\002 channel(s) dropped."), chan_matches, ci_matches); break; } @@ -343,14 +343,14 @@ class CommandOSForbid : public Command if (d != NULL) { if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); Log(LOG_ADMIN, source, this) << "to remove forbid on " << d->mask << " of type " << subcommand; - source.Reply(_("%s deleted from the %s forbid list."), d->mask.c_str(), subcommand.c_str()); + source.Reply(_("\002{0}\002 deleted from the \002{1}\002 forbid list."), d->mask, subcommand); this->fs->RemoveForbid(d); } else - source.Reply(_("Forbid on %s was not found."), entry.c_str()); + source.Reply(_("Forbid on \002{0}\002 was not found."), entry); } else if (command.equals_ci("LIST")) { @@ -394,7 +394,7 @@ class CommandOSForbid : public Command if (!shown) { - source.Reply(_("There are no forbids of type %s."), subcommand.upper().c_str()); + source.Reply(_("There are no forbids of type \002{0}\002."), subcommand.upper()); } else { @@ -409,29 +409,23 @@ class CommandOSForbid : public Command if (shown >= forbids.size()) source.Reply(_("End of forbid list.")); else - source.Reply(_("End of forbid list - %d/%d entries shown."), shown, forbids.size()); + source.Reply(_("End of forbid list - \002{0}\002/\002{1}\002 entries shown."), shown, forbids.size()); } } } else this->OnSyntaxError(source, command); - - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Forbid allows you to forbid usage of certain nicknames, channels,\n" - "and email addresses. Wildcards are accepted for all entries.")); + source.Reply(_("Forbid allows you to forbid usage of certain nicknames, channels, and email addresses. Wildcards are accepted for all entries.")); const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine"); if (!regexengine.empty()) { source.Reply(" "); - source.Reply(_("Regex matches are also supported using the %s engine.\n" - "Enclose your pattern in // if this is desired."), regexengine.c_str()); + source.Reply(_("Regex matches are also supported using the %s engine. Enclose your pattern in // if this is desired."), regexengine); } return true; @@ -535,7 +529,7 @@ class OSForbid : public Module ForbidData *d = this->forbidService.FindForbid(source.GetNick(), FT_REGISTER); if (d != NULL) { - source.Reply(NICK_CANNOT_BE_REGISTERED, source.GetNick().c_str()); + source.Reply(_("\002{0}\002 may not be registered."), source.GetNick()); return EVENT_STOP; } @@ -560,7 +554,7 @@ class OSForbid : public Module ForbidData *d = this->forbidService.FindForbid(params[0], FT_REGISTER); if (d != NULL) { - source.Reply(CHAN_X_INVALID, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 is currently suspended."), params[0]); return EVENT_STOP; } } diff --git a/modules/commands/os_ignore.cpp b/modules/commands/os_ignore.cpp index 728fe1c1c..0b36a9d0a 100644 --- a/modules/commands/os_ignore.cpp +++ b/modules/commands/os_ignore.cpp @@ -207,19 +207,19 @@ class CommandOSIgnore : public Command if (t <= -1) { - source.Reply(BAD_EXPIRY_TIME); + source.Reply(_("Invalid expiry time \002{0}\002."), time); return; } Anope::string mask = RealMask(nick); if (mask.empty()) { - source.Reply(BAD_USERHOST_MASK); + source.Reply(_("Mask must be in the form \037user\037@\037host\037.")); return; } if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); IgnoreData *ign = new IgnoreDataImpl(); ign->mask = mask; @@ -230,12 +230,12 @@ class CommandOSIgnore : public Command ignore_service->AddIgnore(ign); if (!t) { - source.Reply(_("\002%s\002 will now permanently be ignored."), mask.c_str()); + source.Reply(_("\002{0}\002 will now permanently be ignored."), mask); Log(LOG_ADMIN, source, this) << "to add a permanent ignore for " << mask; } else { - source.Reply(_("\002%s\002 will now be ignored for \002%s\002."), mask.c_str(), Anope::Duration(t, source.GetAccount()).c_str()); + source.Reply(_("\002{0}\002 will now be ignored for \002{1}\002."), mask, Anope::Duration(t, source.GetAccount())); Log(LOG_ADMIN, source, this) << "to add an ignore on " << mask << " for " << Anope::Duration(t); } } @@ -302,7 +302,7 @@ class CommandOSIgnore : public Command Anope::string mask = RealMask(nick); if (mask.empty()) { - source.Reply(BAD_USERHOST_MASK); + source.Reply(_("Mask must be in the form \037user\037@\037host\037.")); return; } @@ -310,14 +310,14 @@ class CommandOSIgnore : public Command if (ign) { if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); Log(LOG_ADMIN, source, this) << "to remove an ignore on " << mask; - source.Reply(_("\002%s\002 will no longer be ignored."), mask.c_str()); + source.Reply(_("\002{0}\002 will no longer be ignored."), mask); delete ign; } else - source.Reply(_("\002%s\002 not found on ignore list."), mask.c_str()); + source.Reply(_("\002{0}\002 not found on ignore list."), mask); } void DoClear(CommandSource &source) @@ -326,13 +326,11 @@ class CommandOSIgnore : public Command return; if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); ignore_service->ClearIgnores(); Log(LOG_ADMIN, source, this) << "to CLEAR the list"; source.Reply(_("Ignore list has been cleared.")); - - return; } public: @@ -365,26 +363,18 @@ class CommandOSIgnore : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Allows Services Operators to make Services ignore a nick or mask\n" - "for a certain time or until the next restart. The default\n" - "time format is seconds. You can specify it by using units.\n" - "Valid units are: \037s\037 for seconds, \037m\037 for minutes,\n" - "\037h\037 for hours and \037d\037 for days.\n" - "Combinations of these units are not permitted.\n" - "To make Services permanently ignore the user, type 0 as time.\n" - "When adding a \037mask\037, it should be in the format nick!user@host,\n" - "everything else will be considered a nick. Wildcards are permitted.\n" - " \n" - "Ignores will not be enforced on IRC Operators.")); + source.Reply(_("The \002{0}\002 command allows you to make services ignore a user or hostmask." + " \037expiry\037 must be an integer and can be followed by one of \037d\037 (days), \037h\037 (hours), or \037m\037 (minutes)." + " If a unit specifier is not included, the default is seconds." + " To make services permanently ignore the user, use 0 as the expiry time." + " When adding a \037mask\037, it should be in the format nick!user@host, everything else will be considered a nicknames. Wildcards are permitted."), + source.command); const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine"); if (!regexengine.empty()) { source.Reply(" "); - source.Reply(_("Regex matches are also supported using the %s engine.\n" - "Enclose your pattern in // if this is desired."), regexengine.c_str()); + source.Reply(_("Regex matches are also supported using the %s engine. Enclose your pattern in // if this is desired."), regexengine); } return true; diff --git a/modules/commands/os_info.cpp b/modules/commands/os_info.cpp index 03e98377e..c13f9a796 100644 --- a/modules/commands/os_info.cpp +++ b/modules/commands/os_info.cpp @@ -116,7 +116,7 @@ class CommandOSInfo : public Command ChanServ::Channel *ci = ChanServ::Find(target); if (!ci) { - source.Reply(CHAN_X_NOT_REGISTERED, target.c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), target); return; } @@ -127,7 +127,7 @@ class CommandOSInfo : public Command NickServ::Nick *na = NickServ::FindNick(target); if (!na) { - source.Reply(NICK_X_NOT_REGISTERED, target.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), target); return; } @@ -146,7 +146,7 @@ class CommandOSInfo : public Command if ((*oi)->size() >= Config->GetModule(this->module)->Get<unsigned>("max", "10")) { - source.Reply(_("The oper info list for \002%s\002 is full."), target.c_str()); + source.Reply(_("The oper info list for \002{0}\002 is full."), target); return; } @@ -156,18 +156,18 @@ class CommandOSInfo : public Command if (o->info.equals_ci(info)) { - source.Reply(_("The oper info already exists on \002%s\002."), target.c_str()); + source.Reply(_("The oper info already exists on \002{0}\002."), target); return; } } (*oi)->push_back(new OperInfo(target, info, source.GetNick(), Anope::CurTime)); - source.Reply(_("Added info to \002%s\002."), target.c_str()); + source.Reply(_("Added info to \002{0}\002."), target); Log(LOG_ADMIN, source, this) << "to add information to " << target; if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); } else if (cmd.equals_ci("DEL")) { @@ -181,7 +181,7 @@ class CommandOSInfo : public Command if (!oi) { - source.Reply(_("Oper info list for \002%s\002 is empty."), target.c_str()); + source.Reply(_("Oper info list for \002{0}\002 is empty."), target); return; } @@ -200,18 +200,18 @@ class CommandOSInfo : public Command if (!found) { - source.Reply(_("No such info \"%s\" on \002%s\002."), info.c_str(), target.c_str()); + source.Reply(_("No such info \002{0}\002 on \002{1}\002."), info, target); } else { if ((*oi)->empty()) e->Shrink<OperInfos>("operinfo"); - source.Reply(_("Deleted info from \002%s\002."), target.c_str()); + source.Reply(_("Deleted info from \002{0}\002."), target); Log(LOG_ADMIN, source, this) << "to remove information from " << target; if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); } } else if (cmd.equals_ci("CLEAR")) @@ -220,17 +220,17 @@ class CommandOSInfo : public Command if (!oi) { - source.Reply(_("Oper info list for \002%s\002 is empty."), target.c_str()); + source.Reply(_("Oper info list for \002{0}\002 is empty."), target); return; } e->Shrink<OperInfos>("operinfo"); - source.Reply(_("Cleared info from \002%s\002."), target.c_str()); + source.Reply(_("Cleared info from \002{0}\002."), target); Log(LOG_ADMIN, source, this) << "to clear information for " << target; if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); } else { @@ -240,11 +240,7 @@ class CommandOSInfo : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Add or delete oper information for a given nick or channel.\n" - "This will show to opers in the respective info command for\n" - "the nick or channel.")); + source.Reply(_("Add or delete oper information for a given accpint or channel. This informaition will show to opers in the respective info command for the account or channel.")); return true; } }; diff --git a/modules/commands/os_jupe.cpp b/modules/commands/os_jupe.cpp index 08fb6a4ce..38766faa3 100644 --- a/modules/commands/os_jupe.cpp +++ b/modules/commands/os_jupe.cpp @@ -27,9 +27,9 @@ class CommandOSJupe : public Command Server *server = Server::Find(jserver, true); if (!IRCD->IsHostValid(jserver) || jserver.find('.') == Anope::string::npos) - source.Reply(_("Please use a valid server name when juping.")); - else if (server == Me || server == Servers::GetUplink()) - source.Reply(_("You can not jupe your Services' pseudoserver or your uplink server.")); + source.Reply(_("\002{0}\002 is not a valid server name."), jserver); + else if (server == Me || server == Servers::GetUplink() || server->IsULined()) + source.Reply(_("You can not jupe Servoces or its uplink server.")); else if (server && server->IsJuped()) source.Reply(_("You can not jupe an already juped server.")); else @@ -51,16 +51,8 @@ class CommandOSJupe : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Tells Services to jupiter a server -- that is, to create\n" - "a fake \"server\" connected to Services which prevents\n" - "the real server of that name from connecting. The jupe\n" - "may be removed using a standard \002SQUIT\002. If a reason is\n" - "given, it is placed in the server information field;\n" - "otherwise, the server information field will contain the\n" - "text \"Juped by <nick>\", showing the nickname of the\n" - "person who jupitered the server.")); + source.Reply(_("Tells services to jupiter a server -- that is, to create a fake \"server\" connected to Services which prevents the real server of that name from connecting." + " The jupe may be removed using a standard \002SQUIT\002. If a reason is given, it is placed in the server information field; otherwise, the server information field will contain the text \"Juped by <nick>\", showing the nickname of the person who jupitered the server.")); return true; } }; diff --git a/modules/commands/os_kick.cpp b/modules/commands/os_kick.cpp index a1ae346a9..82c7d4408 100644 --- a/modules/commands/os_kick.cpp +++ b/modules/commands/os_kick.cpp @@ -30,35 +30,33 @@ class CommandOSKick : public Command if (!(c = Channel::Find(chan))) { - source.Reply(CHAN_X_NOT_IN_USE, chan.c_str()); + source.Reply(_("Channel \002%s\002 doesn't exist."), chan); return; } - else if (c->bouncy_modes) + + if (c->bouncy_modes) { source.Reply(_("Services is unable to change modes. Are your servers' U:lines configured correctly?")); return; } - else if (!(u2 = User::Find(nick, true))) + + if (!(u2 = User::Find(nick, true))) { - source.Reply(NICK_X_NOT_IN_USE, nick.c_str()); + source.Reply(_("\002{0}\002 isn't currently online."), nick); return; } c->Kick(source.service, u2, "%s (%s)", source.GetNick().c_str(), s.c_str()); Log(LOG_ADMIN, source, this) << "on " << u2->nick << " in " << c->name << " (" << s << ")"; - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Allows staff to kick a user from any channel.\n" - "Parameters are the same as for the standard /KICK\n" - "command. The kick message will have the nickname of the\n" - "IRCop sending the KICK command prepended; for example:\n" - " \n" - "*** SpamMan has been kicked off channel #my_channel by %s (Alcan (Flood))"), source.service->nick.c_str()); + source.Reply(_("Allows you to kick a user from any channel. Parameters are the same as for the standard /KICK command." + " The kick message will have the nickname of the IRCop sending the KICK command prepended; for example:\n" + "\n" + "*** SpamMan has been kicked off channel #my_channel by {0} (Alcan (Flood))"), + source.service->nick); return true; } }; diff --git a/modules/commands/os_kill.cpp b/modules/commands/os_kill.cpp index 491e8b1c4..557b09901 100644 --- a/modules/commands/os_kill.cpp +++ b/modules/commands/os_kill.cpp @@ -27,9 +27,9 @@ class CommandOSKill : public Command User *u2 = User::Find(nick, true); if (u2 == NULL) - source.Reply(NICK_X_NOT_IN_USE, nick.c_str()); + source.Reply(_("\002{0}\002 isn't currently online."), nick); else if (u2->IsProtected() || u2->server == Me) - source.Reply(ACCESS_DENIED); + source.Reply(_("\002{0}\002 is protected and cannot be killed."), u2->nick); else { if (reason.empty()) @@ -43,11 +43,7 @@ class CommandOSKill : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Allows you to kill a user from the network.\n" - "Parameters are the same as for the standard /KILL\n" - "command.")); + source.Reply(_("Allows you to kill a user from the network. Parameters are the same as for the standard /KILL command.")); return true; } }; diff --git a/modules/commands/os_list.cpp b/modules/commands/os_list.cpp index fc077eac9..1ad4b3238 100644 --- a/modules/commands/os_list.cpp +++ b/modules/commands/os_list.cpp @@ -43,7 +43,7 @@ class CommandOSChanList : public Command if (!pattern.empty() && (u2 = User::Find(pattern, true))) { - source.Reply(_("\002%s\002 channel list:"), u2->nick.c_str()); + source.Reply(_("Channel list for \002{0}\002:"), u2->nick); for (User::ChanUserList::iterator uit = u2->chans.begin(), uit_end = u2->chans.end(); uit != uit_end; ++uit) { @@ -97,22 +97,16 @@ class CommandOSChanList : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Lists all channels currently in use on the IRC network, whether they\n" - "are registered or not.\n" - " \n" - "If \002pattern\002 is given, lists only channels that match it. If a nickname\n" - "is given, lists only the channels the user using it is on. If SECRET is\n" - "specified, lists only channels matching \002pattern\002 that have the +s or\n" - "+p mode.")); + source.Reply(_("Lists all channels currently in use on the IRC network, whether they are registered or not.\n" + "\n" + "If \002pattern\002 is given, lists only channels that match it. If a nicknam is given, lists only the channels the user using it is on." + " If SECRET is specified, lists only channels matching \002pattern\002 that have the +s or +p mode.")); const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine"); if (!regexengine.empty()) { source.Reply(" "); - source.Reply(_("Regex matches are also supported using the %s engine.\n" - "Enclose your pattern in // if this is desired."), regexengine.c_str()); + source.Reply(_("Regex matches are also supported using the {0} engine. Enclose your pattern in // if this is desired."), regexengine); } return true; @@ -148,7 +142,7 @@ class CommandOSUserList : public Command if (!pattern.empty() && (c = Channel::Find(pattern))) { - source.Reply(_("\002%s\002 users list:"), pattern.c_str()); + source.Reply(_("User list for \002{0}\002:"), pattern); for (Channel::ChanUserList::iterator cuit = c->users.begin(), cuit_end = c->users.end(); cuit != cuit_end; ++cuit) { @@ -210,13 +204,10 @@ class CommandOSUserList : public Command { this->SendSyntax(source); source.Reply(" "); - source.Reply(_("Lists all users currently online on the IRC network, whether their\n" - "nick is registered or not.\n" - " \n" - "If \002pattern\002 is given, lists only users that match it (it must be in\n" - "the format nick!user@host). If \002channel\002 is given, lists only users\n" - "that are on the given channel. If INVISIBLE is specified, only users\n" - "with the +i flag will be listed.")); + source.Reply(_("Lists all users currently online on the IRC network, whether their nickname is registered or not.\n" + "\n" + "If \002pattern\002 is given, lists only users that match it (it must be in the format nick!user@host)." + " If \002channel\002 is given, lists only users that are on the given channel. If INVISIBLE is specified, only users with the +i flag will be listed.")); const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine"); if (!regexengine.empty()) diff --git a/modules/commands/os_login.cpp b/modules/commands/os_login.cpp index e55459d24..02da958a7 100644 --- a/modules/commands/os_login.cpp +++ b/modules/commands/os_login.cpp @@ -28,14 +28,14 @@ class CommandOSLogin : public Command User *u = source.GetUser(); Oper *o = source.nc->o; if (o == NULL) - source.Reply(_("No oper block for your nick.")); + source.Reply(_("No oper block for your nickname.")); else if (o->password.empty()) source.Reply(_("Your oper block doesn't require logging in.")); else if (u->HasExt("os_login")) - source.Reply(_("You are already identified.")); + source.Reply(_("You are already logged in.")); else if (o->password != password) { - source.Reply(PASSWORD_INCORRECT); + source.Reply(_("Password incorrect.")); u->BadPassword(); } else @@ -48,11 +48,7 @@ class CommandOSLogin : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Logs you in to %s so you gain Services Operator privileges.\n" - "This command may be unnecessary if your oper block is\n" - "configured without a password."), source.service->nick.c_str()); + source.Reply(_("Logs you in to {0} so you gain Services Operator privileges. This command is unnecessary if your oper block is configured without a password."), source.service->nick); return true; } @@ -90,11 +86,7 @@ class CommandOSLogout : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Logs you out from %s so you lose Services Operator privileges.\n" - "This command is only useful if your oper block is configured\n" - "with a password."), source.service->nick.c_str()); + source.Reply(_("Logs you out from %s so you lose Services Operator privileges. This command is only useful if your oper block is configured with a password."), source.service->nick); return true; } diff --git a/modules/commands/os_logsearch.cpp b/modules/commands/os_logsearch.cpp index 5650feaa2..fe2c95365 100644 --- a/modules/commands/os_logsearch.cpp +++ b/modules/commands/os_logsearch.cpp @@ -52,7 +52,7 @@ class CommandOSLogSearch : public Command } catch (const ConvertException &) { - source.Reply(_("Invalid duration %s, using %d days."), dur.c_str(), days); + source.Reply(_("Invalid duration \002{0}\002, using \002{1}\002 days."), dur, days); } } break; @@ -68,12 +68,12 @@ class CommandOSLogSearch : public Command } catch (const ConvertException &) { - source.Reply(_("Invalid limit %s, using %d."), dur.c_str(), replies); + source.Reply(_("Invalid limit \002{0}\002, using \002{1}\002."), dur, replies); } } break; default: - source.Reply(_("Unknown parameter: %s"), params[i].c_str()); + source.Reply(_("Unknown parameter: {0}"), params[i]); } } @@ -109,35 +109,30 @@ class CommandOSLogSearch : public Command unsigned found = matches.size(); if (!found) { - source.Reply(_("No matches for \002%s\002 found."), search_string.c_str()); + source.Reply(_("No matches for \002{0}\002 found."), search_string); return; } while (matches.size() > static_cast<unsigned>(replies)) matches.pop_front(); - source.Reply(_("Matches for \002%s\002:"), search_string.c_str()); + source.Reply(_("Matches for \002{0}\002:"), search_string); unsigned count = 0; for (std::list<Anope::string>::iterator it = matches.begin(), it_end = matches.end(); it != it_end; ++it) source.Reply("#%d: %s", ++count, it->c_str()); - source.Reply(_("Showed %d/%d matches for \002%s\002."), matches.size(), found, search_string.c_str()); + source.Reply(_("Showed \002{0}/{1}\002 matches for \002{2}\002."), matches.size(), found, search_string); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("This command searches the Services logfiles for messages\n" - "that match the given pattern. The day and limit argument\n" - "may be used to specify how many days of logs to search\n" - "and the number of replies to limit to. By default this\n" - "command searches one week of logs, and limits replies\n" - "to 50.\n" - " \n" - "For example:\n" - " \002LOGSEARCH +21d +500l Anope\002\n" - " Searches the last 21 days worth of logs for messages\n" - " containing Anope and lists the most recent 500 of them.")); + source.Reply(_("This command searches the Services logfiles for messages that match the given pattern." + " The day and limit argument may be used to specify how many days of logs to search and the number of replies to limit to." + " By default this command searches one week of logs, and limits replies to 50.\n" + "\n" + "Example:\n" + " {0} +21d +500l Anope\n" + " Searches the last 21 days worth of logs for messages containing \"Anope\" and lists the most recent 500 of them."), + source.command); return true; } }; diff --git a/modules/commands/os_mode.cpp b/modules/commands/os_mode.cpp index 9a5d8c41f..d4551e69f 100644 --- a/modules/commands/os_mode.cpp +++ b/modules/commands/os_mode.cpp @@ -28,7 +28,7 @@ class CommandOSMode : public Command Channel *c = Channel::Find(target); if (!c) - source.Reply(CHAN_X_NOT_IN_USE, target.c_str()); + source.Reply(_("Channel \002{0}\002 doesn't exist."), target); else if (c->bouncy_modes) source.Reply(_("Services is unable to change modes. Are your servers' U:lines configured correctly?")); else if (modes.equals_ci("CLEAR")) @@ -52,10 +52,10 @@ class CommandOSMode : public Command c->RemoveMode(c->ci->WhoSends(), ModeManager::FindChannelModeByChar(uc->status.Modes()[i - 1]), uc->user->GetUID(), false); } - source.Reply(_("All modes cleared on %s."), c->name.c_str()); + source.Reply(_("All modes cleared on \002{0}\002."), c->name); } else - source.Reply(_("Non-status modes cleared on %s."), c->name.c_str()); + source.Reply(_("Non-status modes cleared on \002{0}\002."), c->name); } else { @@ -122,10 +122,7 @@ class CommandOSMode : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Allows Services Operators to change modes for any channel.\n" - "Parameters are the same as for the standard /MODE command.\n" + source.Reply(_("Allows Services Operators to change modes for any channel. Parameters are the same as for the standard /MODE command.\n" "Alternatively, CLEAR may be given to clear all modes on the channel.\n" "If CLEAR ALL is given then all modes, including user status, is removed.")); return true; @@ -148,13 +145,13 @@ class CommandOSUMode : public Command User *u2 = User::Find(target, true); if (!u2) - source.Reply(NICK_X_NOT_IN_USE, target.c_str()); + source.Reply(_("\002{0}\002 isn't currently online."), target); else { u2->SetModes(source.service, "%s", modes.c_str()); - source.Reply(_("Changed usermodes of \002%s\002 to %s."), u2->nick.c_str(), modes.c_str()); + source.Reply(_("Changed usermodes of \002{0}\002 to \002{1}\002."), u2->nick.c_str(), modes.c_str()); - u2->SendMessage(*source.service, _("\002%s\002 changed your usermodes to %s."), source.GetNick().c_str(), modes.c_str()); + u2->SendMessage(*source.service, _("\002{0}\002 changed your usermodes to \002{1}\002."), source.GetNick(), modes); Log(LOG_ADMIN, source, this) << modes << " on " << target; } @@ -162,10 +159,7 @@ class CommandOSUMode : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Allows Services Operators to change modes for any user.\n" - "Parameters are the same as for the standard /MODE command.")); + source.Reply(_("Allows Services Operators to change modes for any user. Parameters are the same as for the standard /MODE command.")); return true; } }; diff --git a/modules/commands/os_modinfo.cpp b/modules/commands/os_modinfo.cpp index e8c2caa69..f72e7d8f6 100644 --- a/modules/commands/os_modinfo.cpp +++ b/modules/commands/os_modinfo.cpp @@ -29,9 +29,9 @@ class CommandOSModInfo : public Command Module *m = ModuleManager::FindModule(file); if (m) { - source.Reply(_("Module: \002%s\002 Version: \002%s\002 Author: \002%s\002 Loaded: \002%s\002"), m->name.c_str(), !m->version.empty() ? m->version.c_str() : "?", !m->author.empty() ? m->author.c_str() : "Unknown", Anope::strftime(m->created, source.GetAccount()).c_str()); + source.Reply(_("Module: \002{0}\002 Version: \002{1}\002 Author: \002{2}\002 Loaded: \002{3}\002"), m->name, !m->version.empty() ? m->version : "?", !m->author.empty() ? m->author : "Unknown", Anope::strftime(m->created, source.GetAccount())); if (Anope::Debug) - source.Reply(_(" Loaded at: %p"), m->handle); + source.Reply(_(" Loaded at: {0}"), Anope::printf("%o", m->handle)); std::vector<Anope::string> servicekeys = Service::GetServiceKeys("Command"); for (unsigned i = 0; i < servicekeys.size(); ++i) @@ -40,7 +40,7 @@ class CommandOSModInfo : public Command if (!c || c->owner != m) continue; - source.Reply(_(" Providing service: \002%s\002"), c->name.c_str()); + source.Reply(_(" Providing service: \002{0}\002"), c->name); for (botinfo_map::const_iterator it = BotListByNick->begin(), it_end = BotListByNick->end(); it != it_end; ++it) { @@ -52,21 +52,17 @@ class CommandOSModInfo : public Command const CommandInfo &info = cit->second; if (info.name != c->name) continue; - source.Reply(_(" Command \002%s\002 on \002%s\002 is linked to \002%s\002"), c_name.c_str(), bi->nick.c_str(), c->name.c_str()); + source.Reply(_(" Command \002{0}\002 on \002{1}\002 is linked to \002{2}\002"), c_name, bi->nick, c->name); } } } } else - source.Reply(_("No information about module \002%s\002 is available."), file.c_str()); - - return; + source.Reply(_("No information about module \002{0}\002 is available."), file); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); source.Reply(_("This command lists information about the specified loaded module.")); return true; } @@ -180,19 +176,17 @@ class CommandOSModList : public Command ++count; - source.Reply(_("Module: \002%s\002 [%s] [%s]"), m->name.c_str(), m->version.c_str(), mtype.c_str()); + source.Reply(_("Module: \002{0}\002 [{1}] [{2}]"), m->name, m->version, mtype); } if (!count) source.Reply(_("No modules currently loaded matching that criteria.")); else - source.Reply(_("%d modules loaded."), count); + source.Reply(_("\002{0}\002 modules loaded."), count); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); source.Reply(_("Lists currently loaded modules.")); return true; } diff --git a/modules/commands/os_module.cpp b/modules/commands/os_module.cpp index 826fcabbb..14bc897e3 100644 --- a/modules/commands/os_module.cpp +++ b/modules/commands/os_module.cpp @@ -28,22 +28,17 @@ class CommandOSModLoad : public Command if (status == MOD_ERR_OK) { Log(LOG_ADMIN, source, this) << "to load module " << mname; - source.Reply(_("Module \002%s\002 loaded."), mname.c_str()); + source.Reply(_("Module \002{0}\002 loaded."), mname); } else if (status == MOD_ERR_EXISTS) - source.Reply(_("Module \002%s\002 is already loaded."), mname.c_str()); + source.Reply(_("Module \002{0}\002 is already loaded."), mname); else - source.Reply(_("Unable to load module \002%s\002."), mname.c_str()); - - return; + source.Reply(_("Unable to load module \002{0}\002."), mname); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("This command loads the module named \037modname\037 from the modules\n" - "directory.")); + source.Reply(_("This command loads the module named \037modname\037.")); return true; } }; @@ -64,20 +59,20 @@ class CommandOSModReLoad : public Command Module *m = ModuleManager::FindModule(mname); if (!m) { - source.Reply(_("Module \002%s\002 isn't loaded."), mname.c_str()); + source.Reply(_("Module \002{0}\002 isn't loaded."), mname); return; } if (!m->handle || m->GetPermanent()) { - source.Reply(_("Unable to remove module \002%s\002."), m->name.c_str()); + source.Reply(_("Unable to remove module \002{0}\002."), m->name); return; } Module *protocol = ModuleManager::FindFirstOf(PROTOCOL); if (m->type == PROTOCOL && m != protocol) { - source.Reply(_("You can not reload this module directly, instead reload %s."), protocol ? protocol->name.c_str() : "(unknown)"); + source.Reply(_("You can not reload this module directly, instead reload {0}."), protocol ? protocol->name : "(unknown)"); return; } @@ -87,7 +82,7 @@ class CommandOSModReLoad : public Command if (status != MOD_ERR_OK) { - source.Reply(_("Unable to remove module \002%s\002."), mname.c_str()); + source.Reply(_("Unable to remove module \002{0}\002."), mname); return; } @@ -95,7 +90,7 @@ class CommandOSModReLoad : public Command if (status == MOD_ERR_OK) { Log(LOG_ADMIN, source, this) << "to reload module " << mname; - source.Reply(_("Module \002%s\002 reloaded."), mname.c_str()); + source.Reply(_("Module \002{0}\002 reloaded."), mname); } else { @@ -105,16 +100,12 @@ class CommandOSModReLoad : public Command Anope::Quitting = true; } else - source.Reply(_("Unable to load module \002%s\002."), mname.c_str()); + source.Reply(_("Unable to load module \002{0}\002."), mname); } - - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); source.Reply(_("This command reloads the module named \037modname\037.")); return true; } @@ -136,13 +127,13 @@ class CommandOSModUnLoad : public Command Module *m = ModuleManager::FindModule(mname); if (!m) { - source.Reply(_("Module \002%s\002 isn't loaded."), mname.c_str()); + source.Reply(_("Module \002{0}\002 isn't loaded."), mname); return; } if (!m->handle || m->GetPermanent() || m->type == PROTOCOL) { - source.Reply(_("Unable to remove module \002%s\002."), m->name.c_str()); + source.Reply(_("Unable to remove module \002{0}\002."), m->name); return; } @@ -153,18 +144,16 @@ class CommandOSModUnLoad : public Command if (status == MOD_ERR_OK) { Log(LOG_ADMIN, source, this) << "to unload module " << mname; - source.Reply(_("Module \002%s\002 unloaded."), mname.c_str()); + source.Reply(_("Module \002{0}\002 unloaded."), mname); } else - source.Reply(_("Unable to remove module \002%s\002."), mname.c_str()); + source.Reply(_("Unable to remove module \002{0}\002."), mname); return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); source.Reply(_("This command unloads the module named \037modname\037.")); return true; } diff --git a/modules/commands/os_news.cpp b/modules/commands/os_news.cpp index 0550146f3..b82951c9f 100644 --- a/modules/commands/os_news.cpp +++ b/modules/commands/os_news.cpp @@ -32,8 +32,8 @@ struct NewsMessages msgarray[] = { _("Logon news items:"), _("There is no logon news."), _("Added new logon news item."), - _("Logon news item #%s not found!"), - _("Logon news item #%d deleted."), + _("Logon news item #{0} not found!"), + _("Logon news item #{0} deleted."), _("No logon news items to delete!"), _("All logon news items deleted.")} }, @@ -42,8 +42,8 @@ struct NewsMessages msgarray[] = { _("Oper news items:"), _("There is no oper news."), _("Added new oper news item."), - _("Oper news item #%s not found!"), - _("Oper news item #%d deleted."), + _("Oper news item #{0} not found!"), + _("Oper news item #{0} deleted."), _("No oper news items to delete!"), _("All oper news items deleted.")} }, @@ -52,8 +52,8 @@ struct NewsMessages msgarray[] = { _("Random news items:"), _("There is no random news."), _("Added new random news item."), - _("Random news item #%s not found!"), - _("Random news item #%d deleted."), + _("Random news item #{0} not found!"), + _("Random news item #{0} deleted."), _("No random news items to delete!"), _("All random news items deleted.")} } @@ -188,7 +188,7 @@ class NewsBase : public Command else { if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); NewsItem *news = new MyNewsItem(); news->type = ntype; @@ -219,7 +219,7 @@ class NewsBase : public Command else { if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); if (!text.equals_ci("ALL")) { try @@ -304,14 +304,10 @@ class CommandOSLogonNews : public NewsBase bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Edits or displays the list of logon news messages. When a\n" - "user connects to the network, these messages will be sent\n" - "to them. However, no more than \002%d\002 messages will be\n" - "sent in order to avoid flooding the user. If there are\n" - "more news messages, only the most recent will be sent."), - Config->GetModule(this->owner)->Get<unsigned>("newscount", "3")); + source.Reply(_("Edits or displays the list of logon news messages. When a user connects to the network, these messages will be sent to them." + " However, no more than \002{0}\002 messages will be sent in order to avoid flooding the user." + " If there are more news messages, only the most recent will be sent."), + Config->GetModule(this->owner)->Get<unsigned>("newscount", "3")); return true; } }; @@ -331,14 +327,11 @@ class CommandOSOperNews : public NewsBase bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Edits or displays the list of oper news messages. When a\n" - "user opers up (with the /OPER command), these messages will\n" - "be sent to them. However, no more than \002%d\002 messages will\n" - "be sent in order to avoid flooding the user. If there are\n" - "more news messages, only the most recent will be sent."), - Config->GetModule(this->owner)->Get<unsigned>("newscount", "3")); + source.Reply(_("Edits or displays the list of oper news messages." + " When a user opers up (with the /OPER command), these messages will be sent to them." + " However, no more than \002{0}\002 messages will be sent in order to avoid flooding the user." + " If there are more news messages, only the most recent will be sent."), + Config->GetModule(this->owner)->Get<unsigned>("newscount", "3")); return true; } }; @@ -358,11 +351,7 @@ class CommandOSRandomNews : public NewsBase bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Edits or displays the list of random news messages. When a\n" - "user connects to the network, one (and only one) of the\n" - "random news will be randomly chosen and sent to them.")); + source.Reply(_("Edits or displays the list of random news messages. When a user connects to the network, one (and only one) of the random news will be randomly chosen and sent to them.")); return true; } }; diff --git a/modules/commands/os_noop.cpp b/modules/commands/os_noop.cpp index 061624724..41af7845f 100644 --- a/modules/commands/os_noop.cpp +++ b/modules/commands/os_noop.cpp @@ -28,8 +28,8 @@ class CommandOSNOOP : public Command Server *s = Server::Find(server, true); if (s == NULL) - source.Reply(_("Server %s does not exist."), server.c_str()); - else if (s == Me || s->IsJuped()) + source.Reply(_("Server \002{0}\002 does not exist."), server); + else if (s == Me || s->IsJuped() || s->IsULined()) source.Reply(_("You can not NOOP Services.")); else if (cmd.equals_ci("SET")) { @@ -38,7 +38,7 @@ class CommandOSNOOP : public Command s->Extend<Anope::string>("noop", source.GetNick()); Log(LOG_ADMIN, source, this) << "SET on " << s->GetName(); - source.Reply(_("All operators from \002%s\002 have been removed."), s->GetName().c_str()); + source.Reply(_("All operators from \002{0}\002 have been removed."), s->GetName()); Anope::string reason = "NOOP command used by " + source.GetNick(); /* Kill all the IRCops of the server */ @@ -55,7 +55,7 @@ class CommandOSNOOP : public Command s->Shrink<Anope::string>("noop"); IRCD->SendSVSNOOP(s, false); Log(LOG_ADMIN, source, this) << "REVOKE on " << s->GetName(); - source.Reply(_("All O:lines of \002%s\002 have been reset."), s->GetName().c_str()); + source.Reply(_("All O:lines of \002{0}\002 have been reset."), s->GetName()); } else this->OnSyntaxError(source, ""); @@ -63,12 +63,8 @@ class CommandOSNOOP : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("\002SET\002 kills all operators from the given\n" - "\002server\002 and prevents operators from opering\n" - "up on the given server. \002REVOKE\002 removes this\n" - "restriction.")); + source.Reply(_("\002{0} SET\002 kills all operators from the given \002server\002 and prevents operators from opering up on the given server." + " \002{0} REVOKE\002 removes this restriction.")); return true; } }; diff --git a/modules/commands/os_oline.cpp b/modules/commands/os_oline.cpp index 3cb521063..34c13a4a3 100644 --- a/modules/commands/os_oline.cpp +++ b/modules/commands/os_oline.cpp @@ -28,19 +28,19 @@ class CommandOSOLine : public Command /* let's check whether the user is online */ if (!(u2 = User::Find(nick, true))) - source.Reply(NICK_X_NOT_IN_USE, nick.c_str()); + source.Reply(_("\002{0}\002 isn't currently online."), nick); else if (u2 && flag[0] == '+') { IRCD->SendSVSO(source.service, nick, flag); u2->SetMode(source.service, "OPER"); u2->SendMessage(*source.service, _("You are now an IRC Operator.")); - source.Reply(_("Operflags \002%s\002 have been added for \002%s\002."), flag.c_str(), nick.c_str()); + source.Reply(_("Operflags \002{0}\002 have been added for \002{1}\002."), flag, nick); Log(LOG_ADMIN, source, this) << "for " << nick; } else if (u2 && flag[0] == '-') { IRCD->SendSVSO(source.service, nick, flag); - source.Reply(_("Operflags \002%s\002 have been removed from \002%s\002."), flag.c_str(), nick.c_str()); + source.Reply(_("Operflags \002{0}\002 have been removed from \002{1}\002."), flag, nick); Log(LOG_ADMIN, source, this) << "for " << nick; } else @@ -51,11 +51,7 @@ class CommandOSOLine : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Allows Services Operators to give Operflags to any user.\n" - "Flags have to be prefixed with a \"+\" or a \"-\". To\n" - "remove all flags simply type a \"-\" instead of any flags.")); + source.Reply(_("Allows Services Operators to give Operflags to any user. Flags have to be prefixed with a \"+\" or a \"-\". To remove all flags simply type a \"-\" instead of any flags.")); return true; } }; diff --git a/modules/commands/os_oper.cpp b/modules/commands/os_oper.cpp index 59619cb48..8cc098f67 100644 --- a/modules/commands/os_oper.cpp +++ b/modules/commands/os_oper.cpp @@ -84,31 +84,31 @@ class CommandOSOper : public Command const NickServ::Nick *na = NickServ::FindNick(oper); if (na == NULL) - source.Reply(NICK_X_NOT_REGISTERED, oper.c_str()); + source.Reply(_("\002{0}\002 isn't currently online."), oper); else if (na->nc->o) - source.Reply(_("Nick \002%s\002 is already an operator."), na->nick.c_str()); + source.Reply(_("Nick \002{0}\002 is already an operator."), na->nick); else { OperType *ot = OperType::Find(otype); if (ot == NULL) { - source.Reply(_("Oper type \002%s\002 has not been configured."), otype.c_str()); + source.Reply(_("Oper type \002{0}\002 has not been configured."), otype); return; } if (!HasPrivs(source, ot)) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied.")); return; } na->nc->o = new MyOper(na->nc->display, ot); if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); Log(LOG_ADMIN, source, this) << "ADD " << na->nick << " as type " << ot->GetName(); - source.Reply("%s (%s) added to the \002%s\002 list.", na->nick.c_str(), na->nc->display.c_str(), ot->GetName().c_str()); + source.Reply("\002{0}\002 (\002{1}\002) added to the \002{2}\002 list.", na->nick, na->nc->display, ot->GetName()); } } else if (subcommand.equals_ci("DEL") && params.size() > 1) @@ -117,21 +117,21 @@ class CommandOSOper : public Command const NickServ::Nick *na = NickServ::FindNick(oper); if (na == NULL) - source.Reply(NICK_X_NOT_REGISTERED, oper.c_str()); + source.Reply(_("\002{0}\002 isn't registered."), oper); else if (!na->nc || !na->nc->o) - source.Reply(_("Nick \002%s\002 is not a Services Operator."), oper.c_str()); + source.Reply(_("Nick \002{0}\002 is not a Services Operator."), oper); else if (!HasPrivs(source, na->nc->o->ot)) - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied.")); else { delete na->nc->o; na->nc->o = NULL; if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); Log(LOG_ADMIN, source, this) << "DEL " << na->nick; - source.Reply(_("Oper privileges removed from %s (%s)."), na->nick.c_str(), na->nc->display.c_str()); + source.Reply(_("Oper privileges removed from \002{0}\002 (\002{1}\002)."), na->nick, na->nc->display); } } else if (subcommand.equals_ci("LIST")) @@ -144,13 +144,13 @@ class CommandOSOper : public Command if (!nc->o) continue; - source.Reply(_("%-8s %s"), nc->o->name.c_str(), nc->o->ot->GetName().c_str()); + source.Reply(Anope::printf("%-8s %s", nc->o->name.c_str(), nc->o->ot->GetName().c_str())); if (std::find(Config->Opers.begin(), Config->Opers.end(), nc->o) != Config->Opers.end()) source.Reply(_(" This oper is configured in the configuration file.")); for (std::list<User *>::const_iterator uit = nc->users.begin(); uit != nc->users.end(); ++uit) { User *u = *uit; - source.Reply(_(" %s is online using this oper block."), u->nick.c_str()); + source.Reply(_(" \002{0}\002 is online using this oper block."), u->nick); } } } @@ -161,14 +161,14 @@ class CommandOSOper : public Command fulltype += " " + params[2]; OperType *ot = OperType::Find(fulltype); if (ot == NULL) - source.Reply(_("Oper type \002%s\002 has not been configured."), fulltype.c_str()); + source.Reply(_("Oper type \002{0}\002 has not been configured."), fulltype); else { if (ot->GetCommands().empty()) - source.Reply(_("Opertype \002%s\002 has no allowed commands."), ot->GetName().c_str()); + source.Reply(_("Opertype \002{0}\002 has no allowed commands."), ot->GetName()); else { - source.Reply(_("Available commands for \002%s\002:"), ot->GetName().c_str()); + source.Reply(_("Available commands for \002{0}\002:"), ot->GetName()); Anope::string buf; std::list<Anope::string> cmds = ot->GetCommands(); for (std::list<Anope::string>::const_iterator it = cmds.begin(), it_end = cmds.end(); it != it_end; ++it) @@ -187,10 +187,10 @@ class CommandOSOper : public Command } } if (ot->GetPrivs().empty()) - source.Reply(_("Opertype \002%s\002 has no allowed privileges."), ot->GetName().c_str()); + source.Reply(_("Opertype \002{0}\002 has no allowed privileges."), ot->GetName()); else { - source.Reply(_("Available privileges for \002%s\002:"), ot->GetName().c_str()); + source.Reply(_("Available privileges for \002{0}\002:"), ot->GetName()); Anope::string buf; std::list<Anope::string> privs = ot->GetPrivs(); for (std::list<Anope::string>::const_iterator it = privs.begin(), it_end = privs.end(); it != it_end; ++it) @@ -209,7 +209,7 @@ class CommandOSOper : public Command } } if (!ot->modes.empty()) - source.Reply(_("Opertype \002%s\002 receives modes \002%s\002 once identified."), ot->GetName().c_str(), ot->modes.c_str()); + source.Reply(_("Opertype \002{0}\002 receives modes \002{1}\002 once identified."), ot->GetName(), ot->modes); } } else @@ -220,11 +220,8 @@ class CommandOSOper : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); source.Reply(_("Allows you to change and view Services Operators.\n" - "Note that operators removed by this command but are still set in\n" - "the configuration file are not permanently affected by this.")); + " Note that operators removed by this command but are still set in the configuration file are not permanently affected by this.")); return true; } }; diff --git a/modules/commands/os_reload.cpp b/modules/commands/os_reload.cpp index b5705d611..217194e18 100644 --- a/modules/commands/os_reload.cpp +++ b/modules/commands/os_reload.cpp @@ -36,18 +36,13 @@ class CommandOSReload : public Command catch (const ConfigException &ex) { Log(this->owner) << "Error reloading configuration file: " << ex.GetReason(); - source.Reply(_("Error reloading configuration file: %s"), ex.GetReason().c_str()); + source.Reply(_("Error reloading configuration file: {0}"), ex.GetReason()); } } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Causes Services to reload the configuration file. Note that\n" - "some directives still need the restart of the Services to\n" - "take effect (such as Services' nicknames, activation of the\n" - "session limitation, etc.).")); + source.Reply(_("Causes Services to reload the configuration file.")); return true; } }; diff --git a/modules/commands/os_session.cpp b/modules/commands/os_session.cpp index 03c807efb..30af3ccbf 100644 --- a/modules/commands/os_session.cpp +++ b/modules/commands/os_session.cpp @@ -146,9 +146,9 @@ class ExceptionDelCallback : public NumberList if (!deleted) source.Reply(_("No matching entries on session-limit exception list.")); else if (deleted == 1) - source.Reply(_("Deleted 1 entry from session-limit exception list.")); + source.Reply(_("Deleted \0021\002 entry from session-limit exception list.")); else - source.Reply(_("Deleted %d entries from session-limit exception list."), deleted); + source.Reply(_("Deleted \002{0}\002 entries from session-limit exception list."), deleted); } virtual void HandleNumber(unsigned number) override @@ -206,7 +206,7 @@ class CommandOSSession : public Command } } - source.Reply(_("Hosts with at least \002%d\002 sessions:"), mincount); + source.Reply(_("Hosts with at least \002{0}\002 sessions:"), mincount); std::vector<Anope::string> replies; list.Process(replies); @@ -215,8 +215,6 @@ class CommandOSSession : public Command for (unsigned i = 0; i < replies.size(); ++i) source.Reply(replies[i]); } - - return; } void DoView(CommandSource &source, const std::vector<Anope::string> ¶ms) @@ -237,9 +235,9 @@ class CommandOSSession : public Command } if (!session) - source.Reply(_("\002%s\002 not found on session list, but has a limit of \002%d\002 because it matches entry: \002%s\002."), param.c_str(), limit, entry.c_str()); + source.Reply(_("\002{0}\002 not found on the session list, but has a limit of \002{1}\002 because it matches entry: \002{2}\002."), param, limit, entry); else - source.Reply(_("The host \002%s\002 currently has \002%d\002 sessions with a limit of \002%d\002 because it matches entry: \002%s\002."), session->addr.mask().c_str(), session->count, limit, entry.c_str()); + source.Reply(_("The host \002{0}\002 currently has \002{1}\002 sessions with a limit of \002{2}\002 because it matches entry: \002{3}\002."), session->addr.mask(), session->count, limit, entry); } public: CommandOSSession(Module *creator) : Command(creator, "operserv/session", 2, 2) @@ -267,22 +265,14 @@ class CommandOSSession : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); source.Reply(_("Allows Services Operators to view the session list.\n" - " \n" - "\002SESSION LIST\002 lists hosts with at least \037threshold\037 sessions.\n" - "The threshold must be a number greater than 1. This is to\n" - "prevent accidental listing of the large number of single\n" - "session hosts.\n" - " \n" - "\002SESSION VIEW\002 displays detailed information about a specific\n" - "host - including the current session count and session limit.\n" - "The \037host\037 value may not include wildcards.\n" - " \n" - "See the \002EXCEPTION\002 help for more information about session\n" - "limiting and how to set session limits specific to certain\n" - "hosts and groups thereof.")); + "\n" + "\002{0} LIST\002 lists hosts with at least \037threshold\037 sessions. The threshold must be a number greater than 1.\n" + "\n" + "\002{0} VIEW\002 displays detailed information about a specific host - including the current session count and session limit.\n" + "\n" + "See the \002EXCEPTION\002 help for more information about session limiting and how to set session limits specific to certain hosts and groups thereof."), // XXX + source.command); return true; } }; @@ -323,7 +313,7 @@ class CommandOSException : public Command time_t expires = !expiry.empty() ? Anope::DoTime(expiry) : exception_expiry; if (expires < 0) { - source.Reply(BAD_EXPIRY_TIME); + source.Reply(_("Invalid expiry time \002{0}\002."), expiry); return; } else if (expires > 0) @@ -338,7 +328,7 @@ class CommandOSException : public Command if (limit > max_exception_limit) { - source.Reply(_("Invalid session limit. It must be a valid integer greater than or equal to zero and less than \002%d\002."), max_exception_limit); + source.Reply(_("Invalid session limit. It must be a valid integer greater than or equal to zero and less than \002{0}\002."), max_exception_limit); return; } else @@ -357,10 +347,10 @@ class CommandOSException : public Command if (e->limit != limit) { e->limit = limit; - source.Reply(_("Exception for \002%s\002 has been updated to %d."), mask.c_str(), e->limit); + source.Reply(_("Exception for \002{0}\002 has been updated to \002{1}\002."), mask, e->limit); } else - source.Reply(_("\002%s\002 already exists on the EXCEPTION list."), mask.c_str()); + source.Reply(_("\002{0}\002 already exists on the session-limit exception list."), mask); return; } } @@ -381,13 +371,11 @@ class CommandOSException : public Command { Log(LOG_ADMIN, source, this) << "to set the session limit for " << mask << " to " << limit; session_service->AddException(exception); - source.Reply(_("Session limit for \002%s\002 set to \002%d\002."), mask.c_str(), limit); + source.Reply(_("Session limit for \002{0}\002 set to \002{1}\002."), mask, limit); if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); } } - - return; } void DoDel(CommandSource &source, const std::vector<Anope::string> ¶ms) @@ -413,17 +401,15 @@ class CommandOSException : public Command { Log(LOG_ADMIN, source, this) << "to remove the session limit exception for " << mask; ExceptionDelCallback::DoDel(source, i); - source.Reply(_("\002%s\002 deleted from session-limit exception list."), mask.c_str()); + source.Reply(_("\002{0}\002 deleted from session-limit exception list."), mask); break; } if (i == end) - source.Reply(_("\002%s\002 not found on session-limit exception list."), mask.c_str()); + source.Reply(_("\002{0}\002 not found on session-limit exception list."), mask); } if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); - - return; + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); } void DoMove(CommandSource &source, const std::vector<Anope::string> ¶ms) @@ -453,15 +439,13 @@ class CommandOSException : public Command session_service->GetExceptions()[n2] = temp; Log(LOG_ADMIN, source, this) << "to move exception " << session_service->GetExceptions()[n1]->mask << " from position " << n1 + 1 << " to position " << n2 + 1; - source.Reply(_("Exception for \002%s\002 (#%d) moved to position \002%d\002."), session_service->GetExceptions()[n1]->mask.c_str(), n1 + 1, n2 + 1); + source.Reply(_("Exception for \002{0}\002 (#{1}) moved to position \002{2}\002."), session_service->GetExceptions()[n1]->mask, n1 + 1, n2 + 1); if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); } else this->OnSyntaxError(source, "MOVE"); - - return; } void ProcessList(CommandSource &source, const std::vector<Anope::string> ¶ms, ListFormatter &list) @@ -530,7 +514,7 @@ class CommandOSException : public Command source.Reply(_("No matching entries on session-limit exception list.")); else { - source.Reply(_("Current Session Limit Exception list:")); + source.Reply(_("Session-limit exception list:")); std::vector<Anope::string> replies; list.Process(replies); @@ -589,41 +573,30 @@ class CommandOSException : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Allows Services Operators to manipulate the list of hosts that\n" - "have specific session limits - allowing certain machines,\n" - "such as shell servers, to carry more than the default number\n" - "of clients at a time. Once a host reaches its session limit,\n" - "all clients attempting to connect from that host will be\n" - "killed. Before the user is killed, they are notified, of a\n" - "source of help regarding session limiting. The content of\n" - "this notice is a config setting.")); - source.Reply(" "); - source.Reply(_("\002EXCEPTION ADD\002 adds the given host mask to the exception list.\n" - "Note that \002nick!user@host\002 and \002user@host\002 masks are invalid!\n" - "Only real host masks, such as \002box.host.dom\002 and \002*.host.dom\002,\n" - "are allowed because sessions limiting does not take nick or\n" - "user names into account. \037limit\037 must be a number greater than\n" - "or equal to zero. This determines how many sessions this host\n" - "may carry at a time. A value of zero means the host has an\n" - "unlimited session limit. See the \002AKILL\002 help for details about\n" - "the format of the optional \037expiry\037 parameter.\n" - " \n" - "\002EXCEPTION DEL\002 removes the given mask from the exception list.\n" - " \n" - "\002EXCEPTION MOVE\002 moves exception \037num\037 to \037position\037. The\n" - "sessions inbetween will be shifted up or down to fill the gap.\n" - " \n" - "\002EXCEPTION LIST\002 and \002EXCEPTION VIEW\002 show all current\n" - "sessions if the optional mask is given, the list is limited\n" - "to those sessions matching the mask. The difference is that\n" - "\002EXCEPTION VIEW\002 is more verbose, displaying the name of the\n" - "person who added the exception, its session limit, reason,\n" - "host mask and the expiry date and time.\n" - " \n" - "Note that a connecting client will \"use\" the first exception\n" - "their host matches.")); + if (subcommand.equals_ci("ADD")) + source.Reply(_("\002{0} ADD\002 adds the given hostmask to the exception list." + " Note that \002nick!user@host\002 and \002user@host\002 masks are invalid!\n" + " Only real host masks, such as \002box.host.dom\002 and \002*.host.dom\002, are allowed because sessions limiting does not take nickname or user names into account." + " \037limit\037 must be a number greater than or equal to zero." + " This determines how many sessions this host may carry at a time." + " A value of zero means the host has an unlimited session limit." + " If more than one entry matches a client, the first matching enty will be used."), + source.command); + else + source.Reply(_("Allows you to manipulate the list of hosts that have specific session limits - allowing certain machines, such as shell servers, to carry more than the default number of clients at a time." + " Once a host reaches its session limit, all clients attempting to connect from that host will be killed." + " Before the user is killed, they are notified, of a source of help regarding session limiting. The content of this notice is a config setting.\n" + "\n" + "\002{0} ADD\002 adds the given host mask to the exception list.\n" + "\002{msg}{service} {help} {command} ADD\002 for more information.\n" + "\n" + "\002{0} DEL\002 removes the given mask from the exception list.\n" + "\n" + "\002{0} MOVE\002 moves exception \037num\037 to \037position\037." + " The sessions inbetween will be shifted up or down to fill the gap.\n" + "\n" + "\002{0} LIST\002 and \002{0} VIEW\002 show all current sessions if the optional mask is given, the list is limited to those sessions matching the mask." + " The difference is that \002{0} VIEW\002 is more verbose, displaying the name of the person who added the exception, its session limit, reason, host mask and the expiry date and time.\n")); return true; } }; @@ -703,13 +676,6 @@ class OSSession : public Module } } - /* Previously on IRCds that send a QUIT (InspIRCD) when a user is killed, the session for a host was - * decremented in do_quit, which caused problems and fixed here - * - * Now, we create the user struture before calling this to fix some user tracking issues, - * so we must increment this here no matter what because it will either be - * decremented when the user is killed or quits - Adam - */ ++session->count; if (kill && !exempt) diff --git a/modules/commands/os_set.cpp b/modules/commands/os_set.cpp index be5e980b1..45515fa4b 100644 --- a/modules/commands/os_set.cpp +++ b/modules/commands/os_set.cpp @@ -54,8 +54,6 @@ class CommandOSSet : public Command } else source.Reply(_("Setting for READONLY must be \002ON\002 or \002OFF\002.")); - - return; } void DoSetSuperAdmin(CommandSource &source, const std::vector<Anope::string> ¶ms) @@ -93,8 +91,6 @@ class CommandOSSet : public Command } else source.Reply(_("Setting for super admin must be \002ON\002 or \002OFF\002.")); - - return; } void DoSetDebug(CommandSource &source, const std::vector<Anope::string> ¶ms) @@ -160,8 +156,6 @@ class CommandOSSet : public Command } else source.Reply(_("Setting for NOEXPIRE must be \002ON\002 or \002OFF\002.")); - - return; } public: CommandOSSet(Module *creator) : Command(creator, "operserv/set", 1, 2) @@ -186,18 +180,13 @@ class CommandOSSet : public Command return this->DoSetSuperAdmin(source, params); else this->OnSyntaxError(source, ""); - - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { if (subcommand.empty()) { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Sets various global Services options. Option names\n" - "currently defined are:\n" + source.Reply(_("Sets various global Services options. Option names currently defined are:\n" " READONLY Set read-only or read-write mode\n" " DEBUG Activate or deactivate debug mode\n" " NOEXPIRE Activate or deactivate no expire mode\n" @@ -205,50 +194,37 @@ class CommandOSSet : public Command " LIST List the options")); } else if (subcommand.equals_ci("LIST")) - source.Reply(_("Syntax: \002LIST\002\n" - " \n" - "Display the various %s settings."), source.service->nick.c_str()); + //source.Reply(_("Syntax: \002LIST\002\n" + // " \n" + source.Reply(("Display the various {0} settings."), source.service->nick); else if (subcommand.equals_ci("READONLY")) - source.Reply(_("Syntax: \002READONLY {ON | OFF}\002\n" - " \n" - "Sets read-only mode on or off. In read-only mode, normal\n" - "users will not be allowed to modify any Services data,\n" - "including channel and nickname access lists, etc. IRCops\n" - "with sufficient Services privileges will be able to modify\n" - "Services' AKILL, SQLINE, SNLINE and ignore lists, drop,\n" - "suspend or forbid nicknames and channels, and manage news,\n" - "oper info and DNS, but any such changes will not be saved\n" - "unless read-only mode is deactivated before Services are\n" - "terminated or restarted.\n" - " \n" - "This option is equivalent to the command-line option\n" - "\002--readonly\002.")); + //source.Reply(_("Syntax: \002READONLY {ON | OFF}\002\n" + // " \n" + source.Reply(_("Sets read-only mode on or off. In read-only mode, norma users will not be allowed to modify any Services data, including channel and nickname access lists, etc." + "Services Operators will still be able to do most tasks, but should understand any changes they do may not be permanent.\n" + "\n" + "This option is equivalent to the command-line option \002--readonly\002.")); else if (subcommand.equals_ci("DEBUG")) - source.Reply(_("Syntax: \002DEBUG {ON | OFF}\002\n" - " \n" - "Sets debug mode on or off.\n" - " \n" - "This option is equivalent to the command-line option\n" - "\002--debug\002.")); + //source.Reply(_("Syntax: \002DEBUG {ON | OFF}\002\n" + // " \n" + source.Reply(_("Sets debug mode on or off.\n" + "\n" + "This option is equivalent to the command-line option \002--debug\002.")); else if (subcommand.equals_ci("NOEXPIRE")) - source.Reply(_("Syntax: \002NOEXPIRE {ON | OFF}\002\n" - " \n" - "Sets no expire mode on or off. In no expire mode, nicks,\n" - "channels, akills and exceptions won't expire until the\n" - "option is unset.\n" - " \n" - "This option is equivalent to the command-line option\n" - "\002--noexpire\002.")); + //source.Reply(_("Syntax: \002NOEXPIRE {ON | OFF}\002\n" + // " \n" + source.Reply(_("Sets no expire mode on or off. In no expire mode, nicks, channels, akills and exceptions won't expire until the option is unset.\n" + "\n" + "This option is equivalent to the command-line option \002--noexpire\002.")); else if (subcommand.equals_ci("SUPERADMIN")) - source.Reply(_("Syntax: \002SUPERADMIN {ON | OFF}\002\n" - " \n" - "Setting this will grant you extra privileges such as the\n" - "ability to be \"founder\" on all channel's etc...\n" - " \n" - "This option is \002not\002 persistent, and should only be used when\n" - "needed, and set back to OFF when no longer needed.")); + //source.Reply(_("Syntax: \002SUPERADMIN {ON | OFF}\002\n" + // " \n" + source.Reply(_("Setting this will grant you extra privileges, such as the ability to be \"founder\" on all channels." + "\n" + "This option is \002not\002 persistent, and should only be used when needed, and set back to OFF when no longer needed.")); else return false; + return true; } }; diff --git a/modules/commands/os_shutdown.cpp b/modules/commands/os_shutdown.cpp index fde5c38e1..642be5d84 100644 --- a/modules/commands/os_shutdown.cpp +++ b/modules/commands/os_shutdown.cpp @@ -16,7 +16,7 @@ class CommandOSQuit : public Command public: CommandOSQuit(Module *creator) : Command(creator, "operserv/quit", 0, 0) { - this->SetDesc(_("Terminate Services WITHOUT saving")); + this->SetDesc(_("Terminate Services without saving")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -29,12 +29,9 @@ class CommandOSQuit : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Causes Services to do an immediate shutdown; databases are\n" - "\002not\002 saved. This command should not be used unless\n" - "damage to the in-memory copies of the databases is feared\n" - "and they should not be saved.")); + source.Reply(_("Causes Services to do an immediate shutdown; databases may \002not\002 saved." + " If you are using a real time database such as SQL or Redis, this command is not useful." + " This command should not be used unless damage to the in-memory copies of the databases is feared and they should not be saved.")); return true; } }; @@ -58,9 +55,7 @@ class CommandOSRestart : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(_("Causes Services to save all databases and then restart\n" - "(i.e. exit and immediately re-run the executable).")); + source.Reply(_("Causes Services to restart.")); return true; } }; @@ -84,9 +79,7 @@ class CommandOSShutdown : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Causes Services to save all databases and then shut down.")); + source.Reply(_("Causes Services to shut down")); return true; } }; diff --git a/modules/commands/os_stats.cpp b/modules/commands/os_stats.cpp index f325b3ab9..1251226c3 100644 --- a/modules/commands/os_stats.cpp +++ b/modules/commands/os_stats.cpp @@ -59,18 +59,18 @@ class CommandOSStats : public Command if (akills) { /* AKILLs */ - source.Reply(_("Current number of AKILLs: \002%d\002"), akills->GetCount()); + source.Reply(_("Current number of AKILLs: \002{0}\002"), akills->GetCount()); timeout = Config->GetModule("operserv")->Get<time_t>("autokillexpiry", "30d") + 59; if (timeout >= 172800) - source.Reply(_("Default AKILL expiry time: \002%d days\002"), timeout / 86400); + source.Reply(_("Default AKILL expiry time: \002{0} days\002"), timeout / 86400); else if (timeout >= 86400) source.Reply(_("Default AKILL expiry time: \0021 day\002")); else if (timeout >= 7200) - source.Reply(_("Default AKILL expiry time: \002%d hours\002"), timeout / 3600); + source.Reply(_("Default AKILL expiry time: \002{0} hours\002"), timeout / 3600); else if (timeout >= 3600) source.Reply(_("Default AKILL expiry time: \0021 hour\002")); else if (timeout >= 120) - source.Reply(_("Default AKILL expiry time: \002%d minutes\002"), timeout / 60); + source.Reply(_("Default AKILL expiry time: \002{0} minutes\002"), timeout / 60); else if (timeout >= 60) source.Reply(_("Default AKILL expiry time: \0021 minute\002")); else @@ -79,18 +79,18 @@ class CommandOSStats : public Command if (snlines) { /* SNLINEs */ - source.Reply(_("Current number of SNLINEs: \002%d\002"), snlines->GetCount()); + source.Reply(_("Current number of SNLINEs: \002{0}\002"), snlines->GetCount()); timeout = Config->GetModule("operserv")->Get<time_t>("snlineexpiry", "30d") + 59; if (timeout >= 172800) - source.Reply(_("Default SNLINE expiry time: \002%d days\002"), timeout / 86400); + source.Reply(_("Default SNLINE expiry time: \002{0} days\002"), timeout / 86400); else if (timeout >= 86400) source.Reply(_("Default SNLINE expiry time: \0021 day\002")); else if (timeout >= 7200) - source.Reply(_("Default SNLINE expiry time: \002%d hours\002"), timeout / 3600); + source.Reply(_("Default SNLINE expiry time: \002{0} hours\002"), timeout / 3600); else if (timeout >= 3600) source.Reply(_("Default SNLINE expiry time: \0021 hour\002")); else if (timeout >= 120) - source.Reply(_("Default SNLINE expiry time: \002%d minutes\002"), timeout / 60); + source.Reply(_("Default SNLINE expiry time: \002{0} minutes\002"), timeout / 60); else if (timeout >= 60) source.Reply(_("Default SNLINE expiry time: \0021 minute\002")); else @@ -99,18 +99,18 @@ class CommandOSStats : public Command if (sqlines) { /* SQLINEs */ - source.Reply(_("Current number of SQLINEs: \002%d\002"), sqlines->GetCount()); + source.Reply(_("Current number of SQLINEs: \002{0}\002"), sqlines->GetCount()); timeout = Config->GetModule("operserv")->Get<time_t>("sglineexpiry", "30d") + 59; if (timeout >= 172800) - source.Reply(_("Default SQLINE expiry time: \002%d days\002"), timeout / 86400); + source.Reply(_("Default SQLINE expiry time: \002{0} days\002"), timeout / 86400); else if (timeout >= 86400) source.Reply(_("Default SQLINE expiry time: \0021 day\002")); else if (timeout >= 7200) - source.Reply(_("Default SQLINE expiry time: \002%d hours\002"), timeout / 3600); + source.Reply(_("Default SQLINE expiry time: \002{0} hours\002"), timeout / 3600); else if (timeout >= 3600) source.Reply(_("Default SQLINE expiry time: \0021 hour\002")); else if (timeout >= 120) - source.Reply(_("Default SQLINE expiry time: \002%d minutes\002"), timeout / 60); + source.Reply(_("Default SQLINE expiry time: \002{0} minutes\002"), timeout / 60); else if (timeout >= 60) source.Reply(_("Default SQLINE expiry time: \0021 minute\002")); else @@ -128,11 +128,9 @@ class CommandOSStats : public Command void DoStatsUptime(CommandSource &source) { time_t uptime = Anope::CurTime - Anope::StartTime; - source.Reply(_("Current users: \002%d\002 (\002%d\002 ops)"), UserListByNick.size(), OperCount); - source.Reply(_("Maximum users: \002%d\002 (%s)"), MaxUserCount, Anope::strftime(MaxUserTime, source.GetAccount()).c_str()); - source.Reply(_("Services up %s."), Anope::Duration(uptime, source.GetAccount()).c_str()); - - return; + source.Reply(_("Current users: \002{0}\002 (\002{1}\002 ops)"), UserListByNick.size(), OperCount); + source.Reply(_("Maximum users: \002{0}\002 ({1})"), MaxUserCount, Anope::strftime(MaxUserTime, source.GetAccount())); + source.Reply(_("Services up \002{0}\002."), Anope::Duration(uptime, source.GetAccount())); } void DoStatsUplink(CommandSource &source) @@ -143,10 +141,9 @@ class CommandOSStats : public Command if (!buf.empty()) buf.erase(buf.begin()); - source.Reply(_("Uplink server: %s"), Me->GetLinks().front()->GetName().c_str()); - source.Reply(_("Uplink capab: %s"), buf.c_str()); - source.Reply(_("Servers found: %d"), stats_count_servers(Me->GetLinks().front())); - return; + source.Reply(_("Uplink server: \002{0}\002"), Me->GetLinks().front()->GetName()); + source.Reply(_("Uplink capab: {0}"), buf); + source.Reply(_("Servers found: {0}"), stats_count_servers(Me->GetLinks().front())); } template<typename T> void GetHashStats(const T& map, size_t& entries, size_t& buckets, size_t& max_chain) @@ -162,30 +159,30 @@ class CommandOSStats : public Command size_t entries, buckets, max_chain; GetHashStats(UserListByNick, entries, buckets, max_chain); - source.Reply(_("Users (nick): %lu entries, %lu buckets, longest chain is %d"), entries, buckets, max_chain); + source.Reply(_("Users (nick): {0} entries, {1} buckets, longest chain is {2}"), entries, buckets, max_chain); if (!UserListByUID.empty()) { GetHashStats(UserListByUID, entries, buckets, max_chain); - source.Reply(_("Users (uid): %lu entries, %lu buckets, longest chain is %d"), entries, buckets, max_chain); + source.Reply(_("Users (uid): {0} entries, {1} buckets, longest chain is {2}"), entries, buckets, max_chain); } GetHashStats(ChannelList, entries, buckets, max_chain); - source.Reply(_("Channels: %lu entries, %lu buckets, longest chain is %d"), entries, buckets, max_chain); + source.Reply(_("Channels: {0} entries, {1} buckets, longest chain is {2}"), entries, buckets, max_chain); GetHashStats(ChanServ::service->GetChannels(), entries, buckets, max_chain); - source.Reply(_("Registered channels: %lu entries, %lu buckets, longest chain is %d"), entries, buckets, max_chain); + source.Reply(_("Registered channels: {0} entries, {1} buckets, longest chain is {2}"), entries, buckets, max_chain); GetHashStats(NickServ::service->GetNickList(), entries, buckets, max_chain); - source.Reply(_("Registered nicknames: %lu entries, %lu buckets, longest chain is %d"), entries, buckets, max_chain); + source.Reply(_("Registered nicknames: {0} entries, {1} buckets, longest chain is {2}"), entries, buckets, max_chain); GetHashStats(NickServ::service->GetAccountList(), entries, buckets, max_chain); - source.Reply(_("Registered nick groups: %lu entries, %lu buckets, longest chain is %d"), entries, buckets, max_chain); + source.Reply(_("Registered nick groups: {0} entries, {1} buckets, longest chain is {2}"), entries, buckets, max_chain); if (session_service) { GetHashStats(session_service->GetSessions(), entries, buckets, max_chain); - source.Reply(_("Sessions: %lu entries, %lu buckets, longest chain is %d"), entries, buckets, max_chain); + source.Reply(_("Sessions: {0} entries, {1} buckets, longest chain is {2}"), entries, buckets, max_chain); } } @@ -219,29 +216,22 @@ class CommandOSStats : public Command this->DoStatsUptime(source); if (!extra.empty() && !extra.equals_ci("ALL") && !extra.equals_ci("AKILL") && !extra.equals_ci("HASH") && !extra.equals_ci("UPLINK") && !extra.equals_ci("UPTIME")) - source.Reply(_("Unknown STATS option: \002%s\002"), extra.c_str()); + source.Reply(_("Unknown STATS option: \002{0}\002"), extra); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Without any option, shows the current number of users online,\n" - "and the highest number of users online since Services was\n" - "started, and the length of time Services has been running.\n" - " \n" - "With the \002AKILL\002 option, displays the current size of the\n" - "AKILL list and the current default expiry time.\n" - " \n" - "The \002RESET\002 option currently resets the maximum user count\n" - "to the number of users currently present on the network.\n" - " \n" - "The \002UPLINK\002 option displays information about the current\n" - "server Anope uses as an uplink to the network.\n" - " \n" - "The \002HASH\002 option displays information about the hash maps.\n" - " \n" - "The \002ALL\002 option displays all of the above statistics.")); + source.Reply(_("Without any option, shows the current number of users online, and the highest number of users online since Services was started, and the length of time Services has been running.\n" + "\n" + "With the \002AKILL\002 option, displays the current size of the AKILL list and the current default expiry time.\n" + "\n" + "The \002RESET\002 option currently resets the maximum user count to the number of users currently present on the network.\n" + "\n" + "The \002UPLINK\002 option displays information about the current server Anope uses as an uplink to the network.\n" + "\n" + "The \002HASH\002 option displays information about the hash maps.\n" + "\n" + "The \002ALL\002 option displays all of the above statistics.")); return true; } }; diff --git a/modules/commands/os_svs.cpp b/modules/commands/os_svs.cpp index ee0ff666d..fb6808df3 100644 --- a/modules/commands/os_svs.cpp +++ b/modules/commands/os_svs.cpp @@ -36,35 +36,32 @@ class CommandOSSVSNick : public Command unsigned nicklen = Config->GetBlock("networkinfo")->Get<unsigned>("nicklen"); if (newnick.length() > nicklen) { - source.Reply(_("Nick \002%s\002 was truncated to %d characters."), newnick.c_str(), nicklen, newnick.c_str()); + source.Reply(_("Nick \002{0}\002 was truncated to \002{1}\002 characters."), newnick, nicklen); newnick = params[1].substr(0, nicklen); } /* Check for valid characters */ if (!IRCD->IsNickValid(newnick)) { - source.Reply(_("Nick \002%s\002 is an illegal nickname and cannot be used."), newnick.c_str()); + source.Reply(_("Nick \002{0}\002 is an illegal nickname and cannot be used."), newnick); return; } /* Check for a nick in use or a forbidden/suspended nick */ if (!(u2 = User::Find(nick, true))) - source.Reply(NICK_X_NOT_IN_USE, nick.c_str()); + source.Reply(_("\002{0}\002 isn't currently online."), nick); else if (!nick.equals_ci(newnick) && User::Find(newnick)) - source.Reply(_("Nick \002%s\002 is currently in use."), newnick.c_str()); + source.Reply(_("\002{0}\002 is currently in use."), newnick); else { - source.Reply(_("The nick \002%s\002 is now being changed to \002%s\002."), nick.c_str(), newnick.c_str()); + source.Reply(_("\002{0}\002 is now being changed to \002{1}\002."), nick, newnick); Log(LOG_ADMIN, source, this) << "to change " << nick << " to " << newnick; IRCD->SendForceNickChange(u2, newnick, Anope::CurTime); } - return; } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); source.Reply(_("Forcefully changes a user's nickname from \037nick\037 to \037newnick\037.")); return true; } @@ -76,7 +73,7 @@ class CommandOSSVSJoin : public Command CommandOSSVSJoin(Module *creator) : Command(creator, "operserv/svsjoin", 2, 2) { this->SetDesc(_("Forcefully join a user to a channel")); - this->SetSyntax(_("\037nick\037 \037channel\037")); + this->SetSyntax(_("\037user\037 \037channel\037")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -90,26 +87,24 @@ class CommandOSSVSJoin : public Command User *target = User::Find(params[0], true); Channel *c = Channel::Find(params[1]); if (target == NULL) - source.Reply(NICK_X_NOT_IN_USE, params[0].c_str()); + source.Reply(_("\002{0}\002 isn't currently online."), params[0]); else if (source.GetUser() != target && (target->IsProtected() || target->server == Me)) - source.Reply(ACCESS_DENIED); - else if (!IRCD->IsChannelValid(params[1])) - source.Reply(CHAN_X_INVALID, params[1].c_str()); + source.Reply(_("Access denied.")); + else if (!c && !IRCD->IsChannelValid(params[1])) + source.Reply(_("\002{0}\002 isn't a valid channel."), params[1]); else if (c && c->FindUser(target)) - source.Reply(_("\002%s\002 is already in \002%s\002."), target->nick.c_str(), c->name.c_str()); + source.Reply(_("\002{0}\002 is already in \002{1}\002."), target->nick, c->name); else { IRCD->SendSVSJoin(*source.service, target, params[1], ""); Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to join " << params[1]; - source.Reply(_("\002%s\002 has been joined to \002%s\002."), target->nick.c_str(), params[1].c_str()); + source.Reply(_("\002{0}\002 has been joined to \002{1}\002."), target->nick, params[1]); } } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Forcefully join a user to a channel.")); + source.Reply(_("Forcefully join \037user\037 to \037channel\037.")); return true; } }; @@ -120,7 +115,7 @@ class CommandOSSVSPart : public Command CommandOSSVSPart(Module *creator) : Command(creator, "operserv/svspart", 2, 2) { this->SetDesc(_("Forcefully part a user from a channel")); - this->SetSyntax(_("\037nick\037 \037channel\037")); + this->SetSyntax(_("\037user\037 \037channel\037")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -134,26 +129,24 @@ class CommandOSSVSPart : public Command User *target = User::Find(params[0], true); Channel *c = Channel::Find(params[1]); if (target == NULL) - source.Reply(NICK_X_NOT_IN_USE, params[0].c_str()); + source.Reply(_("\002{0}\002 isn't currently online."), params[0]); else if (source.GetUser() != target && (target->IsProtected() || target->server == Me)) - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied.")); else if (!c) - source.Reply(CHAN_X_NOT_IN_USE, params[1].c_str()); + source.Reply(_("Channel \002{0}\002 doesn't exist."), params[1]); else if (!c->FindUser(target)) - source.Reply(_("\002%s\002 is not in \002%s\002."), target->nick.c_str(), c->name.c_str()); + source.Reply(_("\002{0}\002 is not in \002{1}\002."), target->nick, c->name); else { IRCD->SendSVSPart(*source.service, target, params[1], ""); Log(LOG_ADMIN, source, this) << "to force " << target->nick << " to part " << c->name; - source.Reply(_("\002%s\002 has been parted from \002%s\002."), target->nick.c_str(), c->name.c_str()); + source.Reply(_("\002{0}\002 has been parted from \002{1}\002."), target->nick, c->name); } } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Forcefully part a user from a channel.")); + source.Reply(_("Forcefully part \037user\037 from \037channel\037.")); return true; } }; diff --git a/modules/commands/os_sxline.cpp b/modules/commands/os_sxline.cpp index 43ae2b7d4..e1c637a2e 100644 --- a/modules/commands/os_sxline.cpp +++ b/modules/commands/os_sxline.cpp @@ -25,11 +25,11 @@ class SXLineDelCallback : public NumberList ~SXLineDelCallback() { if (!deleted) - source.Reply(_("No matching entries on the %s list."), source.command.c_str()); + source.Reply(_("No matching entries on the {0} list."), source.command); else if (deleted == 1) - source.Reply(_("Deleted 1 entry from the %s list."), source.command.c_str()); + source.Reply(_("Deleted \0021\002 entry from the {0} list."), source.command); else - source.Reply(_("Deleted %d entries from the %s list."), deleted, source.command.c_str()); + source.Reply(_("Deleted \002{0}\002 entries from the {1} list."), deleted, source.command); } void HandleNumber(unsigned number) override @@ -66,7 +66,7 @@ class CommandOSSXLineBase : public Command if (!this->xlm() || this->xlm()->GetList().empty()) { - source.Reply(_("%s list is empty."), source.command.c_str()); + source.Reply(_("{0} list is empty."), source.command); return; } @@ -89,28 +89,26 @@ class CommandOSSXLineBase : public Command if (!x) { - source.Reply(_("\002%s\002 not found on the %s list."), mask.c_str(), source.command.c_str()); + source.Reply(_("\002{0}\002 not found on the {1] list."), mask, source.command); return; } Event::OnDelXLine(&Event::DelXLine::OnDelXLine, source, x, this->xlm()); SXLineDelCallback::DoDel(this->xlm(), source, x); - source.Reply(_("\002%s\002 deleted from the %s list."), mask.c_str(), source.command.c_str()); + source.Reply(_("\002{0}\002 deleted from the {1} list."), mask, source.command); Log(LOG_ADMIN, source, this) << "to remove " << mask << " from the list"; } if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); - - return; + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); } void ProcessList(CommandSource &source, const std::vector<Anope::string> ¶ms, ListFormatter &list) { if (!this->xlm() || this->xlm()->GetList().empty()) { - source.Reply(_("%s list is empty."), source.command.c_str()); + source.Reply(_("{0} list is empty."), source.command); return; } @@ -172,10 +170,10 @@ class CommandOSSXLineBase : public Command } if (list.IsEmpty()) - source.Reply(_("No matching entries on the %s list."), source.command.c_str()); + source.Reply(_("No matching entries on the {0} list."), source.command); else { - source.Reply(_("Current %s list:"), source.command.c_str()); + source.Reply(_("{0} list:"), source.command); std::vector<Anope::string> replies; list.Process(replies); @@ -211,11 +209,9 @@ class CommandOSSXLineBase : public Command } Log(LOG_ADMIN, source, this) << "to CLEAR the list"; - source.Reply(_("The %s list has been cleared."), source.command.c_str()); + source.Reply(_("The {0} list has been cleared."), source.command); if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); - - return; + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); } public: CommandOSSXLineBase(Module *creator, const Anope::string &cmd) : Command(creator, cmd, 1, 4) @@ -243,8 +239,6 @@ class CommandOSSXLineBase : public Command return this->OnClear(source); else this->OnSyntaxError(source, ""); - - return; } virtual bool OnHelp(CommandSource &source, const Anope::string &subcommand) = 0; @@ -282,7 +276,7 @@ class CommandOSSNLine : public CommandOSSXLineBase /* Do not allow less than a minute expiry time */ if (expires && expires < 60) { - source.Reply(BAD_EXPIRY_TIME); + source.Reply(_("Invalid expiry time \002{0}\002."), expiry); return; } else if (expires > 0) @@ -330,7 +324,7 @@ class CommandOSSNLine : public CommandOSSXLineBase } catch (const std::regex_error &ex) { - source.Reply("%s", ex.what()); + source.Reply(ex.what()); return; } } @@ -346,7 +340,7 @@ class CommandOSSNLine : public CommandOSSXLineBase return; else if (mask.find_first_not_of("/.*?") == Anope::string::npos) { - source.Reply(USERHOST_MASK_TOO_WIDE, mask.c_str()); + source.Reply(_("\002{0}\002 coverage is too wide; please use a more specific mask."), mask); return; } @@ -365,7 +359,7 @@ class CommandOSSNLine : public CommandOSSXLineBase if (percent > 95) { - source.Reply(USERHOST_MASK_TOO_WIDE, mask.c_str()); + source.Reply(_("\002{0}\002 coverage is too wide; please use a more specific mask."), mask); Log(LOG_ADMIN, source, this) << "tried to " << source.command << " " << percent << "% of the network (" << affected << " users)"; delete x; return; @@ -396,10 +390,10 @@ class CommandOSSNLine : public CommandOSSXLineBase this->xlm()->Send(NULL, x); } - source.Reply(_("\002%s\002 added to the %s list."), mask.c_str(), source.command.c_str()); + source.Reply(_("\002{0}\002 added to the {1} list."), mask, source.command); Log(LOG_ADMIN, source, this) << "on " << mask << " (" << reason << "), expires in " << (expires ? Anope::Duration(expires - Anope::CurTime) : "never") << " [affects " << affected << " user(s) (" << percent << "%)]"; if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); } ServiceReference<XLineManager> snlines; @@ -415,53 +409,60 @@ class CommandOSSNLine : public CommandOSSXLineBase bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Allows Services Operators to manipulate the SNLINE list. If\n" - "a user with a realname matching an SNLINE mask attempts to\n" - "connect, Services will not allow it to pursue his IRC\n" - "session.")); - source.Reply(_(" \n" - "\002SNLINE ADD\002 adds the given realname mask to the SNLINE\n" - "list for the given reason (which \002must\002 be given).\n" - "\037expiry\037 is specified as an integer followed by one of \037d\037\n" - "(days), \037h\037 (hours), or \037m\037 (minutes). Combinations (such as\n" - "\0371h30m\037) are not permitted. If a unit specifier is not\n" - "included, the default is days (so \037+30\037 by itself means 30\n" - "days). To add an SNLINE which does not expire, use \037+0\037. If the\n" - "realname mask to be added starts with a \037+\037, an expiry time must\n" - "be given, even if it is the same as the default. The\n" - "current SNLINE default expiry time can be found with the\n" - "\002STATS AKILL\002 command.\n" - " \n" - "\002Note\002: because the realname mask may contain spaces, the\n" - "separator between it and the reason is a colon.")); - const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine"); - if (Config->regex_flags && !regexengine.empty()) - { - source.Reply(" "); - source.Reply(_("Regex matches are also supported using the %s engine.\n" - "Enclose your mask in // if this is desired."), regexengine.c_str()); - } - source.Reply(_(" \n" - "The \002SNLINE DEL\002 command removes the given mask from the\n" - "SNLINE list if it is present. If a list of entry numbers is\n" - "given, those entries are deleted. (See the example for LIST\n" - "below.)\n" - " \n" - "The \002SNLINE LIST\002 command displays the SNLINE list.\n" - "If a wildcard mask is given, only those entries matching the\n" - "mask are displayed. If a list of entry numbers is given,\n" - "only those entries are shown; for example:\n" - " \002SNLINE LIST 2-5,7-9\002\n" - " Lists SNLINE entries numbered 2 through 5 and 7\n" - " through 9.\n" - " \n" - "\002SNLINE VIEW\002 is a more verbose version of \002SNLINE LIST\002, and\n" - "will show who added an SNLINE, the date it was added, and when\n" - "it expires, as well as the realname mask and reason.\n" - " \n" - "\002SNLINE CLEAR\002 clears all entries of the SNLINE list.")); + if (subcommand.equals_ci("ADD")) + { + source.Reply(_("\002{0} ADD\002 adds the given \037mask\037 to the {0} list for the given \037reason\037." + " \037expiry\037 is specified as an integer followed by one of \037d\037 (days), \037h\037 (hours), or \037m\037 (minutes)." + " If a unit specifier is not included, the default is days, so \037+30\037 by itself means 30 days." + " To add a {0} which does not expire, use \037+0\037." + " The default {0} expiry time is \002{1}\002." + " Because the real name may contain spaces, the separator between it and the reason is a \002colon\002."), + source.command, Anope::Duration(Config->GetModule("operserv")->Get<time_t>("snlineexpiry", "30d"), source.GetAccount())); + + const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine"); + if (!regexengine.empty()) + { + source.Reply(" "); + source.Reply(_("Regex matches are also supported using the {0} engine. Enclose your mask in // if this is desired."), regexengine); + } + } + else if (subcommand.equals_ci("DEL")) + source.Reply(_("The \002{0} DEL\002 command removes the given \037mask\037 from the {0} list if it is present." + " If a list of entry numbers is given, those entries are deleted.")); + else if (subcommand.equals_ci("LIST") || subcommand.equals_ci("VIEW")) + source.Reply(_("The \002{0} LIST\002 and \002{0} VIEW\002 commands displays the {0} list.\n" + "If a wildcard \037mask\037 is given, only those entries matching the \037mask\037 are displayed." + " If a list of entry numbers is given, only those entries are shown." + " \002VIEW\002 is similar to \002LIST\002 but also shows who created the {0}, when it was created, and when it expires.\n" + "\n" + "Example:\n" + "\n" + " {0} LIST 2-5,7-9\n" + " Lists {0} entries numbered 2 through 5 and 7 through 9.\n"), + source.command); + else if (subcommand.equals_ci("CLEAR")) + source.Reply(_("\002{0} CLEAR\002 removes all entries from the {0} list."), + source.command); + else + { + CommandInfo *help = source.service->FindCommand("generic/help"); + + source.Reply(_("Allows you to manipulate the {0} list." + " If a user attempts to use a realname that matches a {0} mask, services will kill the user." + "\n" + "The \002ADD\002 command adds \037mask\037 to the {0} list.\n" + "\002{msg}{service} {help} {command} ADD\002 for more information.\n" + "\n" + "The \002DEL\002 command removes \037mask\037 from the {0} list.\n" + "\002{msg}{service} {help} {command} DEL\002 for more information.\n" + "\n" + "The \002LIST\002 and \002VIEW\002 commands both show the {0} list, but \002VIEW\002 also shows who created the {0} entry, when it was created, and when it expires.\n" + "\002{msg}{service} {help} {command} [LIST | VIEW]\002 for more information.\n" + "\n" + "The \002CLEAR\002 command clears th auto kill list." + "\002{msg}{service} {help} {command} CLEAR\002 for more information.\n"), + "msg"_kw = Config->StrictPrivmsg, "service"_kw = source.service->nick, "help"_kw = help->cname, "command"_kw = source.command); + } return true; } }; @@ -498,7 +499,7 @@ class CommandOSSQLine : public CommandOSSXLineBase /* Do not allow less than a minute expiry time */ if (expires && expires < 60) { - source.Reply(BAD_EXPIRY_TIME); + source.Reply(_("Invalid expiry time \002{0}\002."), expiry); return; } else if (expires > 0) @@ -535,7 +536,7 @@ class CommandOSSQLine : public CommandOSSXLineBase } catch (const std::regex_error &ex) { - source.Reply("%s", ex.what()); + source.Reply(ex.what()); return; } } @@ -544,7 +545,7 @@ class CommandOSSQLine : public CommandOSSXLineBase return; else if (mask.find_first_not_of("./?*") == Anope::string::npos) { - source.Reply(USERHOST_MASK_TOO_WIDE, mask.c_str()); + source.Reply(_("\002{0}\002 coverage is too wide; please use a more specific mask."), mask); return; } @@ -563,7 +564,7 @@ class CommandOSSQLine : public CommandOSSXLineBase if (percent > 95) { - source.Reply(USERHOST_MASK_TOO_WIDE, mask.c_str()); + source.Reply(_("\002{0}\002 coverage is too wide; please use a more specific mask."), mask); Log(LOG_ADMIN, source, this) << "tried to SQLine " << percent << "% of the network (" << affected << " users)"; delete x; return; @@ -620,10 +621,10 @@ class CommandOSSQLine : public CommandOSSXLineBase this->xlm()->Send(NULL, x); } - source.Reply(_("\002%s\002 added to the %s list."), mask.c_str(), source.command.c_str()); + source.Reply(_("\002{0}\002 added to the {1} list."), mask, source.command); Log(LOG_ADMIN, source, this) << "on " << mask << " (" << reason << "), expires in " << (expires ? Anope::Duration(expires - Anope::CurTime) : "never") << " [affects " << affected << " user(s) (" << percent << "%)]"; if (Anope::ReadOnly) - source.Reply(READ_ONLY_MODE); + source.Reply(_("Services are in read-only mode. Any changes made may not persist.")); } ServiceReference<XLineManager> sqlines; @@ -639,52 +640,60 @@ class CommandOSSQLine : public CommandOSSXLineBase bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Allows Services Operators to manipulate the SQLINE list. If\n" - "a user with a nick matching an SQLINE mask attempts to\n" - "connect, Services will not allow it to pursue his IRC\n" - "session.\n" - "If the first character of the mask is #, services will\n" - "prevent the use of matching channels.")); - source.Reply(_(" \n" - "\002SQLINE ADD\002 adds the given (nick's) mask to the SQLINE\n" - "list for the given reason (which \002must\002 be given).\n" - "\037expiry\037 is specified as an integer followed by one of \037d\037\n" - "(days), \037h\037 (hours), or \037m\037 (minutes). Combinations (such as\n" - "\0371h30m\037) are not permitted. If a unit specifier is not\n" - "included, the default is days (so \037+30\037 by itself means 30\n" - "days). To add an SQLINE which does not expire, use \037+0\037.\n" - "If the mask to be added starts with a \037+\037, an expiry time\n" - "must be given, even if it is the same as the default. The\n" - "current SQLINE default expiry time can be found with the\n" - "\002STATS AKILL\002 command.")); - const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine"); - if (!regexengine.empty()) - { - source.Reply(" "); - source.Reply(_("Regex matches are also supported using the %s engine.\n" - "Enclose your mask in // if this is desired."), regexengine.c_str()); - } - source.Reply(_(" \n" - "The \002SQLINE DEL\002 command removes the given mask from the\n" - "SQLINE list if it is present. If a list of entry numbers is\n" - "given, those entries are deleted. (See the example for LIST\n" - "below.)\n" - " \n" - "The \002SQLINE LIST\002 command displays the SQLINE list.\n" - "If a wildcard mask is given, only those entries matching the\n" - "mask are displayed. If a list of entry numbers is given,\n" - "only those entries are shown; for example:\n" - " \002SQLINE LIST 2-5,7-9\002\n" - " Lists SQLINE entries numbered 2 through 5 and 7\n" - " through 9.\n" - " \n" - "\002SQLINE VIEW\002 is a more verbose version of \002SQLINE LIST\002, and\n" - "will show who added an SQLINE, the date it was added, and when\n" - "it expires, as well as the mask and reason.\n" - " \n" - "\002SQLINE CLEAR\002 clears all entries of the SQLINE list.")); + if (subcommand.equals_ci("ADD")) + { + source.Reply(_("\002{0} ADD\002 adds the given \037mask\037 to the {0} list for the given \037reason\037." + " \037expiry\037 is specified as an integer followed by one of \037d\037 (days), \037h\037 (hours), or \037m\037 (minutes)." + " If a unit specifier is not included, the default is days, so \037+30\037 by itself means 30 days." + " To add a {0} which does not expire, use \037+0\037." + " The default {0} expiry time is \002{1}\002."), + source.command, Anope::Duration(Config->GetModule("operserv")->Get<time_t>("sqlineexpiry", "30d"), source.GetAccount())); + + const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine"); + if (!regexengine.empty()) + { + source.Reply(" "); + source.Reply(_("Regex matches are also supported using the {0} engine. Enclose your mask in // if this is desired."), regexengine); + } + } + else if (subcommand.equals_ci("DEL")) + source.Reply(_("The \002{0} DEL\002 command removes the given \037mask\037 from the {0} list if it is present." + " If a list of entry numbers is given, those entries are deleted.")); + else if (subcommand.equals_ci("LIST") || subcommand.equals_ci("VIEW")) + source.Reply(_("The \002{0} LIST\002 and \002{0} VIEW\002 commands displays the {0} list.\n" + "If a wildcard \037mask\037 is given, only those entries matching the \037mask\037 are displayed." + " If a list of entry numbers is given, only those entries are shown." + " \002VIEW\002 is similar to \002LIST\002 but also shows who created the {0}, when it was created, and when it expires.\n" + "\n" + "Example:\n" + "\n" + " {0} LIST 2-5,7-9\n" + " Lists {0} entries numbered 2 through 5 and 7 through 9.\n"), + source.command); + else if (subcommand.equals_ci("CLEAR")) + source.Reply(_("\002{0} CLEAR\002 removes all entries from the {0} list."), + source.command); + else + { + CommandInfo *help = source.service->FindCommand("generic/help"); + + source.Reply(_("Allows you to manipulate the {0} list." + " If a user attempts to use a nickname that matches a {0} mask, services will force the user off of the nickname." + " If the first character of the mask is a #, services will prevent the use of matching channels." + "\n" + "The \002ADD\002 command adds \037mask\037 to the {0} list.\n" + "\002{msg}{service} {help} {command} ADD\002 for more information.\n" + "\n" + "The \002DEL\002 command removes \037mask\037 from the {0} list.\n" + "\002{msg}{service} {help} {command} DEL\002 for more information.\n" + "\n" + "The \002LIST\002 and \002VIEW\002 commands both show the {0} list, but \002VIEW\002 also shows who created the {0} entry, when it was created, and when it expires.\n" + "\002{msg}{service} {help} {command} [LIST | VIEW]\002 for more information.\n" + "\n" + "The \002CLEAR\002 command clears th auto kill list." + "\002{msg}{service} {help} {command} CLEAR\002 for more information.\n"), + "msg"_kw = Config->StrictPrivmsg, "service"_kw = source.service->nick, "help"_kw = help->cname, "command"_kw = source.command); + } return true; } }; diff --git a/modules/commands/os_update.cpp b/modules/commands/os_update.cpp index 3f0d07d17..8ff39fb69 100644 --- a/modules/commands/os_update.cpp +++ b/modules/commands/os_update.cpp @@ -29,10 +29,7 @@ class CommandOSUpdate : public Command bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - this->SendSyntax(source); - source.Reply(" "); - source.Reply(_("Causes Services to update all database files as soon as you\n" - "send the command.")); + source.Reply(_("Causes Services to update all database files.")); return true; } }; diff --git a/modules/fantasy.cpp b/modules/fantasy.cpp index ef95a83b3..f3e3f1fa1 100644 --- a/modules/fantasy.cpp +++ b/modules/fantasy.cpp @@ -11,6 +11,7 @@ #include "module.h" #include "modules/fantasy.h" +#include "modules/bs_info.h" class CommandBSSetFantasy : public Command { @@ -28,13 +29,13 @@ class CommandBSSetFantasy : public Command if (ci == NULL) { - source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str()); + source.Reply(_("Channel \002{0}\002 isn't registered."), params[0]); return; } if (!source.HasPriv("botserv/administration") && !source.AccessFor(ci).HasPriv("SET")) { - source.Reply(ACCESS_DENIED); + source.Reply(_("Access denied. You do not have the \002{0}\002 privilege on \002{1}\002."), "SET", ci->name); return; } @@ -50,7 +51,7 @@ class CommandBSSetFantasy : public Command Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable fantasy"; ci->Extend<bool>("BS_FANTASY"); - source.Reply(_("Fantasy mode is now \002on\002 on channel %s."), ci->name.c_str()); + source.Reply(_("Fantasy mode is now \002on\002 on channel \002{0}\002."), ci->name); } else if (value.equals_ci("OFF")) { @@ -58,7 +59,7 @@ class CommandBSSetFantasy : public Command Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable fantasy"; ci->Shrink<bool>("BS_FANTASY"); - source.Reply(_("Fantasy mode is now \002off\002 on channel %s."), ci->name.c_str()); + source.Reply(_("Fantasy mode is now \002off\002 on channel \002{0}\002."), ci->name); } else this->OnSyntaxError(source, source.command); @@ -83,6 +84,7 @@ class CommandBSSetFantasy : public Command class Fantasy : public Module , public EventHook<Event::Privmsg> + , public EventHook<Event::BotInfoEvent> { SerializableExtensibleItem<bool> fantasy; @@ -94,6 +96,7 @@ class Fantasy : public Module public: Fantasy(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR) , EventHook<Event::Privmsg>("OnPrivmsg") + , EventHook<Event::BotInfoEvent>("OnBotInfoEvent") , fantasy(this, "BS_FANTASY") , commandbssetfantasy(this) , OnBotFantasy(this, "OnBotFantasy") @@ -201,7 +204,7 @@ class Fantasy : public Module Event::OnPostCommand(&Event::PostCommand::OnPostCommand, source, cmd, params); } - void OnBotInfo(CommandSource &source, BotInfo *bi, ChanServ::Channel *ci, InfoFormatter &info) + void OnBotInfo(CommandSource &source, BotInfo *bi, ChanServ::Channel *ci, InfoFormatter &info) override { if (fantasy.HasExt(ci)) info.AddOption(_("Fantasy")); diff --git a/modules/ns_maxemail.cpp b/modules/ns_maxemail.cpp index 2ead0de86..1f02e7ca3 100644 --- a/modules/ns_maxemail.cpp +++ b/modules/ns_maxemail.cpp @@ -26,9 +26,9 @@ class NSMaxEmail : public Module return false; if (NSEmailMax == 1) - source.Reply(_("The email address \002%s\002 has reached its usage limit of 1 user."), email.c_str()); + source.Reply(_("The email address \002{0}\002 has reached its usage limit of \0021\002 user."), email); else - source.Reply(_("The email address \002%s\002 has reached its usage limit of %d users."), email.c_str(), NSEmailMax); + source.Reply(_("The email address \002{0}\002 has reached its usage limit of \002{1}\002 users."), email, NSEmailMax); return true; } diff --git a/modules/pseudoclients/chanserv/chanserv.cpp b/modules/pseudoclients/chanserv/chanserv.cpp index d4f3aa1c7..a667fb08d 100644 --- a/modules/pseudoclients/chanserv/chanserv.cpp +++ b/modules/pseudoclients/chanserv/chanserv.cpp @@ -385,7 +385,7 @@ class ChanServCore : public Module { if (bi == ChanServ && Config->GetModule(this)->Get<bool>("opersonly") && !u->HasMode("OPER")) { - u->SendMessage(bi, ACCESS_DENIED); + u->SendMessage(bi, _("Access denied.")); return EVENT_STOP; } diff --git a/modules/pseudoclients/memoserv/memoserv.cpp b/modules/pseudoclients/memoserv/memoserv.cpp index c0a1022d0..f9185afe7 100644 --- a/modules/pseudoclients/memoserv/memoserv.cpp +++ b/modules/pseudoclients/memoserv/memoserv.cpp @@ -117,7 +117,7 @@ class MemoServCore : public Module, public MemoServ::MemoServService if (ci->AccessFor(cu->user).HasPriv("MEMO")) { if (cu->user->Account() && cu->user->Account()->HasExt("MEMO_RECEIVE")) - cu->user->SendMessage(*MemoServ, MEMO_NEW_X_MEMO_ARRIVED, ci->name.c_str(), Config->StrictPrivmsg.c_str(), MemoServ->nick.c_str(), ci->name.c_str(), mi->memos->size()); + cu->user->SendMessage(*MemoServ, _("There is a new memo on channel \002{0}\002. Type \002{1}{2} READ {3} {4}\002 to read it."), ci->name, Config->StrictPrivmsg, MemoServ->nick, ci->name, mi->memos->size()); // XXX } } } @@ -133,7 +133,7 @@ class MemoServCore : public Module, public MemoServ::MemoServService const NickServ::Nick *na = nc->aliases->at(i); User *user = User::Find(na->nick); if (user && user->IsIdentified()) - user->SendMessage(*MemoServ, MEMO_NEW_MEMO_ARRIVED, source.c_str(), Config->StrictPrivmsg.c_str(), MemoServ->nick.c_str(), mi->memos->size()); + user->SendMessage(*MemoServ, _("You have a new memo from \002{0}\002. Type \002{1}{2} READ {3}\002 to read it."), source, Config->StrictPrivmsg, MemoServ->nick, mi->memos->size());//XXX } } diff --git a/modules/pseudoclients/nickserv/nickserv.cpp b/modules/pseudoclients/nickserv/nickserv.cpp index b58fe3ccc..75d68c430 100644 --- a/modules/pseudoclients/nickserv/nickserv.cpp +++ b/modules/pseudoclients/nickserv/nickserv.cpp @@ -234,15 +234,15 @@ class NickServCore : public Module, public NickServ::NickServService if (on_access || !na->nc->HasExt("KILL_IMMED")) { if (na->nc->HasExt("NS_SECURE")) - u->SendMessage(*NickServ, NICK_IS_SECURE, Config->StrictPrivmsg.c_str(), NickServ->nick.c_str()); + u->SendMessage(*NickServ, _("This nickname is registered and protected. If this is your nickname, type \002{0}{1} IDENTIFY \037password\037\002. Otherwise, please choose a different nickname."), Config->StrictPrivmsg, NickServ->nick); // XXX else - u->SendMessage(*NickServ, NICK_IS_REGISTERED, Config->StrictPrivmsg.c_str(), NickServ->nick.c_str()); + u->SendMessage(*NickServ, _("This nickname is owned by someone else. If this is your nickname, type \002{0}{1} IDENTIFY \037password\037\002. Otherwise, please choose a different nickname."), Config->StrictPrivmsg, NickServ->nick); // XXX } if (na->nc->HasExt("KILLPROTECT") && !on_access) { if (na->nc->HasExt("KILL_IMMED")) { - u->SendMessage(*NickServ, FORCENICKCHANGE_NOW); + u->SendMessage(*NickServ, _("This nickname has been registered; you may not use it.")); this->Collide(u, na); } else if (na->nc->HasExt("KILL_QUICK")) diff --git a/modules/pseudoclients/operserv.cpp b/modules/pseudoclients/operserv.cpp index 2d2d56425..428484f1b 100644 --- a/modules/pseudoclients/operserv.cpp +++ b/modules/pseudoclients/operserv.cpp @@ -237,7 +237,7 @@ class OperServCore : public Module { if (bi == OperServ && !u->HasMode("OPER") && Config->GetModule(this)->Get<bool>("opersonly")) { - u->SendMessage(bi, ACCESS_DENIED); + u->SendMessage(bi, "Access denied."); ::Log(bi, "bados") << "Denied access to " << bi->nick << " from " << u->GetMask() << " (non-oper)"; return EVENT_STOP; } diff --git a/modules/webcpanel/pages/chanserv/modes.cpp b/modules/webcpanel/pages/chanserv/modes.cpp index 61c170ee2..4af5dd16c 100644 --- a/modules/webcpanel/pages/chanserv/modes.cpp +++ b/modules/webcpanel/pages/chanserv/modes.cpp @@ -39,7 +39,7 @@ bool WebCPanel::ChanServ::Modes::OnRequest(HTTPProvider *server, const Anope::st if (!c) { - replacements["MESSAGES"] = Anope::printf(CHAN_X_NOT_IN_USE, chname.c_str()); + replacements["MESSAGES"] = Anope::printf(_("Channel \002%s\002 doesn't exist."), chname.c_str()); Page.Serve(server, page_name, client, message, reply, replacements); return true; } diff --git a/src/bots.cpp b/src/bots.cpp index ea0bf4ec3..52773dd72 100644 --- a/src/bots.cpp +++ b/src/bots.cpp @@ -233,6 +233,7 @@ CommandInfo& BotInfo::SetCommand(const Anope::string &cname, const Anope::string { CommandInfo ci; ci.name = sname; + ci.cname = cname; ci.permission = permission; this->commands[cname] = ci; return this->commands[cname]; @@ -246,6 +247,19 @@ CommandInfo *BotInfo::GetCommand(const Anope::string &cname) return NULL; } +CommandInfo *BotInfo::FindCommand(const Anope::string &service) +{ + for (auto& it : commands) + { + CommandInfo &ci = it.second; + + if (ci.name == service) + return &ci; + } + + return nullptr; +} + BotInfo* BotInfo::Find(const Anope::string &nick, bool nick_only) { BotInfo *bi = NULL; diff --git a/src/channels.cpp b/src/channels.cpp index 9ba886c30..aff45fcd6 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -885,7 +885,7 @@ bool Channel::CheckKick(User *user) if (mask.empty()) mask = this->ci->GetIdealBan(user); if (reason.empty()) - reason = Language::Translate(user->Account(), CHAN_NOT_ALLOWED_TO_JOIN); + reason = Language::Translate(user->Account(), _("You are not permitted to be on this channel.")); Log(LOG_DEBUG) << "Autokicking " << user->nick << " (" << mask << ") from " << this->name; diff --git a/src/command.cpp b/src/command.cpp index 16070b221..59db22a4b 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -95,21 +95,6 @@ bool CommandSource::IsOper() return false; } -void CommandSource::Reply(const char *message, ...) -{ - va_list args; - char buf[4096]; // Messages can be really big. - - const char *translated_message = Language::Translate(this->nc, message); - - va_start(args, message); - vsnprintf(buf, sizeof(buf), translated_message, args); - - this->Reply(Anope::string(buf)); - - va_end(args); -} - void CommandSource::Reply(const Anope::string &message) { const char *translated_message = Language::Translate(this->nc, message.c_str()); @@ -149,13 +134,13 @@ void Command::SendSyntax(CommandSource &source) Anope::string s = Language::Translate(source.GetAccount(), _("Syntax")); if (!this->syntax.empty()) { - source.Reply("%s: \002%s %s\002", s.c_str(), source.command.c_str(), Language::Translate(source.GetAccount(), this->syntax[0].c_str())); + source.Reply("{0}: \002{1} {2}\002", s, source.command, Language::Translate(source.GetAccount(), this->syntax[0].c_str())); Anope::string spaces(s.length(), ' '); for (unsigned i = 1, j = this->syntax.size(); i < j; ++i) - source.Reply("%s \002%s %s\002", spaces.c_str(), source.command.c_str(), Language::Translate(source.GetAccount(), this->syntax[i].c_str())); + source.Reply("{0} \002{1} {2}\002", spaces, source.command, Language::Translate(source.GetAccount(), this->syntax[i].c_str())); } else - source.Reply("%s: \002%s\002", s.c_str(), source.command.c_str()); + source.Reply("{0}: \002{1}\002", s, source.command); } bool Command::AllowUnregistered() const @@ -185,7 +170,7 @@ const Anope::string Command::GetDesc(CommandSource &) const void Command::OnServHelp(CommandSource &source) { - source.Reply(" %-14s %s", source.command.c_str(), Language::Translate(source.nc, this->GetDesc(source).c_str())); + source.Reply(Anope::printf(" %-14s %s", source.command.c_str(), Language::Translate(source.nc, this->GetDesc(source).c_str()))); } bool Command::OnHelp(CommandSource &source, const Anope::string &subcommand) { return false; } @@ -195,7 +180,7 @@ void Command::OnSyntaxError(CommandSource &source, const Anope::string &subcomma this->SendSyntax(source); bool has_help = source.service->commands.find("HELP") != source.service->commands.end(); if (has_help) - source.Reply(MORE_INFO, Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), source.command.c_str()); + source.Reply(_("\002{0}{1} HELP {2}\002 for more information."), Config->StrictPrivmsg, source.service->nick, source.command); } void Command::Run(CommandSource &source, const Anope::string &message) @@ -244,7 +229,7 @@ void Command::Run(CommandSource &source, const Anope::string &message) // Command requires registered users only if (!c->AllowUnregistered() && !source.nc) { - source.Reply(NICK_IDENTIFY_REQUIRED); + source.Reply(_("Password authentication required for that command.")); if (source.GetUser()) Log(LOG_NORMAL, "access_denied_unreg", source.service) << "Access denied for unregistered user " << source.GetUser()->GetMask() << " with command " << it->first; return; @@ -276,7 +261,10 @@ void Command::Run(CommandSource &source, const Anope::string &message) // If the command requires a permission, and they aren't registered or don't have the required perm, DENIED if (!info.permission.empty() && !source.HasCommand(info.permission)) { - source.Reply(ACCESS_DENIED); + if (!source.IsOper()) + source.Reply(_("Access denied. You are not a Services Operator.")); + else + source.Reply(_("Access denied. You do not have access to command \002{0}\002."), info.permission); if (source.GetUser()) Log(LOG_NORMAL, "access_denied", source.service) << "Access denied for user " << source.GetUser()->GetMask() << " with command " << it->first; return; diff --git a/src/config.cpp b/src/config.cpp index 2fb38107b..d14f1089f 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -452,6 +452,7 @@ Conf::Conf() : Block("") CommandInfo &c = this->Fantasy[nname]; c.name = service; + c.cname = nname; c.permission = permission; c.group = group; c.hide = hide; @@ -535,9 +536,13 @@ Conf::Conf() : Block("") regex_flags = std::regex::grep; else if (regex_engine == "egrep") regex_flags = std::regex::egrep; + else + regex_flags = static_cast<std::basic_regex<char>::flag_type>(0); /* always enable icase and optimize */ if (regex_flags) regex_flags |= std::regex::icase | std::regex::optimize; + + this->LineWrap = options->Get<unsigned>("linewrap", "200"); } Conf::~Conf() diff --git a/src/misc.cpp b/src/misc.cpp index a68028a70..b6891d669 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -371,7 +371,7 @@ Anope::string Anope::strftime(time_t t, const NickServ::Account *nc, bool short_ Anope::string Anope::Expires(time_t expires, const NickServ::Account *nc) { if (!expires) - return Language::Translate(nc, NO_EXPIRE); + return Language::Translate(nc, _("does not expire")); else if (expires <= Anope::CurTime) return Language::Translate(nc, _("expires momentarily")); else diff --git a/src/users.cpp b/src/users.cpp index 81fd13a33..47923a350 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -330,21 +330,6 @@ User::~User() Event::OnPostUserLogoff(&Event::PostUserLogoff::OnPostUserLogoff, this); } -void User::SendMessage(const MessageSource &source, const char *fmt, ...) -{ - va_list args; - char buf[BUFSIZE] = ""; - - const char *translated_message = Language::Translate(this, fmt); - - va_start(args, fmt); - vsnprintf(buf, BUFSIZE - 1, translated_message, args); - - this->SendMessage(source, Anope::string(buf)); - - va_end(args); -} - void User::SendMessage(const MessageSource &source, const Anope::string &msg) { const char *translated_message = Language::Translate(this, msg.c_str()); @@ -358,10 +343,34 @@ void User::SendMessage(const MessageSource &source, const Anope::string &msg) sepstream sep(translated_message, '\n', true); for (Anope::string tok; sep.GetToken(tok);) { - if (send_privmsg) - IRCD->SendPrivmsg(source, this->GetUID(), "%s", tok.c_str()); - else - IRCD->SendNotice(source, this->GetUID(), "%s", tok.c_str()); + if (tok.empty()) + tok = " "; + spacesepstream ssep(tok, true); + Anope::string buf; + for (Anope::string word; ssep.GetToken(word);) + { + if (word.empty()) + word = " "; + Anope::string add = buf.empty() ? word : " " + word; + if (buf.length() + add.length() > Config->LineWrap) + { + if (send_privmsg) + IRCD->SendPrivmsg(source, this->GetUID(), "%s", buf.c_str()); + else + IRCD->SendNotice(source, this->GetUID(), "%s", buf.c_str()); + buf.clear(); + add = word; + } + buf.append(add); + } + + if (!buf.empty()) + { + if (send_privmsg) + IRCD->SendPrivmsg(source, this->GetUID(), "%s", buf.c_str()); + else + IRCD->SendNotice(source, this->GetUID(), "%s", buf.c_str()); + } } } @@ -386,14 +395,14 @@ void User::Identify(NickServ::Nick *na) if (!this->nc->o->ot->modes.empty()) { this->SetModes(NULL, "%s", this->nc->o->ot->modes.c_str()); - this->SendMessage(Me, "Changing your usermodes to \002%s\002", this->nc->o->ot->modes.c_str()); + this->SendMessage(Me, "Changing your usermodes to \002{0}\002", this->nc->o->ot->modes); UserMode *um = ModeManager::FindUserModeByName("OPER"); if (um && !this->HasMode("OPER") && this->nc->o->ot->modes.find(um->mchar) != Anope::string::npos) IRCD->SendOper(this); } if (IRCD->CanSetVHost && !this->nc->o->vhost.empty()) { - this->SendMessage(Me, "Changing your vhost to \002%s\002", this->nc->o->vhost.c_str()); + this->SendMessage(Me, "Changing your vhost to \002{0}\002", this->nc->o->vhost); this->SetDisplayedHost(this->nc->o->vhost); IRCD->SendVhost(this, "", this->nc->o->vhost); } |
