mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Show usage when invalid /sub argument
This commit is contained in:
parent
c3148eb95a
commit
4e78f8f149
@ -966,18 +966,22 @@ _cmd_connect(gchar **args, struct cmd_help_t help)
|
|||||||
static gboolean
|
static gboolean
|
||||||
_cmd_sub(gchar **args, struct cmd_help_t help)
|
_cmd_sub(gchar **args, struct cmd_help_t help)
|
||||||
{
|
{
|
||||||
gboolean result = FALSE;
|
|
||||||
|
|
||||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||||
|
|
||||||
if (conn_status != JABBER_CONNECTED) {
|
if (conn_status != JABBER_CONNECTED) {
|
||||||
cons_show("You are currently not connected.");
|
cons_show("You are currently not connected.");
|
||||||
result = TRUE;
|
return TRUE;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
char *subcmd, *jid, *bare_jid;
|
char *subcmd, *jid, *bare_jid;
|
||||||
subcmd = args[0];
|
subcmd = args[0];
|
||||||
jid = args[1];
|
jid = args[1];
|
||||||
|
|
||||||
|
if (subcmd == NULL) {
|
||||||
|
cons_show("Usage: %s", help.usage);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (jid != NULL) {
|
if (jid != NULL) {
|
||||||
jid = strdup(jid);
|
jid = strdup(jid);
|
||||||
} else {
|
} else {
|
||||||
@ -1000,13 +1004,12 @@ _cmd_sub(gchar **args, struct cmd_help_t help)
|
|||||||
log_info("Sent subscription request to %s.", bare_jid);
|
log_info("Sent subscription request to %s.", bare_jid);
|
||||||
} else if (strcmp(subcmd, "show") == 0) {
|
} else if (strcmp(subcmd, "show") == 0) {
|
||||||
/* TODO: not implemented yet */
|
/* TODO: not implemented yet */
|
||||||
|
} else {
|
||||||
|
cons_show("Usage: %s", help.usage);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(jid);
|
free(jid);
|
||||||
result = TRUE;
|
return TRUE;
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
Loading…
Reference in New Issue
Block a user