Added autocomplete for /software command

This commit is contained in:
James Booth
2013-02-17 02:10:56 +00:00
parent 44d2f8da7a
commit bced3d4b36
11 changed files with 163 additions and 1 deletions

View File

@@ -126,6 +126,7 @@ static gboolean _cmd_chat(gchar **args, struct cmd_help_t help);
static gboolean _cmd_xa(gchar **args, struct cmd_help_t help);
static gboolean _cmd_info(gchar **args, struct cmd_help_t help);
static gboolean _cmd_caps(gchar **args, struct cmd_help_t help);
static gboolean _cmd_software(gchar **args, struct cmd_help_t help);
static gboolean _cmd_wins(gchar **args, struct cmd_help_t help);
static gboolean _cmd_nick(gchar **args, struct cmd_help_t help);
static gboolean _cmd_theme(gchar **args, struct cmd_help_t help);
@@ -279,6 +280,15 @@ static struct cmd_t main_commands[] =
"The command output is similar to the /info command, but shows the capabilities of each available resource.",
NULL } } },
{ "/software",
_cmd_software, parse_args, 0, 1,
{ "/software [jid|nick]", "Find out a software version information about a contacts resource.",
{ "/software [jid|nick]",
"--------------------",
"Find out a contact, or room members software version information.",
"If in a chat window the parameter is not required, the current recipient will be used.",
NULL } } },
{ "/status",
_cmd_status, parse_args, 0, 1,
{ "/status [jid|nick]", "Find out a contacts presence information.",
@@ -987,6 +997,8 @@ _cmd_complete_parameters(char *input, int *size)
contact_list_find_contact);
_parameter_autocomplete(input, size, "/status",
contact_list_find_contact);
_parameter_autocomplete(input, size, "/software",
contact_list_find_resource);
}
_parameter_autocomplete(input, size, "/connect",
@@ -1938,6 +1950,27 @@ _cmd_caps(gchar **args, struct cmd_help_t help)
return TRUE;
}
static gboolean
_cmd_software(gchar **args, struct cmd_help_t help)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
return TRUE;
}
Jid *jid = jid_create(args[0]);
if (jid->fulljid == NULL) {
cons_show("You must provide a full jid to the /software command.");
return TRUE;
} else {
iq_send_software_version(jid->fulljid);
return TRUE;
}
}
static gboolean
_cmd_join(gchar **args, struct cmd_help_t help)
{