From 063d9bf5f689fd9dc24394c267dfdce7b6a345e6 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 3 Aug 2014 18:33:56 -0400 Subject: Allow "modify" in flags to be optional --- modules/commands/cs_flags.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'modules/commands/cs_flags.cpp') diff --git a/modules/commands/cs_flags.cpp b/modules/commands/cs_flags.cpp index e3613377f..5f9e070fc 100644 --- a/modules/commands/cs_flags.cpp +++ b/modules/commands/cs_flags.cpp @@ -78,11 +78,8 @@ FlagsAccessProvider* FlagsAccessProvider::ap; class CommandCSFlags : public Command { - void DoModify(CommandSource &source, ChannelInfo *ci, const std::vector ¶ms) + void DoModify(CommandSource &source, ChannelInfo *ci, Anope::string mask, const Anope::string &flags) { - Anope::string mask = params.size() > 2 ? params[2] : ""; - Anope::string flags = params.size() > 3 ? params[3] : ""; - if (flags.empty()) { this->OnSyntaxError(source, ""); @@ -370,7 +367,7 @@ class CommandCSFlags : public Command CommandCSFlags(Module *creator) : Command(creator, "chanserv/flags", 1, 4) { this->SetDesc(_("Modify the list of privileged users")); - this->SetSyntax(_("\037channel\037 MODIFY \037mask\037 \037changes\037")); + this->SetSyntax(_("\037channel\037 [MODIFY] \037mask\037 \037changes\037")); this->SetSyntax(_("\037channel\037 LIST [\037mask\037 | +\037flags\037]")); this->SetSyntax(_("\037channel\037 CLEAR")); } @@ -400,14 +397,26 @@ class CommandCSFlags : public Command source.Reply(ACCESS_DENIED); else if (Anope::ReadOnly && !is_list) source.Reply(_("Sorry, channel access list modification is temporarily disabled.")); - else if (cmd.equals_ci("MODIFY")) - this->DoModify(source, ci, params); else if (is_list) this->DoList(source, ci, params); else if (cmd.equals_ci("CLEAR")) this->DoClear(source, ci); else - this->OnSyntaxError(source, cmd); + { + Anope::string mask, flags; + if (cmd.equals_ci("MODIFY")) + { + mask = params.size() > 2 ? params[2] : ""; + flags = params.size() > 3 ? params[3] : ""; + } + else + { + mask = cmd; + flags = params.size() > 2 ? params[2] : ""; + } + + this->DoModify(source, ci, mask, flags); + } } bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override -- cgit