diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-28 00:13:41 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-28 00:13:41 +0000 |
commit | dc8f5d02f77aeabefaefe88005b99c8b47030ab7 (patch) | |
tree | 89ce56baff165606f8c16036b0a8d65459d53cb1 | |
parent | 9a98d0858bd71afa6c6cfb14fcbc030f7951fd12 (diff) |
Add support for syntax of commands in place of the text 'Not enough parameters' in numeric 461, where supported.
To support this each derived class of command_t must set the value of command_t::syntax to a non-empty string.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4561 e03df62e-2008-0410-955e-edbf42e46eb7
80 files changed, 123 insertions, 77 deletions
diff --git a/include/commands/cmd_admin.h b/include/commands/cmd_admin.h index ae577950e..e3972c398 100644 --- a/include/commands/cmd_admin.h +++ b/include/commands/cmd_admin.h @@ -24,7 +24,7 @@ class cmd_admin : public command_t { public: - cmd_admin () : command_t("ADMIN",0,0) { } + cmd_admin () : command_t("ADMIN",0,0) { syntax = "[<servername>]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_away.h b/include/commands/cmd_away.h index 9cb15c9fa..92a51e549 100644 --- a/include/commands/cmd_away.h +++ b/include/commands/cmd_away.h @@ -31,7 +31,7 @@ class cmd_away : public command_t { public: - cmd_away () : command_t("AWAY",0,0) { } + cmd_away () : command_t("AWAY",0,0) { syntax = "[<message>]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_connect.h b/include/commands/cmd_connect.h index 979ba4a6a..40fd8b752 100644 --- a/include/commands/cmd_connect.h +++ b/include/commands/cmd_connect.h @@ -24,7 +24,7 @@ class cmd_connect : public command_t { public: - cmd_connect () : command_t("CONNECT",'o',1) { } + cmd_connect () : command_t("CONNECT",'o',1) { syntax = "<servername> [<remote-server>]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_die.h b/include/commands/cmd_die.h index e95137ad8..ef4555670 100644 --- a/include/commands/cmd_die.h +++ b/include/commands/cmd_die.h @@ -31,7 +31,7 @@ class cmd_die : public command_t { public: - cmd_die () : command_t("DIE",'o',1) { } + cmd_die () : command_t("DIE",'o',1) { syntax = "<password>"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_eline.h b/include/commands/cmd_eline.h index a48b74a43..85a1da47c 100644 --- a/include/commands/cmd_eline.h +++ b/include/commands/cmd_eline.h @@ -31,7 +31,7 @@ class cmd_eline : public command_t { public: - cmd_eline () : command_t("ELINE",'o',1) { } + cmd_eline () : command_t("ELINE",'o',1) { syntax = "<ident@host> [<duration> :<reason>]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_gline.h b/include/commands/cmd_gline.h index d8016d733..79552a274 100644 --- a/include/commands/cmd_gline.h +++ b/include/commands/cmd_gline.h @@ -31,7 +31,7 @@ class cmd_gline : public command_t { public: - cmd_gline () : command_t("GLINE",'o',1) { } + cmd_gline () : command_t("GLINE",'o',1) { syntax = "<ident@host> [<duration> :<reason>]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_info.h b/include/commands/cmd_info.h index 122395c44..1b48f80b8 100644 --- a/include/commands/cmd_info.h +++ b/include/commands/cmd_info.h @@ -31,7 +31,7 @@ class cmd_info : public command_t { public: - cmd_info () : command_t("INFO",0,0) { } + cmd_info () : command_t("INFO",0,0) { syntax = "[<servermask>]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_invite.h b/include/commands/cmd_invite.h index 4150c8cc8..b6c78c13c 100644 --- a/include/commands/cmd_invite.h +++ b/include/commands/cmd_invite.h @@ -31,7 +31,7 @@ class cmd_invite : public command_t { public: - cmd_invite () : command_t("INVITE",0,0) { } + cmd_invite () : command_t("INVITE",0,0) { syntax = "[<nick> <channel>]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_ison.h b/include/commands/cmd_ison.h index 5dd28ab75..e45c61e8d 100644 --- a/include/commands/cmd_ison.h +++ b/include/commands/cmd_ison.h @@ -31,7 +31,7 @@ class cmd_ison : public command_t { public: - cmd_ison () : command_t("ISON",0,0) { } + cmd_ison () : command_t("ISON",0,0) { syntax = "<nick> {nick}"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_join.h b/include/commands/cmd_join.h index c7b4a3b18..58863bb4c 100644 --- a/include/commands/cmd_join.h +++ b/include/commands/cmd_join.h @@ -31,7 +31,7 @@ class cmd_join : public command_t { public: - cmd_join () : command_t("JOIN",0,1) { } + cmd_join () : command_t("JOIN",0,1) { syntax = "<channel>{,<channel>} {<key>{,<key>}}"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_kick.h b/include/commands/cmd_kick.h index 6fb470329..097636965 100644 --- a/include/commands/cmd_kick.h +++ b/include/commands/cmd_kick.h @@ -31,7 +31,7 @@ class cmd_kick : public command_t { public: - cmd_kick () : command_t("KICK",0,2) { } + cmd_kick () : command_t("KICK",0,2) { syntax = "<channel> <nick>{,<nick>} [<reason>]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_kill.h b/include/commands/cmd_kill.h index a8e879166..8f7a40141 100644 --- a/include/commands/cmd_kill.h +++ b/include/commands/cmd_kill.h @@ -31,7 +31,7 @@ class cmd_kill : public command_t { public: - cmd_kill () : command_t("KILL",'o',2) { } + cmd_kill () : command_t("KILL",'o',2) { syntax = "<nickname> <reason>"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_kline.h b/include/commands/cmd_kline.h index 6f96f80dd..de8a26779 100644 --- a/include/commands/cmd_kline.h +++ b/include/commands/cmd_kline.h @@ -31,7 +31,7 @@ class cmd_kline : public command_t { public: - cmd_kline () : command_t("KLINE",'o',1) { } + cmd_kline () : command_t("KLINE",'o',1) { syntax = "<ident@host> [<duration> :<reason>]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_loadmodule.h b/include/commands/cmd_loadmodule.h index bea19ae5f..0aa7d566b 100644 --- a/include/commands/cmd_loadmodule.h +++ b/include/commands/cmd_loadmodule.h @@ -31,7 +31,7 @@ class cmd_loadmodule : public command_t { public: - cmd_loadmodule () : command_t("LOADMODULE",'o',1) { } + cmd_loadmodule () : command_t("LOADMODULE",'o',1) { syntax = "<modulename>"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_modules.h b/include/commands/cmd_modules.h index a1684e507..eb8b1c882 100644 --- a/include/commands/cmd_modules.h +++ b/include/commands/cmd_modules.h @@ -31,7 +31,7 @@ class cmd_modules : public command_t { public: - cmd_modules () : command_t("MODULES",0,0) { } + cmd_modules () : command_t("MODULES",0,0) { syntax = "[debug]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_motd.h b/include/commands/cmd_motd.h index ca065f97e..c3401b127 100644 --- a/include/commands/cmd_motd.h +++ b/include/commands/cmd_motd.h @@ -31,7 +31,7 @@ class cmd_motd : public command_t { public: - cmd_motd () : command_t("MOTD",0,0) { } + cmd_motd () : command_t("MOTD",0,0) { syntax = "[<servername>]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_names.h b/include/commands/cmd_names.h index 7c1b126f1..fdcf2ea40 100644 --- a/include/commands/cmd_names.h +++ b/include/commands/cmd_names.h @@ -31,7 +31,7 @@ class cmd_names : public command_t { public: - cmd_names () : command_t("NAMES",0,0) { } + cmd_names () : command_t("NAMES",0,0) { syntax = "{<channel>{,<channel>}}"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_nick.h b/include/commands/cmd_nick.h index 53f7f5a87..a90930558 100644 --- a/include/commands/cmd_nick.h +++ b/include/commands/cmd_nick.h @@ -31,7 +31,7 @@ class cmd_nick : public command_t { public: - cmd_nick () : command_t("NICK",0,1) { } + cmd_nick () : command_t("NICK",0,1) { syntax = "<newnick>"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_notice.h b/include/commands/cmd_notice.h index 358e405d6..e91c65bb1 100644 --- a/include/commands/cmd_notice.h +++ b/include/commands/cmd_notice.h @@ -31,7 +31,7 @@ class cmd_notice : public command_t { public: - cmd_notice () : command_t("NOTICE",0,2) { } + cmd_notice () : command_t("NOTICE",0,2) { syntax = "<target>{,<target>} <message>"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_oper.h b/include/commands/cmd_oper.h index 8e731b579..37d449af7 100644 --- a/include/commands/cmd_oper.h +++ b/include/commands/cmd_oper.h @@ -33,7 +33,7 @@ bool OneOfMatches(const char* host, const char* hostlist); class cmd_oper : public command_t { public: - cmd_oper () : command_t("OPER",0,2) { } + cmd_oper () : command_t("OPER",0,2) { syntax = "<username> <password>"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_part.h b/include/commands/cmd_part.h index e23f106fc..1aaa7bca6 100644 --- a/include/commands/cmd_part.h +++ b/include/commands/cmd_part.h @@ -31,7 +31,7 @@ class cmd_part : public command_t { public: - cmd_part () : command_t("PART",0,1) { } + cmd_part () : command_t("PART",0,1) { syntax = "<channel>{,<channel>} [<reason>]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_pass.h b/include/commands/cmd_pass.h index c79686220..f2399f57c 100644 --- a/include/commands/cmd_pass.h +++ b/include/commands/cmd_pass.h @@ -31,7 +31,7 @@ class cmd_pass : public command_t { public: - cmd_pass () : command_t("PASS",0,1) { } + cmd_pass () : command_t("PASS",0,1) { syntax = "<password>"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_ping.h b/include/commands/cmd_ping.h index 8b9d88f1c..c131af628 100644 --- a/include/commands/cmd_ping.h +++ b/include/commands/cmd_ping.h @@ -31,7 +31,7 @@ class cmd_ping : public command_t { public: - cmd_ping () : command_t("PING",0,1) { } + cmd_ping () : command_t("PING",0,1) { syntax = "<servername> [:<servername>]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_pong.h b/include/commands/cmd_pong.h index ec517bdad..9d2006e0f 100644 --- a/include/commands/cmd_pong.h +++ b/include/commands/cmd_pong.h @@ -31,7 +31,7 @@ class cmd_pong : public command_t { public: - cmd_pong () : command_t("PONG",0,1) { } + cmd_pong () : command_t("PONG",0,1) { syntax = "<ping-text>"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_privmsg.h b/include/commands/cmd_privmsg.h index a35a5cdec..12b11cb22 100644 --- a/include/commands/cmd_privmsg.h +++ b/include/commands/cmd_privmsg.h @@ -31,7 +31,7 @@ class cmd_privmsg : public command_t { public: - cmd_privmsg () : command_t("PRIVMSG",0,2) { } + cmd_privmsg () : command_t("PRIVMSG",0,2) { syntax = "<target>{,<target>} <message>"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_qline.h b/include/commands/cmd_qline.h index f563b9cbb..65232ee28 100644 --- a/include/commands/cmd_qline.h +++ b/include/commands/cmd_qline.h @@ -31,7 +31,7 @@ class cmd_qline : public command_t { public: - cmd_qline () : command_t("QLINE",'o',1) { } + cmd_qline () : command_t("QLINE",'o',1) { syntax = "<nick> [<duration> :<reason>]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_quit.h b/include/commands/cmd_quit.h index 5229aaa50..891b2f0a3 100644 --- a/include/commands/cmd_quit.h +++ b/include/commands/cmd_quit.h @@ -31,7 +31,7 @@ class cmd_quit : public command_t { public: - cmd_quit () : command_t("QUIT",0,0) { } + cmd_quit () : command_t("QUIT",0,0) { syntax = "[<message>]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_rehash.h b/include/commands/cmd_rehash.h index e98eed301..f9690a3ee 100644 --- a/include/commands/cmd_rehash.h +++ b/include/commands/cmd_rehash.h @@ -31,7 +31,7 @@ class cmd_rehash : public command_t { public: - cmd_rehash () : command_t("REHASH",'o',0) { } + cmd_rehash () : command_t("REHASH",'o',0) { syntax = "[<servermask>]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_restart.h b/include/commands/cmd_restart.h index e77476919..394cf0df2 100644 --- a/include/commands/cmd_restart.h +++ b/include/commands/cmd_restart.h @@ -31,7 +31,7 @@ class cmd_restart : public command_t { public: - cmd_restart () : command_t("RESTART",'o',1) { } + cmd_restart () : command_t("RESTART",'o',1) { syntax = "<password>"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_rules.h b/include/commands/cmd_rules.h index 60567e24d..36ccda645 100644 --- a/include/commands/cmd_rules.h +++ b/include/commands/cmd_rules.h @@ -31,7 +31,7 @@ class cmd_rules : public command_t { public: - cmd_rules () : command_t("RULES",0,0) { } + cmd_rules () : command_t("RULES",0,0) { syntax = "[<servername>]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_squit.h b/include/commands/cmd_squit.h index e8a63b452..d22ee9264 100644 --- a/include/commands/cmd_squit.h +++ b/include/commands/cmd_squit.h @@ -31,7 +31,7 @@ class cmd_squit : public command_t { public: - cmd_squit () : command_t("SQUIT",'o',1) { } + cmd_squit () : command_t("SQUIT",'o',1) { syntax = "<servername> [<reason>]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_stats.h b/include/commands/cmd_stats.h index eeb3a0013..1c54944c0 100644 --- a/include/commands/cmd_stats.h +++ b/include/commands/cmd_stats.h @@ -31,7 +31,7 @@ class cmd_stats : public command_t { public: - cmd_stats () : command_t("STATS",0,1) { } + cmd_stats () : command_t("STATS",0,1) { syntax = "[<servername>] <stats-symbol>"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_time.h b/include/commands/cmd_time.h index 2c4f55ba0..9a3dd0c32 100644 --- a/include/commands/cmd_time.h +++ b/include/commands/cmd_time.h @@ -31,7 +31,7 @@ class cmd_time : public command_t { public: - cmd_time () : command_t("TIME",0,0) { } + cmd_time () : command_t("TIME",0,0) { syntax = "[<servername>]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_topic.h b/include/commands/cmd_topic.h index e0cd7e3de..2b6348803 100644 --- a/include/commands/cmd_topic.h +++ b/include/commands/cmd_topic.h @@ -31,7 +31,7 @@ class cmd_topic : public command_t { public: - cmd_topic () : command_t("TOPIC",0,1) { } + cmd_topic () : command_t("TOPIC",0,1) { syntax = "<channel> [<topic>]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_trace.h b/include/commands/cmd_trace.h index 50669498a..44f308012 100644 --- a/include/commands/cmd_trace.h +++ b/include/commands/cmd_trace.h @@ -31,7 +31,7 @@ class cmd_trace : public command_t { public: - cmd_trace () : command_t("TRACE",'o',0) { } + cmd_trace () : command_t("TRACE",'o',0) { syntax = "[<object>]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_unloadmodule.h b/include/commands/cmd_unloadmodule.h index 1eef989b1..05c5c32d6 100644 --- a/include/commands/cmd_unloadmodule.h +++ b/include/commands/cmd_unloadmodule.h @@ -31,7 +31,7 @@ class cmd_unloadmodule : public command_t { public: - cmd_unloadmodule () : command_t("UNLOADMODULE",'o',1) { } + cmd_unloadmodule () : command_t("UNLOADMODULE",'o',1) { syntax = "<modulename>"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_user.h b/include/commands/cmd_user.h index 59a8f4c35..b8e3201c1 100644 --- a/include/commands/cmd_user.h +++ b/include/commands/cmd_user.h @@ -31,7 +31,7 @@ class cmd_user : public command_t { public: - cmd_user () : command_t("USER",0,4) { } + cmd_user () : command_t("USER",0,4) { syntax = "<username> <localhost> <remotehost> <GECOS>"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_userhost.h b/include/commands/cmd_userhost.h index 8fd75e63d..e50813b4e 100644 --- a/include/commands/cmd_userhost.h +++ b/include/commands/cmd_userhost.h @@ -31,7 +31,7 @@ class cmd_userhost : public command_t { public: - cmd_userhost () : command_t("USERHOST",0,1) { } + cmd_userhost () : command_t("USERHOST",0,1) { syntax = "<nick>{,<nick>}"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_version.h b/include/commands/cmd_version.h index e80dc3565..55b643f6e 100644 --- a/include/commands/cmd_version.h +++ b/include/commands/cmd_version.h @@ -31,7 +31,7 @@ class cmd_version : public command_t { public: - cmd_version () : command_t("VERSION",0,0) { } + cmd_version () : command_t("VERSION",0,0) { syntax = "[<servername>]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_wallops.h b/include/commands/cmd_wallops.h index 3f98aa02d..b8a4f690a 100644 --- a/include/commands/cmd_wallops.h +++ b/include/commands/cmd_wallops.h @@ -31,7 +31,7 @@ class cmd_wallops : public command_t { public: - cmd_wallops () : command_t("WALLOPS",'o',1) { } + cmd_wallops () : command_t("WALLOPS",'o',1) { syntax = "<any-text>"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_who.h b/include/commands/cmd_who.h index cbf59ad37..c88233b1d 100644 --- a/include/commands/cmd_who.h +++ b/include/commands/cmd_who.h @@ -31,7 +31,7 @@ class cmd_who : public command_t { public: - cmd_who () : command_t("WHO",0,1) { } + cmd_who () : command_t("WHO",0,1) { syntax = "<server>|<nickname>|<channel> [O|o]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_whois.h b/include/commands/cmd_whois.h index b129b3480..0daa1144c 100644 --- a/include/commands/cmd_whois.h +++ b/include/commands/cmd_whois.h @@ -33,7 +33,7 @@ void do_whois(userrec* user, userrec* dest,unsigned long signon, unsigned long i class cmd_whois : public command_t { public: - cmd_whois () : command_t("WHOIS",0,1) { } + cmd_whois () : command_t("WHOIS",0,1) { syntax = "<nick>{,<nick>}"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_whowas.h b/include/commands/cmd_whowas.h index 50838b17c..6ef30324f 100644 --- a/include/commands/cmd_whowas.h +++ b/include/commands/cmd_whowas.h @@ -31,7 +31,7 @@ class cmd_whowas : public command_t { public: - cmd_whowas () : command_t("WHOWAS",0,1) { } + cmd_whowas () : command_t("WHOWAS",0,1) { syntax = "<nick>{,<nick>}"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/commands/cmd_zline.h b/include/commands/cmd_zline.h index 3ab32e080..d27defa0f 100644 --- a/include/commands/cmd_zline.h +++ b/include/commands/cmd_zline.h @@ -31,7 +31,7 @@ class cmd_zline : public command_t { public: - cmd_zline () : command_t("ZLINE",'o',1) { } + cmd_zline () : command_t("ZLINE",'o',1) { syntax = "<ipmask> [<duration> :<reason>]"; } void Handle(const char** parameters, int pcnt, userrec *user); }; diff --git a/include/ctables.h b/include/ctables.h index 26140c607..0b523a77f 100644 --- a/include/ctables.h +++ b/include/ctables.h @@ -52,11 +52,16 @@ class command_t : public Extensible /** True if the command is disabled to non-opers */ bool disabled; + /** Syntax string for the command, displayed if non-empty string. + * This takes place of the text in the 'not enough parameters' numeric. + */ + std::string syntax; command_t(const std::string &cmd, char flags, int minpara) : command(cmd), flags_needed(flags), min_params(minpara), disabled(false) { use_count = total_bytes = 0; source = "<core>"; + syntax = ""; } virtual void Handle(const char** parameters, int pcnt, userrec* user) = 0; diff --git a/include/mode.h b/include/mode.h index 58586a001..4ec7cef4c 100644 --- a/include/mode.h +++ b/include/mode.h @@ -387,7 +387,7 @@ class cmd_mode : public command_t /** * Standard constructor */ - cmd_mode () : command_t("MODE",0,1) { } + cmd_mode () : command_t("MODE",0,1) { syntax = "<target> <modes> {<mode-parameters>}"; } /** * Handle MODE */ diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 8e704e796..1a32456b2 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -232,7 +232,12 @@ void CommandParser::ProcessCommand(userrec *user, std::string &cmd) if (items < cm->second->min_params) { log(DEBUG,"not enough parameters: %s %s",user->nick,command.c_str()); - WriteServ(user->fd,"461 %s %s :Not enough parameters",user->nick,command.c_str()); + + /* If syntax is given, display this as the 461 reply */ + if (cm->second->syntax.length()) + WriteServ(user->fd,"461 %s %s :Syntax: %s %s", cm->second->command.c_str(), cm->second->syntax.c_str()); + else + WriteServ(user->fd,"461 %s %s :Not enough parameters",user->nick,command.c_str()); return; } if (cm->second->flags_needed) diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index 57bb9490a..8f10cc84d 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -66,6 +66,7 @@ class cmd_cban : public command_t { this->source = "m_cban.so"; this->Srv = Me; + syntax = "<channel> [<duration> :<reason>]"; } void Handle(const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 7f5dc793d..4dd0f8a62 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -37,6 +37,7 @@ class cmd_check : public command_t cmd_check() : command_t("CHECK", 'o', 1) { this->source = "m_check.so"; + syntax = "<nickname>|<ip>|<hostmask>|<channel>"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index 8113cc19d..ff52fcebf 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -33,6 +33,7 @@ class cmd_chghost : public command_t cmd_chghost () : command_t("CHGHOST",'o',2) { this->source = "m_chghost.so"; + syntax = "<nick> <newhost>"; } void Handle(const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index f2c48cb52..f83460f54 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -14,6 +14,7 @@ class cmd_chgident : public command_t { this->source = "m_chgident.so"; Srv = serv; + syntax = "<nick> <newident>"; } void Handle(const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_devoice.cpp b/src/modules/m_devoice.cpp index 214de5783..55b6abef7 100644 --- a/src/modules/m_devoice.cpp +++ b/src/modules/m_devoice.cpp @@ -36,6 +36,7 @@ class cmd_devoice : public command_t cmd_devoice () : command_t("DEVOICE", 0, 1) { this->source = "m_devoice.so"; + syntax = "<channel>"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp index 229a77256..e56dfa79c 100644 --- a/src/modules/m_globalload.cpp +++ b/src/modules/m_globalload.cpp @@ -33,6 +33,7 @@ class cmd_gloadmodule : public command_t cmd_gloadmodule () : command_t("GLOADMODULE", 'o', 1) { this->source = "m_globalload.so"; + syntax = "<modulename>"; } void Handle (const char** parameters, int pcnt, userrec *user) @@ -55,6 +56,7 @@ class cmd_gunloadmodule : public command_t cmd_gunloadmodule () : command_t("GUNLOADMODULE", 'o', 1) { this->source = "m_globalload.so"; + syntax = "<modulename>"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_globops.cpp b/src/modules/m_globops.cpp index 6d00d5889..2b2af1539 100644 --- a/src/modules/m_globops.cpp +++ b/src/modules/m_globops.cpp @@ -35,6 +35,7 @@ class cmd_globops : public command_t cmd_globops () : command_t("GLOBOPS",'o',1) { this->source = "m_globops.so"; + syntax = "<any-text>"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index c1457765d..e503952d6 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -64,6 +64,7 @@ class cmd_helpop : public command_t cmd_helpop () : command_t("HELPOP",0,1) { this->source = "m_helpop.so"; + syntax = "[?|!]<any-text>"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index b4e535d9b..9dcbbe05e 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -33,6 +33,7 @@ class cmd_knock : public command_t cmd_knock () : command_t("KNOCK", 0, 2) { this->source = "m_knock.so"; + syntax = "<channel> <reason>"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index df8a551dd..315f8390e 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -35,6 +35,7 @@ class cmd_nicklock : public command_t cmd_nicklock () : command_t("NICKLOCK", 'o', 2) { this->source = "m_nicklock.so"; + syntax = "<oldnick> <newnick>"; } void Handle(const char** parameters, int pcnt, userrec *user) @@ -70,6 +71,7 @@ class cmd_nickunlock : public command_t cmd_nickunlock () : command_t("NICKUNLOCK", 'o', 1) { this->source = "m_nickunlock.so"; + syntax = "<locked-nick>"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_opermd5.cpp b/src/modules/m_opermd5.cpp index 4116ccb37..1adf0906f 100644 --- a/src/modules/m_opermd5.cpp +++ b/src/modules/m_opermd5.cpp @@ -274,6 +274,7 @@ class cmd_mkpasswd : public command_t cmd_mkpasswd () : command_t("MKPASSWD", 'o', 1) { this->source = "m_opermd5.so"; + syntax = "<any-text>"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index b4a85e889..4980b74bf 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -49,6 +49,7 @@ class cmd_opermotd : public command_t cmd_opermotd () : command_t("OPERMOTD", 'o', 0) { this->source = "m_opermotd.so"; + syntax = "[<servername>]"; } void Handle (const char** parameters, int pcnt, userrec* user) diff --git a/src/modules/m_opersha256.cpp b/src/modules/m_opersha256.cpp index ecade64ad..b720118e2 100644 --- a/src/modules/m_opersha256.cpp +++ b/src/modules/m_opersha256.cpp @@ -230,6 +230,7 @@ public: cmd_mksha256() : command_t("MKSHA256", 'o', 1) { this->source = "m_opersha256.so"; + syntax = "<any-text>"; } void Handle(const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_park.cpp b/src/modules/m_park.cpp index 782cf2f3b..9fbae3529 100644 --- a/src/modules/m_park.cpp +++ b/src/modules/m_park.cpp @@ -122,6 +122,7 @@ class cmd_unpark : public command_t cmd_unpark () : command_t("UNPARK", 0, 2) { this->source = "m_park.so"; + syntax = "<nick> <key>"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index 59c1fcda2..2232c8fae 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -53,6 +53,7 @@ class cmd_remove : public command_t cmd_remove () : command_t("REMOVE", 0, 2) { this->source = "m_remove.so"; + syntax = "<nick> <channel> [<reason>]"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index 39a95a27c..a94e03958 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -33,6 +33,7 @@ class cmd_sajoin : public command_t cmd_sajoin() : command_t("SAJOIN", 'o', 2) { this->source = "m_sajoin.so"; + syntax = "<nick> <channel>"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index dc23cc990..2e7cd9fe1 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -44,6 +44,7 @@ class cmd_samode : public command_t cmd_samode () : command_t("SAMODE", 'o', 2) { this->source = "m_samode.so"; + syntax = "<target> <modes> {<mode-parameters>}"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp index 6c07d08ce..09b585b14 100644 --- a/src/modules/m_sanick.cpp +++ b/src/modules/m_sanick.cpp @@ -32,6 +32,7 @@ class cmd_sanick : public command_t cmd_sanick () : command_t("SANICK", 'o', 2) { this->source = "m_sanick.so"; + syntax = "<nick> <new-nick>"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index afbdbdc87..f7620ec00 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -33,6 +33,7 @@ class cmd_sapart : public command_t cmd_sapart () : command_t("SAPART", 'o', 2) { this->source = "m_sapart.so"; + syntax = "<nick> <channel>"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index d43b97102..0069e3486 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -42,6 +42,7 @@ class cmd_saquit : public command_t cmd_saquit () : command_t("SAQUIT",'o',2) { this->source = "m_saquit.so"; + syntax = "<nick> <reason>"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index eb2196c92..9b403506d 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -33,6 +33,7 @@ class cmd_sethost : public command_t cmd_sethost() : command_t("SETHOST",'o',1) { this->source = "m_sethost.so"; + syntax = "<new-hostname>"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp index 12221edb0..80333ca8d 100644 --- a/src/modules/m_setident.cpp +++ b/src/modules/m_setident.cpp @@ -12,6 +12,7 @@ class cmd_setident : public command_t cmd_setident() : command_t("SETIDENT", 'o', 1) { this->source = "m_setident.so"; + syntax = "<new-ident>"; } void Handle(const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp index 040625238..b388d35eb 100644 --- a/src/modules/m_setidle.cpp +++ b/src/modules/m_setidle.cpp @@ -33,6 +33,7 @@ class cmd_setidle : public command_t cmd_setidle () : command_t("SETIDLE", 'o', 1) { this->source = "m_setidle.so"; + syntax = "<idle-seconds>"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp index 9a3b2a942..72d255be7 100644 --- a/src/modules/m_setname.cpp +++ b/src/modules/m_setname.cpp @@ -33,6 +33,7 @@ class cmd_setname : public command_t cmd_setname () : command_t("SETNAME", 0, 1) { this->source = "m_setname.so"; + syntax = "<new-gecos>"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 39b810dfe..e3cd36f76 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -39,6 +39,7 @@ class cmd_silence : public command_t cmd_silence() : command_t("SILENCE", 0, 0) { this->source = "m_silence.so"; + syntax = "{[+|-]<nick>}"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 59b82fb5a..3f2bde805 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -555,6 +555,7 @@ class cmd_rconnect : public command_t cmd_rconnect (Module* Callback) : command_t("RCONNECT", 'o', 2), Creator(Callback) { this->source = "m_spanningtree.so"; + syntax = "<remote-server-mask> <servermask>"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_spy.cpp b/src/modules/m_spy.cpp index 3e0e21a96..d6f6826a9 100644 --- a/src/modules/m_spy.cpp +++ b/src/modules/m_spy.cpp @@ -90,6 +90,7 @@ class cmd_spylist : public command_t cmd_spylist () : command_t("SPYLIST", 'o', 0) { this->source = "m_spy.so"; + syntax = ""; } void Handle (const char** parameters, int pcnt, userrec *user) @@ -107,37 +108,38 @@ class cmd_spylist : public command_t class cmd_spynames : public command_t { public: - cmd_spynames () : command_t("SPYNAMES", 'o', 0) - { - this->source = "m_spy.so"; - } - - void Handle (const char** parameters, int pcnt, userrec *user) - { - chanrec* c; - - if (!pcnt) - { - WriteServ(user->fd,"366 %s * :End of /NAMES list.",user->nick); - return; - } - - if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 1)) - return; - - WriteOpers("*** Oper %s used SPYNAMES to view the users on %s",user->nick,parameters[0]); - - c = FindChan(parameters[0]); - if (c) - { - spy_userlist(user,c); - WriteServ(user->fd,"366 %s %s :End of /NAMES list.", user->nick, c->name); - } - else - { - WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, parameters[0]); - } - } + cmd_spynames () : command_t("SPYNAMES", 'o', 0) + { + this->source = "m_spy.so"; + syntax = "{<channel>{,<channel>}}"; + } + + void Handle (const char** parameters, int pcnt, userrec *user) + { + chanrec* c; + + if (!pcnt) + { + WriteServ(user->fd,"366 %s * :End of /NAMES list.",user->nick); + return; + } + + if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 1)) + return; + + WriteOpers("*** Oper %s used SPYNAMES to view the users on %s",user->nick,parameters[0]); + + c = FindChan(parameters[0]); + if (c) + { + spy_userlist(user,c); + WriteServ(user->fd,"366 %s %s :End of /NAMES list.", user->nick, c->name); + } + else + { + WriteServ(user->fd,"401 %s %s :No such nick/channel",user->nick, parameters[0]); + } + } }; class ModuleSpy : public Module diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index 41248832d..7ba046983 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -29,6 +29,7 @@ class cmd_swhois : public command_t { this->Srv = server; this->source = "m_swhois.so"; + syntax = "<nick> <swhois>"; } void Handle(const char** parameters, int pcnt, userrec* user) diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 2f4f040c0..b05cbf8f7 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -45,6 +45,7 @@ class cmd_tban : public command_t cmd_tban () : command_t("TBAN", 0, 3) { this->source = "m_timedbans.so"; + syntax = "<channel> <duration> <banmask>"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp index c8332319f..d5b1b587d 100644 --- a/src/modules/m_uninvite.cpp +++ b/src/modules/m_uninvite.cpp @@ -33,6 +33,7 @@ class cmd_uninvite : public command_t cmd_uninvite () : command_t("UNINVITE", 0, 2) { this->source = "m_uninvite.so"; + syntax = "<nick> <channel>"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index 0b62df0a1..4775b518c 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -33,6 +33,7 @@ class cmd_userip : public command_t cmd_userip () : command_t("USERIP", 'o', 1) { this->source = "m_userip.so"; + syntax = "<nick>{,<nick>}"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp index 61d07a7e2..a7ce8fd4a 100644 --- a/src/modules/m_vhost.cpp +++ b/src/modules/m_vhost.cpp @@ -33,6 +33,7 @@ class cmd_vhost : public command_t cmd_vhost() : command_t("VHOST", 0, 2) { this->source = "m_vhost.so"; + syntax = "<username> <password>"; } void Handle (const char** parameters, int pcnt, userrec *user) diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index 58d0a4bd7..9f8c15e07 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -45,6 +45,7 @@ class cmd_watch : public command_t cmd_watch() : command_t("WATCH",0,0) { this->source = "m_watch.so"; + syntax = "[C|L|S]|[+|-<nick>]"; } void Handle (const char** parameters, int pcnt, userrec *user) |