diff options
author | Adam <Adam@anope.org> | 2017-11-19 16:11:35 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2017-11-19 16:11:35 -0500 |
commit | 2fda0fff4655e92e388d7823e5b1c1f0c6bcfe2d (patch) | |
tree | b2cde60f3c2c98782690d67d134263924f59cc78 /modules | |
parent | 3fb9bb5118a5c3c6c916a48feed0e069867f3133 (diff) |
Add subcommand syntax help, and reference subcommand help in syntax error messages
Diffstat (limited to 'modules')
51 files changed, 261 insertions, 99 deletions
diff --git a/modules/botserv/assign.cpp b/modules/botserv/assign.cpp index 469f1f051..302977749 100644 --- a/modules/botserv/assign.cpp +++ b/modules/botserv/assign.cpp @@ -206,7 +206,7 @@ class CommandBSSetNoBot : public Command } else { - this->OnSyntaxError(source, source.GetCommand()); + this->OnSyntaxError(source); } } diff --git a/modules/botserv/badwords.cpp b/modules/botserv/badwords.cpp index d504763be..c270d91d2 100644 --- a/modules/botserv/badwords.cpp +++ b/modules/botserv/badwords.cpp @@ -336,7 +336,7 @@ class CommandBSBadwords : public Command if (!need_args && word.empty()) { - this->OnSyntaxError(source, cmd); + this->OnSyntaxError(source); return; } @@ -368,7 +368,7 @@ class CommandBSBadwords : public Command else if (cmd.equals_ci("CLEAR")) this->DoClear(source, ci); else - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/botserv/bot.cpp b/modules/botserv/bot.cpp index 21a5f6ce9..65a891839 100644 --- a/modules/botserv/bot.cpp +++ b/modules/botserv/bot.cpp @@ -380,7 +380,7 @@ class CommandBSBot : public Command } else { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } } diff --git a/modules/botserv/control.cpp b/modules/botserv/control.cpp index 758f795f2..48d5cd9f6 100644 --- a/modules/botserv/control.cpp +++ b/modules/botserv/control.cpp @@ -68,7 +68,7 @@ class CommandBSSay : public Command if (text[0] == '\001') { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); return; } diff --git a/modules/botserv/kick.cpp b/modules/botserv/kick.cpp index 7c7eb3829..080303e68 100644 --- a/modules/botserv/kick.cpp +++ b/modules/botserv/kick.cpp @@ -523,7 +523,7 @@ class CommandBSKick : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override @@ -583,9 +583,9 @@ class CommandBSKickBase : public Command else if (ci == NULL) source.Reply(_("Channel \002{0}\002 isn't registered."), chan); else if (option.empty()) - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); else if (!option.equals_ci("ON") && !option.equals_ci("OFF")) - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); else if (!source.AccessFor(ci).HasPriv("SET") && !source.HasOverridePriv("botserv/administration")) source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName()); else if (!ci->GetBot()) @@ -648,7 +648,7 @@ class CommandBSKickBase : public Command source.Reply(_("Bot won't kick for \002{0}\002 anymore."), optname); } else - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } }; @@ -896,7 +896,7 @@ class CommandBSKickFlood : public CommandBSKickBase } else { - this->OnSyntaxError(source, params[1]); + this->OnSyntaxError(source); } } @@ -998,7 +998,7 @@ class CommandBSKickRepeat : public CommandBSKickBase } else { - this->OnSyntaxError(source, params[1]); + this->OnSyntaxError(source); } } @@ -1110,7 +1110,7 @@ class CommandBSSetDontKickOps : public Command } else { - this->OnSyntaxError(source, source.GetCommand()); + this->OnSyntaxError(source); } } @@ -1174,7 +1174,7 @@ class CommandBSSetDontKickVoices : public Command } else { - this->OnSyntaxError(source, source.GetCommand()); + this->OnSyntaxError(source); } } diff --git a/modules/botserv/set.cpp b/modules/botserv/set.cpp index 638aac012..d137882a6 100644 --- a/modules/botserv/set.cpp +++ b/modules/botserv/set.cpp @@ -31,7 +31,7 @@ class CommandBSSet : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override @@ -191,7 +191,7 @@ class CommandBSSetPrivate : public Command } else { - this->OnSyntaxError(source, source.GetCommand()); + this->OnSyntaxError(source); } } diff --git a/modules/chanserv/access.cpp b/modules/chanserv/access.cpp index 886f02778..fd6aad1c5 100644 --- a/modules/chanserv/access.cpp +++ b/modules/chanserv/access.cpp @@ -625,6 +625,22 @@ class CommandCSAccess : public Command return true; } + + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) override + { + if (subcommand.equals_ci("ADD")) + { + SubcommandSyntaxError(source, subcommand, _("\037mask\037 \037level\037")); + } + else if (subcommand.equals_ci("DEL")) + { + SubcommandSyntaxError(source, subcommand, _("{\037mask\037 | \037entry-num\037 | \037list\037}")); + } + else + { + Command::OnSyntaxError(source, subcommand); + } + } }; class CommandCSLevels : public Command @@ -873,6 +889,22 @@ class CommandCSLevels : public Command } return true; } + + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) override + { + if (subcommand.equals_ci("SET")) + { + SubcommandSyntaxError(source, subcommand, "\037privilege\037 \037level\037"); + } + else if (subcommand.equals_ci("DISABLE")) + { + SubcommandSyntaxError(source, subcommand, "\037privilege\037"); + } + else + { + Command::OnSyntaxError(source, subcommand); + } + } }; class CSAccess : public Module diff --git a/modules/chanserv/akick.cpp b/modules/chanserv/akick.cpp index bbdd614e5..b099c48ac 100644 --- a/modules/chanserv/akick.cpp +++ b/modules/chanserv/akick.cpp @@ -599,7 +599,7 @@ class CommandCSAKick : public Command else if (cmd.equals_ci("CLEAR")) this->DoClear(source, ci); else - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override @@ -678,6 +678,22 @@ class CommandCSAKick : public Command return true; } + + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand = "") override + { + if (subcommand.equals_ci("ADD")) + { + SubcommandSyntaxError(source, subcommand, _("{\037nick\037 | \037mask\037} [\037reason\037]")); + } + else if (subcommand.equals_ci("DEL")) + { + SubcommandSyntaxError(source, subcommand, _("{\037nick\037 | \037mask\037 | \037entry-num\037 | \037list\037}")); + } + else + { + Command::OnSyntaxError(source, subcommand); + } + } }; class CSAKick : public Module diff --git a/modules/chanserv/clone.cpp b/modules/chanserv/clone.cpp index 341d80944..a5af50743 100644 --- a/modules/chanserv/clone.cpp +++ b/modules/chanserv/clone.cpp @@ -198,7 +198,7 @@ public: } else { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); return; } diff --git a/modules/chanserv/enforce.cpp b/modules/chanserv/enforce.cpp index c9ca14acf..d31cb8ce7 100644 --- a/modules/chanserv/enforce.cpp +++ b/modules/chanserv/enforce.cpp @@ -271,7 +271,7 @@ class CommandCSEnforce : public Command else if (what.equals_ci("LIMIT")) this->DoLimit(source, ci); else - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/chanserv/entrymsg.cpp b/modules/chanserv/entrymsg.cpp index efcea8e9d..f7beca19f 100644 --- a/modules/chanserv/entrymsg.cpp +++ b/modules/chanserv/entrymsg.cpp @@ -241,13 +241,13 @@ class CommandEntryMessage : public Command else if (params[1].equals_ci("CLEAR")) this->DoClear(source, ci); else if (params.size() < 3) - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); else if (params[1].equals_ci("ADD")) this->DoAdd(source, ci, params[2]); else if (params[1].equals_ci("DEL")) this->DoDel(source, ci, params[2]); else - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/chanserv/flags.cpp b/modules/chanserv/flags.cpp index ecd8ba9d3..c1ebe412f 100644 --- a/modules/chanserv/flags.cpp +++ b/modules/chanserv/flags.cpp @@ -101,7 +101,7 @@ class CommandCSFlags : public Command { if (flags.empty()) { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); return; } diff --git a/modules/chanserv/list.cpp b/modules/chanserv/list.cpp index 1f89b0274..972099610 100644 --- a/modules/chanserv/list.cpp +++ b/modules/chanserv/list.cpp @@ -229,7 +229,7 @@ class CommandCSSetPrivate : public Command } else { - this->OnSyntaxError(source, "PRIVATE"); + this->OnSyntaxError(source); } } diff --git a/modules/chanserv/mode.cpp b/modules/chanserv/mode.cpp index b1639baa0..e72273397 100644 --- a/modules/chanserv/mode.cpp +++ b/modules/chanserv/mode.cpp @@ -486,7 +486,7 @@ class CommandCSMode : public Command } else { - this->OnSyntaxError(source, subcommand); + this->OnSyntaxError(source); } } @@ -755,7 +755,7 @@ class CommandCSMode : public Command } else { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } } diff --git a/modules/chanserv/seen.cpp b/modules/chanserv/seen.cpp index db52f269e..87c8c9907 100644 --- a/modules/chanserv/seen.cpp +++ b/modules/chanserv/seen.cpp @@ -153,7 +153,7 @@ class CommandOSSeen : public Command time_t time = 0; if ((params.size() < 2) || (0 >= (time = Anope::DoTime(params[1])))) { - this->OnSyntaxError(source, params[0]); + this->OnSyntaxError(source, "CLEAR"); return; } time = Anope::CurTime - time; diff --git a/modules/chanserv/set.cpp b/modules/chanserv/set.cpp index dbe17f0ab..c6df83cbe 100644 --- a/modules/chanserv/set.cpp +++ b/modules/chanserv/set.cpp @@ -33,7 +33,7 @@ class CommandCSSet : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override @@ -128,7 +128,7 @@ class CommandCSSetAutoOp : public Command } else { - this->OnSyntaxError(source, "AUTOOP"); + this->OnSyntaxError(source); } } @@ -401,7 +401,7 @@ class CommandCSSetKeepModes : public Command } else { - this->OnSyntaxError(source, "KEEPMODES"); + this->OnSyntaxError(source); } } @@ -466,7 +466,7 @@ class CommandCSSetPeace : public Command } else { - this->OnSyntaxError(source, "PEACE"); + this->OnSyntaxError(source); } } @@ -605,7 +605,7 @@ class CommandCSSetPersist : public Command } else { - this->OnSyntaxError(source, "PERSIST"); + this->OnSyntaxError(source); } } @@ -671,7 +671,7 @@ class CommandCSSetRestricted : public Command } else { - this->OnSyntaxError(source, "RESTRICTED"); + this->OnSyntaxError(source); } } @@ -736,7 +736,7 @@ class CommandCSSetSecureFounder : public Command } else { - this->OnSyntaxError(source, "SECUREFOUNDER"); + this->OnSyntaxError(source); } } @@ -806,7 +806,7 @@ class CommandCSSetSecureOps : public Command } else { - this->OnSyntaxError(source, "SECUREOPS"); + this->OnSyntaxError(source); } } @@ -882,7 +882,7 @@ class CommandCSSetSignKick : public Command } else { - this->OnSyntaxError(source, "SIGNKICK"); + this->OnSyntaxError(source); } } @@ -1024,7 +1024,7 @@ class CommandCSSetNoexpire : public Command } else { - this->OnSyntaxError(source, "NOEXPIRE"); + this->OnSyntaxError(source); } } diff --git a/modules/chanserv/topic.cpp b/modules/chanserv/topic.cpp index 85bcf1426..d103307ce 100644 --- a/modules/chanserv/topic.cpp +++ b/modules/chanserv/topic.cpp @@ -76,7 +76,7 @@ class CommandCSSetKeepTopic : public Command } else { - this->OnSyntaxError(source, "KEEPTOPIC"); + this->OnSyntaxError(source); } } diff --git a/modules/chanserv/xop.cpp b/modules/chanserv/xop.cpp index 26de3ec41..ad6990a9a 100644 --- a/modules/chanserv/xop.cpp +++ b/modules/chanserv/xop.cpp @@ -479,7 +479,7 @@ class CommandCSXOP : public Command else if (cmd.equals_ci("CLEAR")) return this->DoClear(source, ci); else - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } @@ -574,6 +574,22 @@ class CommandCSXOP : public Command } return true; } + + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand = "") override + { + if (subcommand.equals_ci("ADD")) + { + SubcommandSyntaxError(source, subcommand, _("\037channel\037 ADD \037mask\037")); + } + else if (subcommand.equals_ci("DEL")) + { + SubcommandSyntaxError(source, subcommand, _("{\037mask\037 | \037entry-num\037 | \037list\037}")); + } + else + { + Command::OnSyntaxError(source, subcommand); + } + } }; class CSXOP : public Module diff --git a/modules/extra/stats/chanstats.cpp b/modules/extra/stats/chanstats.cpp index adc002c8c..3e40f7c31 100644 --- a/modules/extra/stats/chanstats.cpp +++ b/modules/extra/stats/chanstats.cpp @@ -43,7 +43,7 @@ class CommandCSSetChanstats : public Command source.Reply(_("Chanstats statistics are now disabled for this channel.")); } else - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } bool OnHelp(CommandSource &source, const Anope::string &) override @@ -96,7 +96,7 @@ class CommandNSSetChanstats : public Command source.Reply(_("Chanstats statistics are now disabled for your nick.")); } else - this->OnSyntaxError(source, "CHANSTATS"); + this->OnSyntaxError(source); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override diff --git a/modules/fantasy.cpp b/modules/fantasy.cpp index e3556716c..ce2ad5a1d 100644 --- a/modules/fantasy.cpp +++ b/modules/fantasy.cpp @@ -69,7 +69,7 @@ class CommandBSSetFantasy : public Command } else { - this->OnSyntaxError(source, source.GetCommand()); + this->OnSyntaxError(source); } } diff --git a/modules/greet.cpp b/modules/greet.cpp index e4026825b..26ad7e899 100644 --- a/modules/greet.cpp +++ b/modules/greet.cpp @@ -71,7 +71,7 @@ class CommandBSSetGreet : public Command } else { - this->OnSyntaxError(source, source.GetCommand()); + this->OnSyntaxError(source); } } diff --git a/modules/hostserv/add.cpp b/modules/hostserv/add.cpp index 9ad20c44b..bdb29557e 100644 --- a/modules/hostserv/add.cpp +++ b/modules/hostserv/add.cpp @@ -63,7 +63,7 @@ class CommandHSAdd : public Command if (host.empty()) { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); return; } diff --git a/modules/hostserv/ban.cpp b/modules/hostserv/ban.cpp index d85da4ca1..2b6450a85 100644 --- a/modules/hostserv/ban.cpp +++ b/modules/hostserv/ban.cpp @@ -144,7 +144,7 @@ class CommandHSBan : public Command if (reason.empty()) { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); return; } diff --git a/modules/hostserv/request.cpp b/modules/hostserv/request.cpp index d5a3de0ae..7f87e2e21 100644 --- a/modules/hostserv/request.cpp +++ b/modules/hostserv/request.cpp @@ -169,7 +169,7 @@ class CommandHSRequest : public Command if (host.empty()) { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); return; } diff --git a/modules/hostserv/set.cpp b/modules/hostserv/set.cpp index 4b506165e..15f05784e 100644 --- a/modules/hostserv/set.cpp +++ b/modules/hostserv/set.cpp @@ -30,7 +30,7 @@ class CommandHSSet : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/memoserv/ignore.cpp b/modules/memoserv/ignore.cpp index 3a334975d..34e862716 100644 --- a/modules/memoserv/ignore.cpp +++ b/modules/memoserv/ignore.cpp @@ -131,7 +131,7 @@ class CommandMSIgnore : public Command } else { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } } diff --git a/modules/memoserv/list.cpp b/modules/memoserv/list.cpp index 4de956d75..14027fa7b 100644 --- a/modules/memoserv/list.cpp +++ b/modules/memoserv/list.cpp @@ -62,7 +62,7 @@ class CommandMSList : public Command if (!param.empty() && !isdigit(param[0]) && !param.equals_ci("NEW")) { - this->OnSyntaxError(source, param); + this->OnSyntaxError(source); return; } diff --git a/modules/memoserv/read.cpp b/modules/memoserv/read.cpp index 60fc98b0c..4a2168675 100644 --- a/modules/memoserv/read.cpp +++ b/modules/memoserv/read.cpp @@ -124,7 +124,7 @@ class CommandMSRead : public Command if (numstr.empty() || (!numstr.equals_ci("LAST") && !numstr.equals_ci("NEW") && !numstr.equals_ci("ALL") && numstr.find_first_not_of("0123456789.,-") != Anope::string::npos)) { - this->OnSyntaxError(source, numstr); + this->OnSyntaxError(source); return; } diff --git a/modules/memoserv/set.cpp b/modules/memoserv/set.cpp index 08a807748..984cc2ef4 100644 --- a/modules/memoserv/set.cpp +++ b/modules/memoserv/set.cpp @@ -75,7 +75,7 @@ class CommandMSSet : public Command } else { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source, "NOTIFY"); } } @@ -132,7 +132,7 @@ class CommandMSSet : public Command } else if (p1.empty() || (!p1.is_pos_number_only() && !p1.equals_ci("NONE")) || (!p2.empty() && !p2.equals_ci("HARD"))) { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source, "LIMIT"); return; } if (!chan.empty()) @@ -160,7 +160,7 @@ class CommandMSSet : public Command { if (p1.empty() || !p2.empty() || !isdigit(p1[0])) { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source, "LIMIT"); return; } if (!chan.empty() && mi->IsHardMax()) @@ -228,6 +228,7 @@ class CommandMSSet : public Command const Anope::string &cmd = params[0]; MemoServ::MemoInfo *mi = source.nc->GetMemos(); +#warning "split this into subcommands" if (Anope::ReadOnly) source.Reply(_("Sorry, memo option setting is temporarily disabled.")); else if (cmd.equals_ci("NOTIFY")) @@ -235,7 +236,7 @@ class CommandMSSet : public Command else if (cmd.equals_ci("LIMIT")) return this->DoLimit(source, params, mi); else - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/nickserv/ajoin.cpp b/modules/nickserv/ajoin.cpp index 79ca271c3..124b5f6f9 100644 --- a/modules/nickserv/ajoin.cpp +++ b/modules/nickserv/ajoin.cpp @@ -267,7 +267,7 @@ class CommandNSAJoin : public Command else if (nc->HasFieldS("NS_SUSPENDED")) source.Reply(_("\002{0}\002 isn't registered."), nc->GetDisplay()); else if (param.empty()) - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); else if (Anope::ReadOnly) source.Reply(_("Services are in read-only mode.")); else if (cmd.equals_ci("ADD")) @@ -275,7 +275,7 @@ class CommandNSAJoin : public Command else if (cmd.equals_ci("DEL")) return this->DoDel(source, nc, param); else - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/nickserv/cert.cpp b/modules/nickserv/cert.cpp index bcc1c863f..cb089e26e 100644 --- a/modules/nickserv/cert.cpp +++ b/modules/nickserv/cert.cpp @@ -205,7 +205,7 @@ class CommandNSCert : public Command if (certfp.empty()) { - this->OnSyntaxError(source, "DEL"); + this->OnSyntaxError(source); return; } @@ -293,7 +293,7 @@ class CommandNSCert : public Command else if (cmd.equals_ci("DEL")) return this->DoDel(source, nc, certfp); else - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/nickserv/info.cpp b/modules/nickserv/info.cpp index 8969805cf..ea9337950 100644 --- a/modules/nickserv/info.cpp +++ b/modules/nickserv/info.cpp @@ -188,7 +188,7 @@ class CommandNSSetHide : public Command } else { - this->OnSyntaxError(source, "HIDE"); + this->OnSyntaxError(source); return; } @@ -211,7 +211,7 @@ class CommandNSSetHide : public Command source.Reply(offmsg, nc->GetDisplay(), source.service->nick); } else - this->OnSyntaxError(source, "HIDE"); + this->OnSyntaxError(source); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override diff --git a/modules/nickserv/list.cpp b/modules/nickserv/list.cpp index 51f6a2941..69bef0c11 100644 --- a/modules/nickserv/list.cpp +++ b/modules/nickserv/list.cpp @@ -228,7 +228,7 @@ class CommandNSSetPrivate : public Command source.Reply(_("Private option is now \002off\002 for \002{0}\002."), nc->GetDisplay()); } else - this->OnSyntaxError(source, "PRIVATE"); + this->OnSyntaxError(source); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override diff --git a/modules/nickserv/logout.cpp b/modules/nickserv/logout.cpp index be9c1ea34..96e197e0c 100644 --- a/modules/nickserv/logout.cpp +++ b/modules/nickserv/logout.cpp @@ -37,7 +37,7 @@ class CommandNSLogout : public Command if (!source.IsServicesOper() && !nick.empty()) { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); return; } diff --git a/modules/nickserv/register.cpp b/modules/nickserv/register.cpp index ff24c08d1..230290125 100644 --- a/modules/nickserv/register.cpp +++ b/modules/nickserv/register.cpp @@ -194,7 +194,7 @@ class CommandNSRegister : public Command if (Config->GetModule("nickserv/main")->Get<bool>("forceemail", "yes") && email.empty()) { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); return; } diff --git a/modules/nickserv/set.cpp b/modules/nickserv/set.cpp index 31c41c7ad..086f0b489 100644 --- a/modules/nickserv/set.cpp +++ b/modules/nickserv/set.cpp @@ -33,7 +33,7 @@ class CommandNSSet : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override @@ -87,7 +87,7 @@ class CommandNSSASet : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); return; } @@ -275,7 +275,7 @@ class CommandNSSetAutoOp : public Command } else { - this->OnSyntaxError(source, "AUTOOP"); + this->OnSyntaxError(source); } } @@ -580,7 +580,7 @@ class CommandNSSetKeepModes : public Command } else { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } } @@ -703,7 +703,7 @@ class CommandNSSetKill : public Command } else { - this->OnSyntaxError(source, "KILL"); + this->OnSyntaxError(source); } } @@ -787,7 +787,7 @@ class CommandNSSetLanguage : public Command break; else if (j + 1 == Language::Languages.size()) { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); return; } } @@ -908,7 +908,7 @@ class CommandNSSetMessage : public Command } else { - this->OnSyntaxError(source, "MSG"); + this->OnSyntaxError(source); } } @@ -1006,7 +1006,7 @@ class CommandNSSASetNoexpire : public Command } else { - this->OnSyntaxError(source, "NOEXPIRE"); + this->OnSyntaxError(source); } } diff --git a/modules/operserv/akill.cpp b/modules/operserv/akill.cpp index 8a752312a..8988fa743 100644 --- a/modules/operserv/akill.cpp +++ b/modules/operserv/akill.cpp @@ -386,7 +386,7 @@ class CommandOSAKill : public Command else if (cmd.equals_ci("CLEAR")) return this->DoClear(source); else - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override @@ -448,6 +448,22 @@ class CommandOSAKill : public Command } return true; } + + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand = "") override + { + if (subcommand.equals_ci("ADD")) + { + SubcommandSyntaxError(source, subcommand, _("[+\037expiry\037] \037mask\037 \037reason\037")); + } + else if (subcommand.equals_ci("DEL")) + { + SubcommandSyntaxError(source, subcommand, _("{\037mask\037 | \037entry-num\037 | \037list\037 | \037id\037}")); + } + else + { + Command::OnSyntaxError(source, subcommand); + } + } }; class OSAKill : public Module diff --git a/modules/operserv/chankill.cpp b/modules/operserv/chankill.cpp index 56e684acb..74aa04839 100644 --- a/modules/operserv/chankill.cpp +++ b/modules/operserv/chankill.cpp @@ -65,7 +65,7 @@ class CommandOSChanKill : public Command if (params.size() <= last_param) { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); return; } diff --git a/modules/operserv/config.cpp b/modules/operserv/config.cpp index 6a45ad5ca..5401452e1 100644 --- a/modules/operserv/config.cpp +++ b/modules/operserv/config.cpp @@ -127,7 +127,7 @@ class CommandOSConfig : public Command } else { - this->OnSyntaxError(source, what); + this->OnSyntaxError(source); } } diff --git a/modules/operserv/defcon.cpp b/modules/operserv/defcon.cpp index c7119d0ea..ac8470b00 100644 --- a/modules/operserv/defcon.cpp +++ b/modules/operserv/defcon.cpp @@ -209,7 +209,7 @@ class CommandOSDefcon : public Command if (newLevel < 1 || newLevel > 5) { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); return; } diff --git a/modules/operserv/dns.cpp b/modules/operserv/dns.cpp index 7ca4b0efa..dfa594520 100644 --- a/modules/operserv/dns.cpp +++ b/modules/operserv/dns.cpp @@ -798,7 +798,7 @@ class CommandOSDNS : public Command else if (params[0].equals_ci("DEPOOL") && params.size() > 1) this->OnDepool(source, params); else - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/operserv/forbid.cpp b/modules/operserv/forbid.cpp index 631f2d785..f071a3703 100644 --- a/modules/operserv/forbid.cpp +++ b/modules/operserv/forbid.cpp @@ -449,7 +449,7 @@ class CommandOSForbid : public Command source.Reply(_("End of forbid list - \002{0}\002/\002{1}\002 entries shown."), shown, forbids.size()); } else - this->OnSyntaxError(source, command); + this->OnSyntaxError(source); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override diff --git a/modules/operserv/ignore.cpp b/modules/operserv/ignore.cpp index dbfeb0a66..a19722295 100644 --- a/modules/operserv/ignore.cpp +++ b/modules/operserv/ignore.cpp @@ -386,6 +386,22 @@ class CommandOSIgnore : public Command return true; } + + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand) override + { + if (subcommand.equals_ci("ADD")) + { + SubcommandSyntaxError(source, subcommand, _("\037expiry\037 {\037nick\037|\037mask\037} [\037reason\037]")); + } + else if (subcommand.equals_ci("DEL")) + { + SubcommandSyntaxError(source, subcommand, _("{\037nick\037|\037mask\037}")); + } + else + { + Command::OnSyntaxError(source, subcommand); + } + } }; class OSIgnore : public Module diff --git a/modules/operserv/info.cpp b/modules/operserv/info.cpp index f4785ed88..d5131564c 100644 --- a/modules/operserv/info.cpp +++ b/modules/operserv/info.cpp @@ -167,7 +167,7 @@ class CommandOSInfo : public Command { if (info.empty()) { - this->OnSyntaxError(source, cmd); + this->OnSyntaxError(source, "ADD"); return; } @@ -203,7 +203,7 @@ class CommandOSInfo : public Command { if (info.empty()) { - this->OnSyntaxError(source, cmd); + this->OnSyntaxError(source, "DEL"); return; } @@ -254,7 +254,7 @@ class CommandOSInfo : public Command } else { - this->OnSyntaxError(source, cmd); + this->OnSyntaxError(source); } } @@ -263,6 +263,22 @@ class CommandOSInfo : public Command source.Reply(_("Add or delete oper information for a given account or channel. This information will show to opers in the respective info command for the account or channel.")); return true; } + + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand = "") override + { + if (subcommand.equals_ci("ADD")) + { + SubcommandSyntaxError(source, subcommand, _("\037target\037 \037info\037")); + } + else if (subcommand.equals_ci("DEL")) + { + SubcommandSyntaxError(source, subcommand, _("\037target\037 \037info\037")); + } + else + { + Command::OnSyntaxError(source, subcommand); + } + } }; class OSInfo : public Module diff --git a/modules/operserv/logsearch.cpp b/modules/operserv/logsearch.cpp index 608e6da59..b4c3169b2 100644 --- a/modules/operserv/logsearch.cpp +++ b/modules/operserv/logsearch.cpp @@ -89,7 +89,7 @@ class CommandOSLogSearch : public Command if (i >= params.size()) { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); return; } diff --git a/modules/operserv/news.cpp b/modules/operserv/news.cpp index ae81f09ef..1a8ba7f10 100644 --- a/modules/operserv/news.cpp +++ b/modules/operserv/news.cpp @@ -290,7 +290,7 @@ class NewsBase : public Command else if (cmd.equals_ci("DEL")) return this->DoDel(source, params, ntype, msgs); else - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } public: NewsBase(Module *creator, const Anope::string &newstype) : Command(creator, newstype, 1, 2) @@ -303,6 +303,22 @@ class NewsBase : public Command virtual void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_abstract; virtual bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_abstract; + + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand = "") override + { + if (subcommand.equals_ci("ADD")) + { + SubcommandSyntaxError(source, subcommand, _("\037text\037")); + } + else if (subcommand.equals_ci("DEL")) + { + SubcommandSyntaxError(source, subcommand, _("{\037num\037 | ALL}")); + } + else + { + Command::OnSyntaxError(source, subcommand); + } + } }; class CommandOSLogonNews : public NewsBase diff --git a/modules/operserv/noop.cpp b/modules/operserv/noop.cpp index 1168964c2..83e4184a6 100644 --- a/modules/operserv/noop.cpp +++ b/modules/operserv/noop.cpp @@ -78,7 +78,7 @@ class CommandOSNOOP : public Command } else { - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } } diff --git a/modules/operserv/oper.cpp b/modules/operserv/oper.cpp index 106af76e1..fea4533ea 100644 --- a/modules/operserv/oper.cpp +++ b/modules/operserv/oper.cpp @@ -235,7 +235,7 @@ class CommandOSOper : public Command } else { - this->OnSyntaxError(source, subcommand); + this->OnSyntaxError(source); } } diff --git a/modules/operserv/session.cpp b/modules/operserv/session.cpp index dd366e02b..d84ee696a 100644 --- a/modules/operserv/session.cpp +++ b/modules/operserv/session.cpp @@ -312,7 +312,7 @@ class CommandOSSession : public Command else if (cmd.equals_ci("VIEW")) this->DoView(source, params); else - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override @@ -598,7 +598,7 @@ class CommandOSException : public Command else if (cmd.equals_ci("VIEW")) return this->DoView(source, params); else - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override @@ -626,6 +626,22 @@ class CommandOSException : public Command " 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; } + + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand = "") override + { + if (subcommand.equals_ci("ADD")) + { + SubcommandSyntaxError(source, subcommand, _("[\037+expiry\037] \037mask\037 \037limit\037 \037reason\037")); + } + else if (subcommand.equals_ci("DEL")) + { + SubcommandSyntaxError(source, subcommand, _("{\037mask\037 | \037entry-num\037 | \037list\037}")); + } + else + { + Command::OnSyntaxError(source, subcommand); + } + } }; class OSSession : public Module diff --git a/modules/operserv/set.cpp b/modules/operserv/set.cpp index 3f05f7b91..6a3d9000a 100644 --- a/modules/operserv/set.cpp +++ b/modules/operserv/set.cpp @@ -198,7 +198,7 @@ class CommandOSSet : public Command else if (option.equals_ci("SUPERADMIN")) return this->DoSetSuperAdmin(source, params); else - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } bool OnHelp(CommandSource &source, const Anope::string &subcommand) override @@ -213,32 +213,21 @@ class CommandOSSet : public Command " LIST List the options")); } else if (subcommand.equals_ci("LIST")) -#warning "?" - //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" - 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." + source.Reply(_("Sets read-only mode on or off. In read-only mode, normal 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" 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" 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" 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.")); @@ -247,6 +236,18 @@ class CommandOSSet : public Command return true; } + + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand = "") override + { + if (subcommand.equals_ci("READONLY") || subcommand.equals_ci("DEBUG") || subcommand.equals_ci("NOEXPIRE") || subcommand.equals_ci("SUPERADMIN")) + { + SubcommandSyntaxError(source, subcommand, _("{ON | OFF}")); + } + else + { + Command::OnSyntaxError(source, subcommand); + } + } }; class OSSet : public Module diff --git a/modules/operserv/sxline.cpp b/modules/operserv/sxline.cpp index d8d373aa5..ebd6204f9 100644 --- a/modules/operserv/sxline.cpp +++ b/modules/operserv/sxline.cpp @@ -217,10 +217,26 @@ class CommandOSSXLineBase : public Command else if (cmd.equals_ci("CLEAR")) return this->OnClear(source); else - this->OnSyntaxError(source, ""); + this->OnSyntaxError(source); } - virtual bool OnHelp(CommandSource &source, const Anope::string &subcommand) override = 0; + virtual bool OnHelp(CommandSource &source, const Anope::string &subcommand) override anope_abstract; + + void OnSyntaxError(CommandSource &source, const Anope::string &subcommand = "") override + { + if (subcommand.equals_ci("ADD")) + { + SubcommandSyntaxError(source, subcommand, _("[+\037expiry\037] \037mask\037:\037reason\037")); + } + else if (subcommand.equals_ci("DEL")) + { + SubcommandSyntaxError(source, subcommand, _("{\037mask\037 | \037entry-num\037 | \037list\037 | \037id\037}")); + } + else + { + Command::OnSyntaxError(source, subcommand); + } + } }; class CommandOSSNLine : public CommandOSSXLineBase |