about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-02-17 02:10:56 +0000
committerJames Booth <boothj5@gmail.com>2013-02-17 02:10:56 +0000
commitbced3d4b36c2080b6dee2c2aa14b64c8cf405cc5 (patch)
tree96aeb660a422139f6524842cb68e1309176e80e9 /src/command
parent44d2f8da7a235997049bac68fea746682ae49e9f (diff)
downloadprofani-tty-bced3d4b36c2080b6dee2c2aa14b64c8cf405cc5.tar.gz
Added autocomplete for /software command
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 58868334..6dd6b46e 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -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",
@@ -1939,6 +1951,27 @@ _cmd_caps(gchar **args, struct cmd_help_t help)
 }
 
 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)
 {
     jabber_conn_status_t conn_status = jabber_get_connection_status();