summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/commands.h19
-rw-r--r--modules/botserv/assign.cpp8
-rw-r--r--modules/botserv/badwords.cpp10
-rw-r--r--modules/botserv/bot.cpp8
-rw-r--r--modules/botserv/botlist.cpp2
-rw-r--r--modules/botserv/control.cpp2
-rw-r--r--modules/botserv/kick.cpp8
-rw-r--r--modules/botserv/main/botserv.cpp16
-rw-r--r--modules/botserv/set.cpp6
-rw-r--r--modules/chanserv/access.cpp16
-rw-r--r--modules/chanserv/akick.cpp12
-rw-r--r--modules/chanserv/entrymsg.cpp2
-rw-r--r--modules/chanserv/flags.cpp2
-rw-r--r--modules/chanserv/list.cpp2
-rw-r--r--modules/chanserv/log.cpp2
-rw-r--r--modules/chanserv/main/chanserv.cpp10
-rw-r--r--modules/chanserv/mode.cpp8
-rw-r--r--modules/chanserv/set.cpp32
-rw-r--r--modules/chanserv/set_misc.cpp12
-rw-r--r--modules/chanserv/topic.cpp2
-rw-r--r--modules/chanserv/xop.cpp64
-rw-r--r--modules/fantasy.cpp7
-rw-r--r--modules/greet.cpp4
-rw-r--r--modules/help.cpp6
-rw-r--r--modules/hostserv/list.cpp2
-rw-r--r--modules/hostserv/set.cpp4
-rw-r--r--modules/memoserv/del.cpp2
-rw-r--r--modules/memoserv/info.cpp2
-rw-r--r--modules/memoserv/read.cpp2
-rw-r--r--modules/memoserv/send.cpp2
-rw-r--r--modules/memoserv/set.cpp4
-rw-r--r--modules/nickserv/access.cpp4
-rw-r--r--modules/nickserv/group.cpp4
-rw-r--r--modules/nickserv/main/nickserv.cpp12
-rw-r--r--modules/nickserv/recover.cpp4
-rw-r--r--modules/nickserv/register.cpp2
-rw-r--r--modules/nickserv/set.cpp14
-rw-r--r--modules/nickserv/set_misc.cpp10
-rw-r--r--modules/operserv/akill.cpp10
-rw-r--r--modules/operserv/dns.cpp2
-rw-r--r--modules/operserv/ignore.cpp2
-rw-r--r--modules/operserv/logsearch.cpp2
-rw-r--r--modules/operserv/session.cpp4
-rw-r--r--modules/operserv/shutdown.cpp4
-rw-r--r--modules/operserv/sxline.cpp46
-rw-r--r--modules/rewrite.cpp10
-rw-r--r--src/bots.cpp5
-rw-r--r--src/command.cpp33
-rw-r--r--src/config.cpp2
49 files changed, 236 insertions, 212 deletions
diff --git a/include/commands.h b/include/commands.h
index 5431df7a5..d3aa180a2 100644
--- a/include/commands.h
+++ b/include/commands.h
@@ -35,8 +35,6 @@ struct CommandInfo
{
typedef Anope::map<CommandInfo> map;
- CommandInfo() : hide(false), prepend_channel(false) { }
-
/* Service name of the command */
Anope::string name;
/* User visible name */
@@ -46,9 +44,9 @@ struct CommandInfo
/* Group this command is in */
Anope::string group;
/* whether or not to hide this command in help output */
- bool hide;
+ bool hide = false;
/* Only used with fantasy */
- bool prepend_channel;
+ bool prepend_channel = false;
};
/* Where the replies from commands go to. User inheits from this and is the normal
@@ -67,6 +65,8 @@ class CoreExport CommandSource
Anope::string nick;
/* User executing the command, may be NULL */
Reference<User> u;
+ /* Command info being executed */
+ CommandInfo command;
public:
/* The account executing the command */
Reference<NickServ::Account> nc;
@@ -76,10 +76,6 @@ class CoreExport CommandSource
Reference<Channel> c;
/* The service this command is on */
Reference<ServiceBot> service;
- /* The actual name of the command being executed */
- Anope::string command;
- /* The permission of the command being executed */
- Anope::string permission;
CommandSource(const Anope::string &n, User *user, NickServ::Account *core, CommandReply *reply, ServiceBot *bi);
@@ -87,7 +83,14 @@ class CoreExport CommandSource
User *GetUser();
NickServ::Account *GetAccount();
Anope::string GetSource();
+
const Anope::string &GetCommand() const;
+ void SetCommand(const Anope::string &);
+
+ const Anope::string &GetPermission() const;
+
+ const CommandInfo &GetCommandInfo() const;
+ void SetCommandInfo(const CommandInfo &);
ChanServ::AccessGroup AccessFor(ChanServ::Channel *ci);
bool IsFounder(ChanServ::Channel *ci);
diff --git a/modules/botserv/assign.cpp b/modules/botserv/assign.cpp
index db368c75e..bb2d35879 100644
--- a/modules/botserv/assign.cpp
+++ b/modules/botserv/assign.cpp
@@ -96,7 +96,7 @@ class CommandBSAssign : public Command
"Example:\n"
" {command} #anope Botox\n"
" Assigns the bot Botox to #anope.\n"),
- "ASSIGN", "command"_kw = source.command);
+ "ASSIGN", "command"_kw = source.GetCommand());
return true;
}
};
@@ -164,7 +164,7 @@ class CommandBSUnassign : public Command
"Example:\n"
" {command} #anope\n"
" Unassigns the current bot from #anope.\n"),
- "ASSIGN", "command"_kw = source.command);
+ "ASSIGN", "command"_kw = source.GetCommand());
return true;
}
};
@@ -208,7 +208,7 @@ class CommandBSSetNoBot : public Command
}
else
{
- this->OnSyntaxError(source, source.command);
+ this->OnSyntaxError(source, source.GetCommand());
}
}
@@ -220,7 +220,7 @@ class CommandBSSetNoBot : public Command
"Example:\n"
" {command} #anope on\n"
" Prevents a service bot from being assigned to #anope.\n"),
- "command"_kw = source.command);
+ "command"_kw = source.GetCommand());
return true;
}
};
diff --git a/modules/botserv/badwords.cpp b/modules/botserv/badwords.cpp
index 071414ac4..3de381d34 100644
--- a/modules/botserv/badwords.cpp
+++ b/modules/botserv/badwords.cpp
@@ -388,7 +388,7 @@ class CommandBSBadwords : public Command
"Examples:\n"
" {command} #anope ADD raw SINGLE\n"
" Adds the bad word \"raw\" to the bad word list of #anope."),
- "command"_kw = source.command);
+ "command"_kw = source.GetCommand());
}
else if (subcommand.equals_ci("DEL"))
{
@@ -400,7 +400,7 @@ class CommandBSBadwords : public Command
"\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);
+ "command"_kw = source.GetCommand());
}
else if (subcommand.equals_ci("LIST"))
@@ -415,7 +415,7 @@ class CommandBSBadwords : public Command
"\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);
+ "command"_kw = source.GetCommand());
}
else if (subcommand.equals_ci("CLEAR"))
{
@@ -425,7 +425,7 @@ class CommandBSBadwords : public Command
"Example:\n"
" {command} #anope CLEAR\n"
" Clears the bad word list for #anope."),
- "command"_kw = source.command);
+ "command"_kw = source.GetCommand());
}
else
{
@@ -448,7 +448,7 @@ class CommandBSBadwords : public Command
"\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);
+ "msg"_kw = Config->StrictPrivmsg, "service"_kw = source.service->nick, "command"_kw = source.GetCommand(), "help"_kw = help->cname);
}
return true;
}
diff --git a/modules/botserv/bot.cpp b/modules/botserv/bot.cpp
index 4eb5d2069..ab48dc82e 100644
--- a/modules/botserv/bot.cpp
+++ b/modules/botserv/bot.cpp
@@ -394,7 +394,7 @@ class CommandBSBot : public Command
"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);
+ "botserv/bot/add", "command"_kw = source.GetCommand());
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."
@@ -404,7 +404,7 @@ class CommandBSBot : public Command
"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);
+ "botserv/bot/change", "command"_kw = source.GetCommand());
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"
@@ -412,7 +412,7 @@ class CommandBSBot : public Command
"Example:\n"
" {command} DEL peer\n"
" Removes the bot \"peer\" from the bot list."),
- "botserv/bot/del", "command"_kw = source.command);
+ "botserv/bot/del", "command"_kw = source.GetCommand());
else
{
source.Reply(_("Allows Services Operators to create, modify, and delete bots that users will be able to use on their channels."));
@@ -428,7 +428,7 @@ class CommandBSBot : public Command
"\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);
+ "msg"_kw = Config->StrictPrivmsg, "help"_kw = help->cname, "command"_kw = source.GetCommand());
}
return true;
}
diff --git a/modules/botserv/botlist.cpp b/modules/botserv/botlist.cpp
index 6c12a2c59..e9ce213a6 100644
--- a/modules/botserv/botlist.cpp
+++ b/modules/botserv/botlist.cpp
@@ -80,7 +80,7 @@ class CommandBSBotList : public Command
source.Reply(_("\n"
"Example:\n"
" {command} BOTLIST"),
- "command"_kw = source.command);
+ "command"_kw = source.GetCommand());
return true;
}
};
diff --git a/modules/botserv/control.cpp b/modules/botserv/control.cpp
index 1785e65e9..6a8edc200 100644
--- a/modules/botserv/control.cpp
+++ b/modules/botserv/control.cpp
@@ -155,7 +155,7 @@ class CommandBSAct : public Command
"Example:\n"
" {command} #anope slaps Cronus\n"
" Shows the assigned service bot \"slapping\" Cronus."),
- "command"_kw = source.command);
+ "command"_kw = source.GetCommand());
return true;
}
};
diff --git a/modules/botserv/kick.cpp b/modules/botserv/kick.cpp
index 745525fa3..84939c963 100644
--- a/modules/botserv/kick.cpp
+++ b/modules/botserv/kick.cpp
@@ -533,7 +533,7 @@ class CommandBSKick : public Command
"\n"
"Available kickers:"));
- Anope::string this_name = source.command;
+ Anope::string this_name = source.GetCommand();
for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it)
{
const Anope::string &c_name = it->first;
@@ -544,7 +544,7 @@ class CommandBSKick : public Command
ServiceReference<Command> command(info.name);
if (command)
{
- source.command = c_name;
+ source.SetCommand(c_name);
command->OnServHelp(source);
}
}
@@ -1114,7 +1114,7 @@ class CommandBSSetDontKickOps : public Command
}
else
{
- this->OnSyntaxError(source, source.command);
+ this->OnSyntaxError(source, source.GetCommand());
}
}
@@ -1180,7 +1180,7 @@ class CommandBSSetDontKickVoices : public Command
}
else
{
- this->OnSyntaxError(source, source.command);
+ this->OnSyntaxError(source, source.GetCommand());
}
}
diff --git a/modules/botserv/main/botserv.cpp b/modules/botserv/main/botserv.cpp
index 4b0309b31..522b55489 100644
--- a/modules/botserv/main/botserv.cpp
+++ b/modules/botserv/main/botserv.cpp
@@ -158,29 +158,29 @@ class BotServCore : public Module, public BotServ::BotServService
if (source.c)
{
- source.Reply(_("\002%s\002 allows you to execute \"fantasy\" commands in the channel.\n"
+ source.Reply(_("\002{0}\002 allows you to execute \"fantasy\" commands in the channel.\n"
"Fantasy commands are commands that can be executed from messaging a\n"
"channel, and provide a more convenient way to execute commands. Commands that\n"
"require a channel as a parameter will automatically have that parameter\n"
- "given.\n"), source.service->nick.c_str());
+ "given.\n"), source.service->nick);
const Anope::string &fantasycharacters = Config->GetModule("fantasy")->Get<Anope::string>("fantasycharacter", "!");
if (!fantasycharacters.empty())
source.Reply(_(" \n"
- "Fantasy commands may be prefixed with one of the following characters: %s\n"), fantasycharacters.c_str());
+ "Fantasy commands may be prefixed with one of the following characters: {0}\n"), fantasycharacters);
source.Reply(_(" \n"
"Available commands are:"));
}
else if (*source.service == BotServ)
{
- source.Reply(_("\002%s\002 allows you to have a bot on your own channel.\n"
+ source.Reply(_("\002{0}\002 allows you to have a bot on your own channel.\n"
"It has been created for users that can't host or\n"
"configure a bot, or for use on networks that don't\n"
"allow user bots. Available commands are listed\n"
- "below; to use them, type \002%s%s \037command\037\002. For\n"
+ "below; to use them, type \002{1}{2} \037command\037\002. For\n"
"more information on a specific command, type\n"
- "\002%s%s %s \037command\037\002.\n"),
- BotServ->nick.c_str(), Config->StrictPrivmsg.c_str(), BotServ->nick.c_str(),
- Config->StrictPrivmsg.c_str(), BotServ->nick.c_str(), source.command.c_str());
+ "\002{3}{4} {5} \037command\037\002.\n"),
+ BotServ->nick, Config->StrictPrivmsg, BotServ->nick,
+ Config->StrictPrivmsg, BotServ->nick, source.GetCommand());
}
return EVENT_CONTINUE;
diff --git a/modules/botserv/set.cpp b/modules/botserv/set.cpp
index 6845281cb..da3b42f92 100644
--- a/modules/botserv/set.cpp
+++ b/modules/botserv/set.cpp
@@ -41,7 +41,7 @@ class CommandBSSet : public Command
"Available options:"));
bool hide_privileged_commands = Config->GetBlock("options")->Get<bool>("hideprivilegedcommands"),
hide_registered_commands = Config->GetBlock("options")->Get<bool>("hideregisteredcommands");
- Anope::string this_name = source.command;
+ Anope::string this_name = source.GetCommand();
for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it)
{
const Anope::string &c_name = it->first;
@@ -58,7 +58,7 @@ class CommandBSSet : public Command
if (hide_privileged_commands && !info.permission.empty() && !source.HasCommand(info.permission))
continue;
- source.command = it->first;
+ source.SetCommand(it->first);
command->OnServHelp(source);
}
}
@@ -192,7 +192,7 @@ class CommandBSSetPrivate : public Command
}
else
{
- this->OnSyntaxError(source, source.command);
+ this->OnSyntaxError(source, source.GetCommand());
}
}
diff --git a/modules/chanserv/access.cpp b/modules/chanserv/access.cpp
index 6ad67733e..36307c52f 100644
--- a/modules/chanserv/access.cpp
+++ b/modules/chanserv/access.cpp
@@ -553,7 +553,7 @@ class CommandCSAccess : public Command
" 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");
+ source.GetCommand(), ChanServ::ACCESS_INVALID + 1, ChanServ::ACCESS_FOUNDER - 1, "AUTOOP", "ACCESS_CHANGE");
if (!Config->GetModule("chanserv/main")->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."));
@@ -577,7 +577,7 @@ class CommandCSAccess : public Command
"Example:\n"
" {command} #anope del DukePyrolator\n"
" Removes the access of \"DukePyrolator\" from \"#anope\"."),
- source.command, "ACCESS_CHANGE");
+ source.GetCommand(), "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."
@@ -588,11 +588,11 @@ class CommandCSAccess : public Command
"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");
+ source.GetCommand(), "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");
+ source.GetCommand(), "FOUNDER");
else
{
@@ -624,7 +624,7 @@ class CommandCSAccess : public Command
"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,
+ "msg"_kw = Config->StrictPrivmsg, "service"_kw = source.service->nick, "command"_kw = source.GetCommand(),
"help"_kw = help->cname, "change"_kw = "ACCESS_CHANGE", "list"_kw = "ACCESS_LIST", "founder"_kw = "FOUNDER");
}
@@ -668,7 +668,7 @@ class CommandCSLevels : public Command
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);
+ what, Config->StrictPrivmsg, source.service->nick, help->cname, source.GetCommand());
}
else
{
@@ -712,7 +712,7 @@ class CommandCSLevels : public Command
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);
+ what, Config->StrictPrivmsg, source.service->nick, help->cname, source.GetCommand());
}
void DoList(CommandSource &source, ChanServ::Channel *ci)
@@ -878,7 +878,7 @@ class CommandCSLevels : public Command
"\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);
+ source.GetCommand(), name, "FOUNDER", help->cname, source.GetCommand());
}
return true;
}
diff --git a/modules/chanserv/akick.cpp b/modules/chanserv/akick.cpp
index 35bca6818..60d6530e4 100644
--- a/modules/chanserv/akick.cpp
+++ b/modules/chanserv/akick.cpp
@@ -620,7 +620,7 @@ class CommandCSAKick : public Command
"\n"
" {command} #anope ADD Guest*!*@*\n"
" Adds the mask \"Guest*!*@*\" to the auto kick list of \"#anope\"."),
- source.command);
+ source.GetCommand());
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"
@@ -628,7 +628,7 @@ class CommandCSAKick : public Command
"Example:\n"
" {command} #anope DEL Cronus!\n"
" Removes the auto kick for \"Cronus\" from the auto kick list of \"#anope\".\n"),
- source.command);
+ source.GetCommand());
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."
@@ -638,7 +638,7 @@ class CommandCSAKick : public Command
"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);
+ source.GetCommand());
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"
@@ -646,14 +646,14 @@ class CommandCSAKick : public Command
"Example:\n"
" \002{0} #anope ENFORCE\002\n"
" Enforces the auto kick list of #anope."),
- source.command);
+ source.GetCommand());
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);
+ source.GetCommand());
else
{
source.Reply(_("Maintains the auto kick list for \037channel\037."
@@ -678,7 +678,7 @@ class CommandCSAKick : public Command
""
"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);
+ "msg"_kw = Config->StrictPrivmsg, "service"_kw = source.service->nick, "help"_kw = help->cname, "command"_kw = source.GetCommand());
}
return true;
diff --git a/modules/chanserv/entrymsg.cpp b/modules/chanserv/entrymsg.cpp
index b2edbc56f..8867fe6ab 100644
--- a/modules/chanserv/entrymsg.cpp
+++ b/modules/chanserv/entrymsg.cpp
@@ -264,7 +264,7 @@ class CommandEntryMessage : public Command
"The \002{0} CLEAR\002 command clears the entry message list.\n"
"\n"
"Use of this command requires the \002SET\002 privilege on \037channel\037."),
- source.command);
+ source.GetCommand());
return true;
}
};
diff --git a/modules/chanserv/flags.cpp b/modules/chanserv/flags.cpp
index d87863be0..d30d02b4a 100644
--- a/modules/chanserv/flags.cpp
+++ b/modules/chanserv/flags.cpp
@@ -471,7 +471,7 @@ class CommandCSFlags : public Command
" 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.GetCommand(), "ACCESS_CHANGE");
source.Reply(" ");
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."
diff --git a/modules/chanserv/list.cpp b/modules/chanserv/list.cpp
index cd855a0b3..4c6712b67 100644
--- a/modules/chanserv/list.cpp
+++ b/modules/chanserv/list.cpp
@@ -207,7 +207,7 @@ class CommandCSSetPrivate : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
diff --git a/modules/chanserv/log.cpp b/modules/chanserv/log.cpp
index 52724a57b..7e7fb084a 100644
--- a/modules/chanserv/log.cpp
+++ b/modules/chanserv/log.cpp
@@ -350,7 +350,7 @@ public:
"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");
+ source.GetCommand(), "SET");
return true;
}
};
diff --git a/modules/chanserv/main/chanserv.cpp b/modules/chanserv/main/chanserv.cpp
index 62d1e81ba..dd6bdb472 100644
--- a/modules/chanserv/main/chanserv.cpp
+++ b/modules/chanserv/main/chanserv.cpp
@@ -346,14 +346,14 @@ class ChanServCore : public Module
{
if (!params.empty() || source.c || source.service != *ChanServ)
return EVENT_CONTINUE;
- source.Reply(_("\002%s\002 allows you to register and control various\n"
- "aspects of channels. %s can often prevent\n"
+ source.Reply(_("\002{0}\002 allows you to register and control various\n"
+ "aspects of channels. {1} can often prevent\n"
"malicious users from \"taking over\" channels by limiting\n"
"who is allowed channel operator privileges. Available\n"
"commands are listed below; to use them, type\n"
- "\002%s%s \037command\037\002. For more information on a\n"
- "specific command, type \002%s%s HELP \037command\037\002.\n"),
- ChanServ->nick.c_str(), ChanServ->nick.c_str(), Config->StrictPrivmsg.c_str(), ChanServ->nick.c_str(), Config->StrictPrivmsg.c_str(), ChanServ->nick.c_str(), ChanServ->nick.c_str(), source.command.c_str());
+ "\002{2}{3} \037command\037\002. For more information on a\n"
+ "specific command, type \002{4}{5} HELP \037command\037\002.\n"),
+ ChanServ->nick, ChanServ->nick, Config->StrictPrivmsg, ChanServ->nick, Config->StrictPrivmsg, ChanServ->nick, ChanServ->nick, source.GetCommand());
return EVENT_CONTINUE;
}
diff --git a/modules/chanserv/mode.cpp b/modules/chanserv/mode.cpp
index e76469823..c828e19ae 100644
--- a/modules/chanserv/mode.cpp
+++ b/modules/chanserv/mode.cpp
@@ -767,7 +767,7 @@ class CommandCSMode : public Command
"\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());
+ source.GetCommand().upper());
return true;
}
};
@@ -808,7 +808,7 @@ class CommandCSModes : public Command
}
ChanServ::AccessGroup u_access = source.AccessFor(ci), targ_access = ci->AccessFor(targ);
- const std::pair<bool, Anope::string> &m = modes[source.command];
+ const std::pair<bool, Anope::string> &m = modes[source.GetCommand()];
bool can_override = source.HasPriv("chanserv/administration");
bool override = false;
@@ -859,7 +859,7 @@ class CommandCSModes : public Command
const Anope::string GetDesc(CommandSource &source) const override
{
- const std::pair<bool, Anope::string> &m = modes[source.command];
+ const std::pair<bool, Anope::string> &m = modes[source.GetCommand()];
if (!m.second.empty())
{
if (m.first)
@@ -875,7 +875,7 @@ class CommandCSModes : public Command
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
{
- const std::pair<bool, Anope::string> &m = modes[source.command];
+ const std::pair<bool, Anope::string> &m = modes[source.GetCommand()];
if (m.second.empty())
return false;
diff --git a/modules/chanserv/set.cpp b/modules/chanserv/set.cpp
index 7b6775c2f..1584052f3 100644
--- a/modules/chanserv/set.cpp
+++ b/modules/chanserv/set.cpp
@@ -46,7 +46,7 @@ class CommandCSSet : public Command
source.Reply(_("Allows the channel founder to set various channel options and other information.\n"
"\n"
"Available options:"));
- Anope::string this_name = source.command;
+ Anope::string this_name = source.GetCommand();
bool hide_privileged_commands = Config->GetBlock("options")->Get<bool>("hideprivilegedcommands"),
hide_registered_commands = Config->GetBlock("options")->Get<bool>("hideregisteredcommands");
for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it)
@@ -65,7 +65,7 @@ class CommandCSSet : public Command
else if (hide_privileged_commands && !info.permission.empty() && !source.HasCommand(info.permission))
continue;
- source.command = it->first;
+ source.SetCommand(it->first);
c->OnServHelp(source);
}
}
@@ -109,7 +109,7 @@ class CommandCSSetAutoOp : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -173,7 +173,7 @@ class CommandCSSetBanType : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -242,7 +242,7 @@ class CommandCSSetDescription : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -302,7 +302,7 @@ class CommandCSSetFounder : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && (ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.permission.empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && (ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->GetName());
return;
@@ -372,7 +372,7 @@ class CommandCSSetKeepModes : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -447,7 +447,7 @@ class CommandCSSetPeace : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -523,7 +523,7 @@ class CommandCSSetPersist : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -669,7 +669,7 @@ class CommandCSSetRestricted : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -734,7 +734,7 @@ class CommandCSSetSecure : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -801,7 +801,7 @@ class CommandCSSetSecureFounder : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && (ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.permission.empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && (ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->GetName());
return;
@@ -871,7 +871,7 @@ class CommandCSSetSecureOps : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -937,7 +937,7 @@ class CommandCSSetSignKick : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -1015,7 +1015,7 @@ class CommandCSSetSuccessor : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && (ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.permission.empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && (ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->GetName());
return;
@@ -1089,7 +1089,7 @@ class CommandCSSetNoexpire : public Command
return;
}
- if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
+ if (source.GetPermission().empty() && !source.AccessFor(ci).HasPriv("SET"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
diff --git a/modules/chanserv/set_misc.cpp b/modules/chanserv/set_misc.cpp
index 76f4c7017..144010d2b 100644
--- a/modules/chanserv/set_misc.cpp
+++ b/modules/chanserv/set_misc.cpp
@@ -128,13 +128,13 @@ class CommandCSSetMisc : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
}
- Anope::string scommand = GetAttribute(source.command);
+ Anope::string scommand = GetAttribute(source.GetCommand());
/* remove existing */
for (CSMiscData *data : ci->GetRefs<CSMiscData *>())
@@ -167,18 +167,18 @@ class CommandCSSetMisc : public Command
void OnServHelp(CommandSource &source) override
{
- if (descriptions.count(source.command))
+ if (descriptions.count(source.GetCommand()))
{
- this->SetDesc(descriptions[source.command]);
+ this->SetDesc(descriptions[source.GetCommand()]);
Command::OnServHelp(source);
}
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
{
- if (descriptions.count(source.command))
+ if (descriptions.count(source.GetCommand()))
{
- source.Reply("%s", Language::Translate(source.nc, descriptions[source.command].c_str()));
+ source.Reply(Language::Translate(source.nc, descriptions[source.GetCommand()]));
return true;
}
return false;
diff --git a/modules/chanserv/topic.cpp b/modules/chanserv/topic.cpp
index 648c322fb..3b4251b58 100644
--- a/modules/chanserv/topic.cpp
+++ b/modules/chanserv/topic.cpp
@@ -54,7 +54,7 @@ class CommandCSSetKeepTopic : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
diff --git a/modules/chanserv/xop.cpp b/modules/chanserv/xop.cpp
index b95580a2b..4dd5f8b3e 100644
--- a/modules/chanserv/xop.cpp
+++ b/modules/chanserv/xop.cpp
@@ -134,7 +134,7 @@ class CommandCSXOP : public Command
if (Anope::ReadOnly)
{
- source.Reply(_("Sorry, channel {0} list modification is temporarily disabled."), source.command);
+ source.Reply(_("Sorry, channel {0} list modification is temporarily disabled."), source.GetCommand());
return;
}
@@ -142,7 +142,7 @@ class CommandCSXOP : public Command
ChanServ::ChanAccess *highest = access.Highest();
bool override = false;
- std::vector<Anope::string>::iterator cmd_it = std::find(order.begin(), order.end(), source.command.upper()),
+ std::vector<Anope::string>::iterator cmd_it = std::find(order.begin(), order.end(), source.GetCommand().upper()),
access_it = highest ? std::find(order.begin(), order.end(), XOPChanAccessImpl::DetermineLevel(highest)) : order.end();
if (!access.founder && (!access.HasPriv("ACCESS_CHANGE") || cmd_it <= access_it))
@@ -240,14 +240,14 @@ class CommandCSXOP : public Command
acc->SetChannel(ci);
acc->SetMask(mask);
acc->SetCreator(source.GetNick());
- acc->SetType(source.command.upper());
+ acc->SetType(source.GetCommand().upper());
acc->SetLastSeen(0);
acc->SetCreated(Anope::CurTime);
logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to add {0}"), mask);
EventManager::Get()->Dispatch(&Event::AccessAdd::OnAccessAdd, ci, source, acc);
- source.Reply(_("\002{0}\002 added to {1} {2} list."), acc->Mask(), ci->GetName(), source.command);
+ source.Reply(_("\002{0}\002 added to {1} {2} list."), acc->Mask(), ci->GetName(), source.GetCommand());
}
void DoDel(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
@@ -263,13 +263,13 @@ class CommandCSXOP : public Command
if (Anope::ReadOnly)
{
- source.Reply(_("Sorry, channel {0} list modification is temporarily disabled."), source.command);
+ source.Reply(_("Sorry, channel {0} list modification is temporarily disabled."), source.GetCommand());
return;
}
if (!ci->GetAccessCount())
{
- source.Reply(_("{0} {1} list is empty."), ci->GetName(), source.command);
+ source.Reply(_("{0} {1} list is empty."), ci->GetName(), source.GetCommand());
return;
}
@@ -289,7 +289,7 @@ class CommandCSXOP : public Command
}
}
- std::vector<Anope::string>::iterator cmd_it = std::find(order.begin(), order.end(), source.command.upper()),
+ std::vector<Anope::string>::iterator cmd_it = std::find(order.begin(), order.end(), source.GetCommand().upper()),
access_it = highest ? std::find(order.begin(), order.end(), XOPChanAccessImpl::DetermineLevel(highest)) : order.end();
if (!mask.equals_ci(nc->GetDisplay()) && !access.founder && (!access.HasPriv("ACCESS_CHANGE") || cmd_it <= access_it))
@@ -317,7 +317,7 @@ class CommandCSXOP : public Command
ChanServ::ChanAccess *caccess = ci->GetAccess(number - 1);
- if (caccess->GetSerializableType()->GetName() != "XOPChanAccess" || source.command.upper() != caccess->AccessSerialize())
+ if (caccess->GetSerializableType()->GetName() != "XOPChanAccess" || source.GetCommand().upper() != caccess->AccessSerialize())
return;
++deleted;
@@ -332,15 +332,15 @@ class CommandCSXOP : public Command
[&]()
{
if (!deleted)
- source.Reply(_("No matching entries on {0} {1} list."), ci->GetName(), source.command);
+ source.Reply(_("No matching entries on {0} {1} list."), ci->GetName(), source.GetCommand());
else
{
logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to delete {0}"), nicks);
if (deleted == 1)
- source.Reply(_("Deleted one entry from {0} {1} list."), ci->GetName(), source.command);
+ source.Reply(_("Deleted one entry from {0} {1} list."), ci->GetName(), source.GetCommand());
else
- source.Reply(_("Deleted {0} entries from {1} {2} list."), deleted, ci->GetName(), source.command);
+ source.Reply(_("Deleted {0} entries from {1} {2} list."), deleted, ci->GetName(), source.GetCommand());
}
});
}
@@ -350,14 +350,14 @@ class CommandCSXOP : public Command
{
ChanServ::ChanAccess *a = ci->GetAccess(i);
- if (a->GetSerializableType()->GetName() != "XOPChanAccess" || source.command.upper() != a->AccessSerialize())
+ if (a->GetSerializableType()->GetName() != "XOPChanAccess" || source.GetCommand().upper() != a->AccessSerialize())
continue;
if (a->Mask().equals_ci(mask))
{
logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to delete {0}"), a->GetMask());
- source.Reply(_("\002{0}\002 deleted from {1} {2} list."), a->Mask(), ci->GetName(), source.command);
+ source.Reply(_("\002{0}\002 deleted from {1} {2} list."), a->Mask(), ci->GetName(), source.GetCommand());
EventManager::Get()->Dispatch(&Event::AccessDel::OnAccessDel, ci, source, a);
a->Delete();
@@ -366,7 +366,7 @@ class CommandCSXOP : public Command
}
}
- source.Reply(_("\002{0}\002 not found on {1} {2} list."), mask, ci->GetName(), source.command);
+ source.Reply(_("\002{0}\002 not found on {1} {2} list."), mask, ci->GetName(), source.GetCommand());
}
}
@@ -385,7 +385,7 @@ class CommandCSXOP : public Command
if (!ci->GetAccessCount())
{
- source.Reply(_("{0} {1} list is empty."), ci->GetName(), source.command);
+ source.Reply(_("{0} {1} list is empty."), ci->GetName(), source.GetCommand());
return;
}
@@ -402,7 +402,7 @@ class CommandCSXOP : public Command
ChanServ::ChanAccess *a = ci->GetAccess(number - 1);
- if (a->GetSerializableType()->GetName() != "XOPChanAccess" || source.command.upper() != a->AccessSerialize())
+ if (a->GetSerializableType()->GetName() != "XOPChanAccess" || source.GetCommand().upper() != a->AccessSerialize())
return;
ListFormatter::ListEntry entry;
@@ -418,7 +418,7 @@ class CommandCSXOP : public Command
{
ChanServ::ChanAccess *a = ci->GetAccess(i);
- if (a->GetSerializableType()->GetName() != "XOPChanAccess" || source.command.upper() != a->AccessSerialize())
+ if (a->GetSerializableType()->GetName() != "XOPChanAccess" || source.GetCommand().upper() != a->AccessSerialize())
continue;
if (!nick.empty() && !Anope::Match(a->Mask(), nick))
continue;
@@ -439,7 +439,7 @@ class CommandCSXOP : public Command
std::vector<Anope::string> replies;
list.Process(replies);
- source.Reply(_("{0} list for {1}"), source.command, ci->GetName());
+ source.Reply(_("{0} list for {1}"), source.GetCommand(), ci->GetName());
for (unsigned i = 0; i < replies.size(); ++i)
source.Reply(replies[i]);
}
@@ -449,13 +449,13 @@ class CommandCSXOP : public Command
{
if (Anope::ReadOnly)
{
- source.Reply(_("Sorry, channel {0} list modification is temporarily disabled."), source.command);
+ source.Reply(_("Sorry, channel {0} list modification is temporarily disabled."), source.GetCommand());
return;
}
if (!ci->GetAccessCount())
{
- source.Reply(_("{0} {1} list is empty."), ci->GetName(), source.command);
+ source.Reply(_("{0} {1} list is empty."), ci->GetName(), source.GetCommand());
return;
}
@@ -472,7 +472,7 @@ class CommandCSXOP : public Command
{
ChanServ::ChanAccess *access = ci->GetAccess(i - 1);
- if (access->GetSerializableType()->GetName() != "XOPChanAccess" || source.command.upper() != access->AccessSerialize())
+ if (access->GetSerializableType()->GetName() != "XOPChanAccess" || source.GetCommand().upper() != access->AccessSerialize())
continue;
access->Delete();
@@ -480,7 +480,7 @@ class CommandCSXOP : public Command
EventManager::Get()->Dispatch(&Event::AccessClear::OnAccessClear, ci, source);
- source.Reply(_("Channel {0} {1} list has been cleared."), ci->GetName(), source.command);
+ source.Reply(_("Channel {0} {1} list has been cleared."), ci->GetName(), source.GetCommand());
}
public:
@@ -494,7 +494,7 @@ class CommandCSXOP : public Command
const Anope::string GetDesc(CommandSource &source) const override
{
- return Anope::Format(Language::Translate(source.GetAccount(), _("Modify the list of {0} users")), source.command.upper());
+ return Anope::Format(Language::Translate(source.GetAccount(), _("Modify the list of {0} users")), source.GetCommand().upper());
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
@@ -527,13 +527,13 @@ class CommandCSXOP : public Command
{
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.GetCommand());
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);
+ "ACCESS_CHANGE", source.GetCommand());
}
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."
@@ -543,7 +543,7 @@ class CommandCSXOP : public Command
"Example:\n"
" {0} #anope DEL Cronus"
" Removes \"Cronus\" from the {0} list of \"#anope\""),
- source.command, "ACCESS_CHANGE");
+ source.GetCommand(), "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."
@@ -554,23 +554,23 @@ class CommandCSXOP : public Command
"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");
+ source.GetCommand(), "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");
+ source.GetCommand(), "FOUNDER");
else
{
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);
+ source.GetCommand());
Anope::string buf;
- for (unsigned i = 0; i < permissions[source.command].size(); ++i)
- buf += "," + permissions[source.command][i];
+ for (unsigned i = 0; i < permissions[source.GetCommand()].size(); ++i)
+ buf += "," + permissions[source.GetCommand()][i];
source.Reply(buf);
@@ -593,7 +593,7 @@ class CommandCSXOP : public Command
"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);
+ source.GetCommand(), "change"_kw = "ACCESS_CHANGE", "list"_kw = "ACCESS_LIST", "help"_kw = help->cname);
Anope::string access_cmd, flags_cmd;
ServiceBot *access_bi, *flags_bi;
diff --git a/modules/fantasy.cpp b/modules/fantasy.cpp
index 7a9ea99f8..d8f9d3466 100644
--- a/modules/fantasy.cpp
+++ b/modules/fantasy.cpp
@@ -70,7 +70,9 @@ class CommandBSSetFantasy : public Command
source.Reply(_("Fantasy mode is now \002off\002 on channel \002{0}\002."), ci->GetName());
}
else
- this->OnSyntaxError(source, source.command);
+ {
+ this->OnSyntaxError(source, source.GetCommand());
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &) override
@@ -187,8 +189,7 @@ class Fantasy : public Module
CommandSource source(u->nick, u, u->Account(), u, c->ci->GetBot());
source.c = c;
- source.command = it->first;
- source.permission = info.permission;
+ source.SetCommandInfo(info);
ChanServ::AccessGroup ag = c->ci->AccessFor(u);
bool has_fantasia = ag.HasPriv("FANTASIA") || source.HasPriv("botserv/fantasy");
diff --git a/modules/greet.cpp b/modules/greet.cpp
index 52591f7f5..a954a7f21 100644
--- a/modules/greet.cpp
+++ b/modules/greet.cpp
@@ -72,7 +72,9 @@ class CommandBSSetGreet : public Command
source.Reply(_("Greet mode for \002{0}\002 is now \002off\002."), ci->GetName());
}
else
- this->OnSyntaxError(source, source.command);
+ {
+ this->OnSyntaxError(source, source.GetCommand());
+ }
}
bool OnHelp(CommandSource &source, const Anope::string &) override
diff --git a/modules/help.cpp b/modules/help.cpp
index b032d11a1..2776173e0 100644
--- a/modules/help.cpp
+++ b/modules/help.cpp
@@ -47,7 +47,7 @@ class CommandHelp : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- Anope::string source_command = source.command;
+ Anope::string source_command = source.GetCommand();
const ServiceBot *bi = source.service;
const CommandInfo::map &map = source.c ? Config->Fantasy : bi->commands;
bool hide_privileged_commands = Config->GetBlock("options")->Get<bool>("hideprivilegedcommands"),
@@ -96,7 +96,7 @@ class CommandHelp : public Command
}
}
- source.command = c_name;
+ source.SetCommand(c_name);
c->OnServHelp(source);
}
@@ -149,7 +149,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 = it->first;
+ source.SetCommand(it->first);
c->SendSyntax(source);
if (!c->OnHelp(source, subcommand))
diff --git a/modules/hostserv/list.cpp b/modules/hostserv/list.cpp
index 8659675d4..baafc5837 100644
--- a/modules/hostserv/list.cpp
+++ b/modules/hostserv/list.cpp
@@ -149,7 +149,7 @@ class CommandHSList : public Command
"\n"
" {0} #1-3\n"
" Lists the first three entries."),
- source.command);
+ source.GetCommand());
return true;
}
};
diff --git a/modules/hostserv/set.cpp b/modules/hostserv/set.cpp
index 8162fa80d..4b506165e 100644
--- a/modules/hostserv/set.cpp
+++ b/modules/hostserv/set.cpp
@@ -39,7 +39,7 @@ class CommandHSSet : public Command
source.Reply(" ");
source.Reply(_("Available options:"));
// XXX this entire thing is dup
- Anope::string this_name = source.command;
+ Anope::string this_name = source.GetCommand();
bool hide_privileged_commands = Config->GetBlock("options")->Get<bool>("hideprivilegedcommands"),
hide_registered_commands = Config->GetBlock("options")->Get<bool>("hideregisteredcommands");
for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it)
@@ -58,7 +58,7 @@ class CommandHSSet : public Command
else if (hide_privileged_commands && !info.permission.empty() && !source.HasCommand(info.permission))
continue;
- source.command = it->first;
+ source.SetCommand(it->first);
c->OnServHelp(source);
}
}
diff --git a/modules/memoserv/del.cpp b/modules/memoserv/del.cpp
index fbefe180e..ffd7656b7 100644
--- a/modules/memoserv/del.cpp
+++ b/modules/memoserv/del.cpp
@@ -135,7 +135,7 @@ class CommandMSDel : public Command
"\n"
" {0} 2-5,7-9\n"
" Deletes memos numbered 2 through 5 and 7 through 9."),
- source.command);
+ source.GetCommand());
return true;
}
};
diff --git a/modules/memoserv/info.cpp b/modules/memoserv/info.cpp
index 045e4cb6d..533664d91 100644
--- a/modules/memoserv/info.cpp
+++ b/modules/memoserv/info.cpp
@@ -214,7 +214,7 @@ class CommandMSInfo : public Command
" 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);
+ source.GetCommand());
return true;
}
diff --git a/modules/memoserv/read.cpp b/modules/memoserv/read.cpp
index c875c8db9..706682a32 100644
--- a/modules/memoserv/read.cpp
+++ b/modules/memoserv/read.cpp
@@ -198,7 +198,7 @@ class CommandMSRead : public Command
"\n"
" {0} 2-5,7-9\n"
" Displays memos numbered 2 through 5 and 7 through 9."),
- source.command);
+ source.GetCommand());
return true;
}
};
diff --git a/modules/memoserv/send.cpp b/modules/memoserv/send.cpp
index fdde189f9..31dfc4e66 100644
--- a/modules/memoserv/send.cpp
+++ b/modules/memoserv/send.cpp
@@ -61,7 +61,7 @@ class CommandMSSend : public Command
}
else if (result == MemoServ::MemoServService::MEMO_TOO_FAST)
{
- source.Reply(_("Please wait \002{0}\002 seconds before using the \002{1}\002 command again."), Config->GetModule("memoserv/main")->Get<time_t>("senddelay"), source.command);
+ source.Reply(_("Please wait \002{0}\002 seconds before using the \002{1}\002 command again."), Config->GetModule("memoserv/main")->Get<time_t>("senddelay"), source.GetCommand());
}
else if (result == MemoServ::MemoServService::MEMO_TARGET_FULL)
{
diff --git a/modules/memoserv/set.cpp b/modules/memoserv/set.cpp
index 12f5e5b8d..6ae0e1ba0 100644
--- a/modules/memoserv/set.cpp
+++ b/modules/memoserv/set.cpp
@@ -253,7 +253,7 @@ class CommandMSSet : public Command
" 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);
+ Config->StrictPrivmsg, source.service->nick, help->cname, source.GetCommand());
}
else if (subcommand.equals_ci("NOTIFY"))
{
@@ -295,7 +295,7 @@ class CommandMSSet : public Command
" \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);
+ source.GetCommand(), max_memos);
else
source.Reply(_("Syntax: \002LIMIT [\037channel\037] \037limit\037\002\n"
"\n"
diff --git a/modules/nickserv/access.cpp b/modules/nickserv/access.cpp
index 8c6ac0343..53cb84055 100644
--- a/modules/nickserv/access.cpp
+++ b/modules/nickserv/access.cpp
@@ -206,7 +206,7 @@ class CommandNSAccess : public Command
if (!mask.empty() && (mask.find('@') == Anope::string::npos || mask.find('!') != Anope::string::npos))
{
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
+ source.Reply(_("\002%s%s HELP %s\002 for more information."), Config->StrictPrivmsg, source.service->nick, source.GetCommand()); // XXX
return;
}
@@ -241,7 +241,7 @@ class CommandNSAccess : public Command
"\n"
" {command} LIST\n"
" Displays the current access list."),
- source.command, source.service->nick);
+ source.GetCommand(), source.service->nick);
return true;
}
};
diff --git a/modules/nickserv/group.cpp b/modules/nickserv/group.cpp
index cff53d320..5b69b449a 100644
--- a/modules/nickserv/group.cpp
+++ b/modules/nickserv/group.cpp
@@ -146,7 +146,7 @@ class CommandNSGroup : public Command
if (Anope::CurTime < u->lastnickreg + reg_delay)
{
- source.Reply(_("Please wait \002{0}\002 seconds before using the \002{1}\002 command again."), (reg_delay + u->lastnickreg) - Anope::CurTime, source.command);
+ source.Reply(_("Please wait \002{0}\002 seconds before using the \002{1}\002 command again."), (reg_delay + u->lastnickreg) - Anope::CurTime, source.GetCommand());
return;
}
@@ -365,7 +365,7 @@ class CommandNSGList : public Command
"\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);
+ source.GetCommand());
else
source.Reply(_("Lists all nicknames in your group."));
diff --git a/modules/nickserv/main/nickserv.cpp b/modules/nickserv/main/nickserv.cpp
index 3921534c9..95af33297 100644
--- a/modules/nickserv/main/nickserv.cpp
+++ b/modules/nickserv/main/nickserv.cpp
@@ -573,18 +573,18 @@ class NickServCore : public Module, public NickServ::NickServService
if (!params.empty() || source.c || source.service != *NickServ)
return EVENT_CONTINUE;
if (!Config->GetModule("nickserv/main")->Get<bool>("nonicknameownership"))
- source.Reply(_("\002%s\002 allows you to register a nickname and\n"
+ source.Reply(_("\002{0}\002 allows you to register a nickname and\n"
"prevent others from using it. The following\n"
"commands allow for registration and maintenance of\n"
- "nicknames; to use them, type \002%s%s \037command\037\002.\n"
+ "nicknames; to use them, type \002{1}{2} \037command\037\002.\n"
"For more information on a specific command, type\n"
- "\002%s%s %s \037command\037\002.\n"), NickServ->nick.c_str(), Config->StrictPrivmsg.c_str(), NickServ->nick.c_str(), Config->StrictPrivmsg.c_str(), NickServ->nick.c_str(), source.command.c_str());
+ "\002{3}{4} {5} \037command\037\002.\n"), NickServ->nick, Config->StrictPrivmsg, NickServ->nick, Config->StrictPrivmsg, NickServ->nick, source.GetCommand());
else
- source.Reply(_("\002%s\002 allows you to register an account.\n"
+ source.Reply(_("\002{0}\002 allows you to register an account.\n"
"The following commands allow for registration and maintenance of\n"
- "accounts; to use them, type \002%s%s \037command\037\002.\n"
+ "accounts; to use them, type \002{1}{2} \037command\037\002.\n"
"For more information on a specific command, type\n"
- "\002%s%s %s \037command\037\002.\n"), NickServ->nick.c_str(), Config->StrictPrivmsg.c_str(), NickServ->nick.c_str(), Config->StrictPrivmsg.c_str(), NickServ->nick.c_str(), source.command.c_str());
+ "\002{3}{4} {5} \037command\037\002.\n"), NickServ->nick, Config->StrictPrivmsg, NickServ->nick, Config->StrictPrivmsg, NickServ->nick, source.GetCommand());
return EVENT_CONTINUE;
}
diff --git a/modules/nickserv/recover.cpp b/modules/nickserv/recover.cpp
index 191e6e019..5c4f3ac1d 100644
--- a/modules/nickserv/recover.cpp
+++ b/modules/nickserv/recover.cpp
@@ -86,7 +86,7 @@ class NSRecoverRequestListener : public NickServ::IdentifyRequestListener
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();
+ Anope::string buf = source.GetCommand().upper() + " command used by " + source.GetNick();
u->Kill(*source.service, buf);
source.Reply(_("Ghost with your nick has been killed."));
@@ -172,7 +172,7 @@ class CommandNSRecover : public Command
if (user && source.GetUser() == user)
{
- source.Reply(_("You can't %s yourself!"), source.command.lower().c_str());
+ source.Reply(_("You can't {0} yourself!"), source.GetCommand().lower());
return;
}
diff --git a/modules/nickserv/register.cpp b/modules/nickserv/register.cpp
index 1554c0033..6ddae499d 100644
--- a/modules/nickserv/register.cpp
+++ b/modules/nickserv/register.cpp
@@ -202,7 +202,7 @@ class CommandNSRegister : public Command
if (u && Anope::CurTime < u->lastnickreg + reg_delay)
{
- source.Reply(_("Please wait \002{0}\002 seconds before using the {1} command again."), (u->lastnickreg + reg_delay) - Anope::CurTime, source.command);
+ source.Reply(_("Please wait \002{0}\002 seconds before using the {1} command again."), (u->lastnickreg + reg_delay) - Anope::CurTime, source.GetCommand());
return;
}
diff --git a/modules/nickserv/set.cpp b/modules/nickserv/set.cpp
index df6696fbf..f38422d48 100644
--- a/modules/nickserv/set.cpp
+++ b/modules/nickserv/set.cpp
@@ -42,7 +42,7 @@ class CommandNSSet : public Command
"\n"
"Available options:"));
- Anope::string this_name = source.command;
+ Anope::string this_name = source.GetCommand();
bool hide_privileged_commands = Config->GetBlock("options")->Get<bool>("hideprivilegedcommands"),
hide_registered_commands = Config->GetBlock("options")->Get<bool>("hideregisteredcommands");
for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it)
@@ -62,7 +62,7 @@ class CommandNSSet : public Command
else if (hide_privileged_commands && !info.permission.empty() && !source.HasCommand(info.permission))
continue;
- source.command = c_name;
+ source.SetCommand(c_name);
c->OnServHelp(source);
}
}
@@ -97,7 +97,7 @@ class CommandNSSASet : public Command
"\n"
"Available options:"));
- Anope::string this_name = source.command;
+ Anope::string this_name = source.GetCommand();
for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it)
{
const Anope::string &c_name = it->first;
@@ -108,7 +108,7 @@ class CommandNSSASet : public Command
ServiceReference<Command> command(info.name);
if (command)
{
- source.command = c_name;
+ source.SetCommand(c_name);
command->OnServHelp(source);
}
}
@@ -881,7 +881,7 @@ class CommandNSSetMessage : public Command
if (!Config->GetBlock("options")->Get<bool>("useprivmsg"))
{
- source.Reply(_("You cannot %s on this network."), source.command);
+ source.Reply(_("You cannot {0} on this network."), source.GetCommand());
return;
}
@@ -919,7 +919,7 @@ class CommandNSSetMessage : public Command
bool OnHelp(CommandSource &source, const Anope::string &) override
{
- Anope::string cmd = source.command;
+ Anope::string cmd = source.GetCommand();
size_t i = cmd.find_last_of(' ');
if (i != Anope::string::npos)
cmd = cmd.substr(i + 1);
@@ -946,7 +946,7 @@ class CommandNSSASetMessage : public CommandNSSetMessage
bool OnHelp(CommandSource &source, const Anope::string &) override
{
- Anope::string cmd = source.command;
+ Anope::string cmd = source.GetCommand();
size_t i = cmd.find_last_of(' ');
if (i != Anope::string::npos)
cmd = cmd.substr(i + 1);
diff --git a/modules/nickserv/set_misc.cpp b/modules/nickserv/set_misc.cpp
index fe1859cc7..6e8fdc378 100644
--- a/modules/nickserv/set_misc.cpp
+++ b/modules/nickserv/set_misc.cpp
@@ -124,7 +124,7 @@ class CommandNSSetMisc : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- Anope::string scommand = GetAttribute(source.command);
+ Anope::string scommand = GetAttribute(source.GetCommand());
/* remove existing */
for (NSMiscData *data : nc->GetRefs<NSMiscData *>())
@@ -156,18 +156,18 @@ class CommandNSSetMisc : public Command
void OnServHelp(CommandSource &source) override
{
- if (descriptions.count(source.command))
+ if (descriptions.count(source.GetCommand()))
{
- this->SetDesc(descriptions[source.command]);
+ this->SetDesc(descriptions[source.GetCommand()]);
Command::OnServHelp(source);
}
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
{
- if (descriptions.count(source.command))
+ if (descriptions.count(source.GetCommand()))
{
- source.Reply(Language::Translate(source.nc, descriptions[source.command].c_str()));
+ source.Reply(Language::Translate(source.nc, descriptions[source.GetCommand()]));
return true;
}
return false;
diff --git a/modules/operserv/akill.cpp b/modules/operserv/akill.cpp
index 10a87db2b..0af4a36c5 100644
--- a/modules/operserv/akill.cpp
+++ b/modules/operserv/akill.cpp
@@ -399,7 +399,7 @@ class CommandOSAKill : public Command
" 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/main")->Get<time_t>("autokillexpiry", "30d"), source.GetAccount()));
+ source.GetCommand(), Anope::Duration(Config->GetModule("operserv/main")->Get<time_t>("autokillexpiry", "30d"), source.GetAccount()));
const Anope::string &regexengine = Config->GetBlock("options")->Get<Anope::string>("regexengine");
if (!regexengine.empty())
@@ -411,7 +411,7 @@ class CommandOSAKill : public Command
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);
+ source.GetCommand());
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."
@@ -422,10 +422,10 @@ class CommandOSAKill : public Command
"\n"
" {0} LIST 2-5,7-9\n"
" Lists auto kill entries numbered 2 through 5 and 7 through 9."),
- source.command);
+ source.GetCommand());
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);
+ source.GetCommand());
else
{
CommandInfo *help = source.service->FindCommand("generic/help");
@@ -443,7 +443,7 @@ class CommandOSAKill : public Command
"\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);
+ "msg"_kw = Config->StrictPrivmsg, "service"_kw = source.service->nick, "help"_kw = help->cname, "command"_kw = source.GetCommand());
}
return true;
}
diff --git a/modules/operserv/dns.cpp b/modules/operserv/dns.cpp
index 8efa94fa9..b485ae440 100644
--- a/modules/operserv/dns.cpp
+++ b/modules/operserv/dns.cpp
@@ -815,7 +815,7 @@ class CommandOSDNS : public Command
"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);
+ source.GetCommand());
return true;
}
};
diff --git a/modules/operserv/ignore.cpp b/modules/operserv/ignore.cpp
index afdd36837..a5c39135d 100644
--- a/modules/operserv/ignore.cpp
+++ b/modules/operserv/ignore.cpp
@@ -375,7 +375,7 @@ class CommandOSIgnore : public Command
" 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);
+ source.GetCommand());
const Anope::string &regexengine = Config->GetBlock("options")->Get<Anope::string>("regexengine");
if (!regexengine.empty())
diff --git a/modules/operserv/logsearch.cpp b/modules/operserv/logsearch.cpp
index 702abe0e0..e936a8f6d 100644
--- a/modules/operserv/logsearch.cpp
+++ b/modules/operserv/logsearch.cpp
@@ -142,7 +142,7 @@ class CommandOSLogSearch : public Command
"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);
+ source.GetCommand());
return true;
}
};
diff --git a/modules/operserv/session.cpp b/modules/operserv/session.cpp
index cb22f65b9..0b6f207a5 100644
--- a/modules/operserv/session.cpp
+++ b/modules/operserv/session.cpp
@@ -324,7 +324,7 @@ class CommandOSSession : public Command
"\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);
+ source.GetCommand());
return true;
}
};
@@ -611,7 +611,7 @@ class CommandOSException : public Command
" 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);
+ source.GetCommand());
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."
diff --git a/modules/operserv/shutdown.cpp b/modules/operserv/shutdown.cpp
index de987537f..4e0b0a162 100644
--- a/modules/operserv/shutdown.cpp
+++ b/modules/operserv/shutdown.cpp
@@ -30,7 +30,7 @@ class CommandOSRestart : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
logger.Command(LogType::ADMIN, source, _("{source} used {command}"));
- Anope::QuitReason = source.command + " command received from " + source.GetNick();
+ Anope::QuitReason = source.GetCommand() + " command received from " + source.GetNick();
Anope::Quitting = Anope::Restarting = true;
}
@@ -52,7 +52,7 @@ class CommandOSShutdown : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
logger.Command(LogType::ADMIN, source, _("{source} used {command}"));
- Anope::QuitReason = source.command + " command received from " + source.GetNick();
+ Anope::QuitReason = source.GetCommand() + " command received from " + source.GetNick();
Anope::Quitting = true;
}
diff --git a/modules/operserv/sxline.cpp b/modules/operserv/sxline.cpp
index 47133c16e..59b1c4223 100644
--- a/modules/operserv/sxline.cpp
+++ b/modules/operserv/sxline.cpp
@@ -30,7 +30,7 @@ class CommandOSSXLineBase : public Command
{
if (!this->xlm() || this->xlm()->GetXLines().empty())
{
- source.Reply(_("{0} list is empty."), source.command);
+ source.Reply(_("{0} list is empty."), source.GetCommand());
return;
}
@@ -62,11 +62,11 @@ class CommandOSSXLineBase : public Command
[&]()
{
if (!deleted)
- source.Reply(_("No matching entries on the {0} list."), source.command);
+ source.Reply(_("No matching entries on the {0} list."), source.GetCommand());
else if (deleted == 1)
- source.Reply(_("Deleted \0021\002 entry from the {0} list."), source.command);
+ source.Reply(_("Deleted \0021\002 entry from the {0} list."), source.GetCommand());
else
- source.Reply(_("Deleted \002{0}\002 entries from the {1} list."), deleted, source.command);
+ source.Reply(_("Deleted \002{0}\002 entries from the {1} list."), deleted, source.GetCommand());
});
}
else
@@ -75,13 +75,13 @@ class CommandOSSXLineBase : public Command
if (!x)
{
- source.Reply(_("\002{0}\002 not found on the {1] list."), mask, source.command);
+ source.Reply(_("\002{0}\002 not found on the {1] list."), mask, source.GetCommand());
return;
}
EventManager::Get()->Dispatch(&Event::DelXLine::OnDelXLine, source, x, this->xlm());
- source.Reply(_("\002{0}\002 deleted from the {1} list."), x->GetMask(), source.command);
+ source.Reply(_("\002{0}\002 deleted from the {1} list."), x->GetMask(), source.GetCommand());
logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove {0} from the list"), x->GetMask());
@@ -96,7 +96,7 @@ class CommandOSSXLineBase : public Command
{
if (!this->xlm() || this->xlm()->GetXLines().empty())
{
- source.Reply(_("{0} list is empty."), source.command);
+ source.Reply(_("{0} list is empty."), source.GetCommand());
return;
}
@@ -146,11 +146,11 @@ class CommandOSSXLineBase : public Command
if (list.IsEmpty())
{
- source.Reply(_("No matching entries on the {0} list."), source.command);
+ source.Reply(_("No matching entries on the {0} list."), source.GetCommand());
}
else
{
- source.Reply(_("{0} list:"), source.command);
+ source.Reply(_("{0} list:"), source.GetCommand());
std::vector<Anope::string> replies;
list.Process(replies);
@@ -188,7 +188,7 @@ class CommandOSSXLineBase : public Command
logger.Command(LogType::ADMIN, source, _("{source} used {command} to CLEAR the list"));
- source.Reply(_("The {0} list has been cleared."), source.command);
+ source.Reply(_("The {0} list has been cleared."), source.GetCommand());
if (Anope::ReadOnly)
source.Reply(_("Services are in read-only mode. Any changes made may not persist."));
}
@@ -199,7 +199,7 @@ class CommandOSSXLineBase : public Command
const Anope::string GetDesc(CommandSource &source) const override
{
- return Anope::printf(Language::Translate(source.GetAccount(), _("Manipulate the %s list")), source.command.upper().c_str());
+ return Anope::Format(Language::Translate(source.GetAccount(), _("Manipulate the {0} list")), source.GetCommand().upper());
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
@@ -347,7 +347,7 @@ class CommandOSSNLine : public CommandOSSXLineBase
source.Reply(_("\002{0}\002 coverage is too wide; please use a more specific mask."), mask);
logger.Command(LogType::ADMIN, source, _("{source} used {command} and tried to {0} {1}% of the network ({2} users)"),
- source.command, percent, affected);
+ source.GetCommand(), percent, affected);
x->Delete();
return;
@@ -378,7 +378,7 @@ class CommandOSSNLine : public CommandOSSXLineBase
this->xlm()->Send(NULL, x);
}
- source.Reply(_("\002{0}\002 added to the {1} list."), mask, source.command);
+ source.Reply(_("\002{0}\002 added to the {1} list."), mask, source.GetCommand());
logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0} ({1}), expires in {2} [affects {3} user(s) ({4}%)]"),
mask, reason, expires ? Anope::Duration(expires - Anope::CurTime) : "never",
@@ -410,7 +410,7 @@ class CommandOSSNLine : public CommandOSSXLineBase
" 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/main")->Get<time_t>("snlineexpiry", "30d"), source.GetAccount()));
+ source.GetCommand(), Anope::Duration(Config->GetModule("operserv/main")->Get<time_t>("snlineexpiry", "30d"), source.GetAccount()));
const Anope::string &regexengine = Config->GetBlock("options")->Get<Anope::string>("regexengine");
if (!regexengine.empty())
@@ -435,12 +435,12 @@ class CommandOSSNLine : public CommandOSSXLineBase
"\n"
" {0} LIST 2-5,7-9\n"
" Lists {0} entries numbered 2 through 5 and 7 through 9.\n"),
- source.command);
+ source.GetCommand());
}
else if (subcommand.equals_ci("CLEAR"))
{
source.Reply(_("\002{0} CLEAR\002 removes all entries from the {0} list."),
- source.command);
+ source.GetCommand());
}
else
{
@@ -460,7 +460,7 @@ class CommandOSSNLine : public CommandOSSXLineBase
"\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);
+ "msg"_kw = Config->StrictPrivmsg, "service"_kw = source.service->nick, "help"_kw = help->cname, "command"_kw = source.GetCommand());
}
return true;
}
@@ -571,7 +571,7 @@ class CommandOSSQLine : public CommandOSSXLineBase
{
source.Reply(_("\002{0}\002 coverage is too wide; please use a more specific mask."), mask);
- logger.Command(LogType::ADMIN, source, _("{source} used {command} and tried to {0} {1}% of the network ({2} users)"), source.command, percent, affected);
+ logger.Command(LogType::ADMIN, source, _("{source} used {command} and tried to {0} {1}% of the network ({2} users)"), source.GetCommand(), percent, affected);
x->Delete();
return;
@@ -628,7 +628,7 @@ class CommandOSSQLine : public CommandOSSXLineBase
this->xlm()->Send(NULL, x);
}
- source.Reply(_("\002{0}\002 added to the {1} list."), mask, source.command);
+ source.Reply(_("\002{0}\002 added to the {1} list."), mask, source.GetCommand());
logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0} ({1}), expires in {2} [affects {3} user(s) ({4}%)]"),
mask, x->GetReason(), expires ? Anope::Duration(expires - Anope::CurTime) : "never", affected, percent);
@@ -658,7 +658,7 @@ class CommandOSSQLine : public CommandOSSXLineBase
" 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/main")->Get<time_t>("sqlineexpiry", "30d"), source.GetAccount()));
+ source.GetCommand(), Anope::Duration(Config->GetModule("operserv/main")->Get<time_t>("sqlineexpiry", "30d"), source.GetAccount()));
const Anope::string &regexengine = Config->GetBlock("options")->Get<Anope::string>("regexengine");
if (!regexengine.empty())
@@ -683,12 +683,12 @@ class CommandOSSQLine : public CommandOSSXLineBase
"\n"
" {0} LIST 2-5,7-9\n"
" Lists {0} entries numbered 2 through 5 and 7 through 9.\n"),
- source.command);
+ source.GetCommand());
}
else if (subcommand.equals_ci("CLEAR"))
{
source.Reply(_("\002{0} CLEAR\002 removes all entries from the {0} list."),
- source.command);
+ source.GetCommand());
}
else
{
@@ -709,7 +709,7 @@ class CommandOSSQLine : public CommandOSSXLineBase
"\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);
+ "msg"_kw = Config->StrictPrivmsg, "service"_kw = source.service->nick, "help"_kw = help->cname, "command"_kw = source.GetCommand());
}
return true;
}
diff --git a/modules/rewrite.cpp b/modules/rewrite.cpp
index 0aa0897b0..4431bf279 100644
--- a/modules/rewrite.cpp
+++ b/modules/rewrite.cpp
@@ -120,13 +120,13 @@ class RewriteCommand : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
std::vector<Anope::string> full_params = params;
- full_params.insert(full_params.begin(), source.command);
+ full_params.insert(full_params.begin(), source.GetCommand());
Rewrite *r = Rewrite::Match(!source.c ? source.service->nick : "", full_params);
if (r != NULL)
{
Anope::string new_message = r->Process(source, full_params);
- logger.Debug("Rewrote '{0}' to '{1}' using '{2}'", source.command + (!params.empty() ? " " + params[0] : ""), new_message, r->source_message);
+ logger.Debug("Rewrote '{0}' to '{1}' using '{2}'", source.GetCommand() + (!params.empty() ? " " + params[0] : ""), new_message, r->source_message);
source.service = ServiceBot::Find(r->client, true);
if (!source.service)
return;
@@ -134,13 +134,13 @@ class RewriteCommand : public Command
}
else
{
- logger.Log("Unable to rewrite '{0}'", source.command + (!params.empty() ? " " + params[0] : ""));
+ logger.Log("Unable to rewrite '{0}'", source.GetCommand() + (!params.empty() ? " " + params[0] : ""));
}
}
void OnServHelp(CommandSource &source) override
{
- Rewrite *r = Rewrite::Find(!source.c ? source.service->nick : "", source.command);
+ Rewrite *r = Rewrite::Find(!source.c ? source.service->nick : "", source.GetCommand());
if (r != NULL && !r->desc.empty())
{
this->SetDesc(r->desc);
@@ -150,7 +150,7 @@ class RewriteCommand : public Command
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
{
- Rewrite *r = Rewrite::Find(!source.c ? source.service->nick : "", source.command);
+ Rewrite *r = Rewrite::Find(!source.c ? source.service->nick : "", source.GetCommand());
if (r != NULL && !r->desc.empty())
{
source.Reply(r->desc);
diff --git a/src/bots.cpp b/src/bots.cpp
index 86d0a0136..7aaefccc1 100644
--- a/src/bots.cpp
+++ b/src/bots.cpp
@@ -198,12 +198,11 @@ void ServiceBot::OnMessage(User *u, const Anope::string &message)
CommandInfo& ServiceBot::SetCommand(const Anope::string &cname, const Anope::string &sname, const Anope::string &permission)
{
- CommandInfo ci;
+ CommandInfo &ci = this->commands[cname];
ci.name = sname;
ci.cname = cname;
ci.permission = permission;
- this->commands[cname] = ci;
- return this->commands[cname];
+ return ci;
}
CommandInfo *ServiceBot::GetCommand(const Anope::string &cname)
diff --git a/src/command.cpp b/src/command.cpp
index 9095c0526..e7fc61457 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -70,9 +70,29 @@ Anope::string CommandSource::GetSource()
const Anope::string &CommandSource::GetCommand() const
{
+ return this->command.cname;
+}
+
+void CommandSource::SetCommand(const Anope::string &command)
+{
+ this->command.cname = command;
+}
+
+const Anope::string &CommandSource::GetPermission() const
+{
+ return this->command.permission;
+}
+
+const CommandInfo &CommandSource::GetCommandInfo() const
+{
return this->command;
}
+void CommandSource::SetCommandInfo(const CommandInfo &ci)
+{
+ this->command = ci;
+}
+
ChanServ::AccessGroup CommandSource::AccessFor(ChanServ::Channel *ci)
{
if (this->u)
@@ -174,13 +194,13 @@ void Command::SendSyntax(CommandSource &source)
Anope::string s = Language::Translate(source.GetAccount(), _("Syntax"));
if (!this->syntax.empty())
{
- source.Reply("{0}: \002{1} {2}\002", s, source.command, Language::Translate(source.GetAccount(), this->syntax[0].c_str()));
+ source.Reply("{0}: \002{1} {2}\002", s, source.GetCommand(), 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("{0} \002{1} {2}\002", spaces, source.command, Language::Translate(source.GetAccount(), this->syntax[i].c_str()));
+ source.Reply("{0} \002{1} {2}\002", spaces, source.GetCommand(), Language::Translate(source.GetAccount(), this->syntax[i].c_str()));
}
else
- source.Reply("{0}: \002{1}\002", s, source.command);
+ source.Reply("{0}: \002{1}\002", s, source.GetCommand());
}
bool Command::AllowUnregistered() const
@@ -210,7 +230,7 @@ const Anope::string Command::GetDesc(CommandSource &) const
void Command::OnServHelp(CommandSource &source)
{
- source.Reply(Anope::printf(" %-14s %s", source.command.c_str(), Language::Translate(source.nc, this->GetDesc(source).c_str())));
+ source.Reply(Anope::printf(" %-14s %s", source.GetCommand().c_str(), Language::Translate(source.nc, this->GetDesc(source).c_str())));
}
bool Command::OnHelp(CommandSource &source, const Anope::string &subcommand) { return false; }
@@ -220,7 +240,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(_("\002{0}{1} HELP {2}\002 for more information."), Config->StrictPrivmsg, source.service->nick, source.command);
+ source.Reply(_("\002{0}{1} HELP {2}\002 for more information."), Config->StrictPrivmsg, source.service->nick, source.GetCommand());
}
void Command::Run(CommandSource &source, const Anope::string &message)
@@ -289,8 +309,7 @@ void Command::Run(CommandSource &source, const Anope::string &cmdname, const Com
return;
}
- source.command = cmdname;
- source.permission = info.permission;
+ source.SetCommandInfo(info);
EventReturn MOD_RESULT = EventManager::Get()->Dispatch(&Event::PreCommand::OnPreCommand, source, this, params);
if (MOD_RESULT == EVENT_STOP)
diff --git a/src/config.cpp b/src/config.cpp
index fbac466d9..d47b249f0 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -814,7 +814,7 @@ Block *Conf::GetCommand(CommandSource &source)
{
Block *b = &iters.first->second;
- if (b->Get<Anope::string>("name") == source.command)
+ if (b->Get<Anope::string>("name") == source.GetCommand())
return b;
}