1
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-01-03 14:57:42 -05:00

Show usage when invalid /sub argument

This commit is contained in:
James Booth 2012-11-27 21:20:00 +00:00
parent c3148eb95a
commit 4e78f8f149

View File

@ -966,18 +966,22 @@ _cmd_connect(gchar **args, struct cmd_help_t help)
static gboolean
_cmd_sub(gchar **args, struct cmd_help_t help)
{
gboolean result = FALSE;
jabber_conn_status_t conn_status = jabber_get_connection_status();
if (conn_status != JABBER_CONNECTED) {
cons_show("You are currently not connected.");
result = TRUE;
} else {
return TRUE;
}
char *subcmd, *jid, *bare_jid;
subcmd = args[0];
jid = args[1];
if (subcmd == NULL) {
cons_show("Usage: %s", help.usage);
return TRUE;
}
if (jid != NULL) {
jid = strdup(jid);
} else {
@ -1000,13 +1004,12 @@ _cmd_sub(gchar **args, struct cmd_help_t help)
log_info("Sent subscription request to %s.", bare_jid);
} else if (strcmp(subcmd, "show") == 0) {
/* TODO: not implemented yet */
} else {
cons_show("Usage: %s", help.usage);
}
free(jid);
result = TRUE;
}
return result;
return TRUE;
}
static gboolean