diff options
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->On |
