summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-28 00:13:41 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-07-28 00:13:41 +0000
commitdc8f5d02f77aeabefaefe88005b99c8b47030ab7 (patch)
tree89ce56baff165606f8c16036b0a8d65459d53cb1 /src
parent9a98d0858bd71afa6c6cfb14fcbc030f7951fd12 (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
Diffstat (limited to 'src')
-rw-r--r--src/command_parse.cpp7
-rw-r--r--src/modules/m_cban.cpp1
-rw-r--r--src/modules/m_check.cpp1
-rw-r--r--src/modules/m_chghost.cpp1
-rw-r--r--src/modules/m_chgident.cpp1
-rw-r--r--src/modules/m_devoice.cpp1
-rw-r--r--src/modules/m_globalload.cpp2
-rw-r--r--src/modules/m_globops.cpp1
-rw-r--r--src/modules/m_helpop.cpp1
-rw-r--r--src/modules/m_knock.cpp1
-rw-r--r--src/modules/m_nicklock.cpp2
-rw-r--r--src/modules/m_opermd5.cpp1
-rw-r--r--src/modules/m_opermotd.cpp1
-rw-r--r--src/modules/m_opersha256.cpp1
-rw-r--r--src/modules/m_park.cpp1
-rw-r--r--src/modules/m_remove.cpp1
-rw-r--r--src/modules/m_sajoin.cpp1
-rw-r--r--src/modules/m_samode.cpp1
-rw-r--r--src/modules/m_sanick.cpp1
-rw-r--r--src/modules/m_sapart.cpp1
-rw-r--r--src/modules/m_saquit.cpp1
-rw-r--r--src/modules/m_sethost.cpp1
-rw-r--r--src/modules/m_setident.cpp1
-rw-r--r--src/modules/m_setidle.cpp1
-rw-r--r--src/modules/m_setname.cpp1
-rw-r--r--src/modules/m_silence.cpp1
-rw-r--r--src/modules/m_spanningtree.cpp1
-rw-r--r--src/modules/m_spy.cpp64
-rw-r--r--src/modules/m_swhois.cpp1
-rw-r--r--src/modules/m_timedbans.cpp1
-rw-r--r--src/modules/m_uninvite.cpp1
-rw-r--r--src/modules/m_userip.cpp1
-rw-r--r--src/modules/m_vhost.cpp1
-rw-r--r--src/modules/m_watch.cpp1
34 files changed, 73 insertions, 32 deletions
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)