ns_ajoin: deduplicate the syntax error messages

The one in 'HELP' was missing a mention of CLEAR. Closes atheme#269.
This commit is contained in:
Mantas Mikulėnas 2014-01-27 03:06:11 +02:00
parent 4e453e0ee2
commit e8980b89cb
1 changed files with 9 additions and 15 deletions

View File

@ -19,6 +19,12 @@ DECLARE_MODULE_V1
static void ajoin_on_identify(user_t *u); static void ajoin_on_identify(user_t *u);
static void ns_cmd_ajoin_syntaxerr(sourceinfo_t *si)
{
command_fail(si, fault_badparams, STR_INSUFFICIENT_PARAMS, "AJOIN");
command_fail(si, fault_badparams, "Syntax: AJOIN <list|add|del|clear> [#channel]");
}
static void ns_cmd_ajoin(sourceinfo_t *si, int parc, char *parv[]) static void ns_cmd_ajoin(sourceinfo_t *si, int parc, char *parv[])
{ {
char buf[512]; char buf[512];
@ -26,11 +32,7 @@ static void ns_cmd_ajoin(sourceinfo_t *si, int parc, char *parv[])
metadata_t *md; metadata_t *md;
if (!parv[0]) if (!parv[0])
{ return ns_cmd_ajoin_syntaxerr(si);
command_fail(si, fault_badparams, STR_INSUFFICIENT_PARAMS, "AJOIN");
command_fail(si, fault_badparams, "Syntax: AJOIN <list|add|del> [#channel]");
return;
}
if (!strcasecmp(parv[0], "LIST")) if (!strcasecmp(parv[0], "LIST"))
{ {
@ -51,11 +53,7 @@ static void ns_cmd_ajoin(sourceinfo_t *si, int parc, char *parv[])
else if (!strcasecmp(parv[0], "ADD")) else if (!strcasecmp(parv[0], "ADD"))
{ {
if (!parv[1]) if (!parv[1])
{ return ns_cmd_ajoin_syntaxerr(si);
command_fail(si, fault_badparams, STR_INSUFFICIENT_PARAMS, "AJOIN");
command_fail(si, fault_badparams, "Syntax: AJOIN <list|add|del|clear> [#channel]");
return;
}
if ((md = metadata_find(si->smu, "private:autojoin"))) if ((md = metadata_find(si->smu, "private:autojoin")))
{ {
@ -99,11 +97,7 @@ static void ns_cmd_ajoin(sourceinfo_t *si, int parc, char *parv[])
else if (!strcasecmp(parv[0], "DEL")) else if (!strcasecmp(parv[0], "DEL"))
{ {
if (!parv[1]) if (!parv[1])
{ return ns_cmd_ajoin_syntaxerr(si);
command_fail(si, fault_badparams, STR_INSUFFICIENT_PARAMS, "AJOIN");
command_fail(si, fault_badparams, "Syntax: AJOIN <list|add|del|clear> [#channel]");
return;
}
if (!(md = metadata_find(si->smu, "private:autojoin"))) if (!(md = metadata_find(si->smu, "private:autojoin")))
{ {