about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-01-18 23:43:13 +0000
committerJames Booth <boothj5@gmail.com>2014-01-18 23:43:13 +0000
commitb32ba75db5ea16ef3458139332f464af4de23040 (patch)
tree9908967da216ab44f6663216bf5a91af38fb2e45
parent168cb0e5578ddbde9bd3f956d7e2ed210978f0a7 (diff)
downloadprofani-tty-b32ba75db5ea16ef3458139332f464af4de23040.tar.gz
Implemented autocomplete for /connect properties
-rw-r--r--src/command/command.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/command/command.c b/src/command/command.c
index f3c19955..0d00a3e8 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -1639,18 +1639,24 @@ _connect_autocomplete(char *input, int *size)
 {
     char *result = NULL;
 
-//    input[*size] = '\0';
-//    gchar **args = parse_args(input, 3, 3);
-
-//    if ((strncmp(input, "/account set", 12) == 0) && (args != NULL)) {
-//        GString *beginning = g_string_new("/account set ");
-//        g_string_append(beginning, args[1]);
-//        result = autocomplete_param_with_ac(input, size, beginning->str, account_set_ac);
-//        g_string_free(beginning, TRUE);
-//        if (result != NULL) {
-//            return result;
-//        }
-//    }
+    input[*size] = '\0';
+    gchar **args = parse_args(input, 2, 4);
+
+    if ((strncmp(input, "/connect", 8) == 0) && (args != NULL)) {
+        GString *beginning = g_string_new("/connect ");
+        g_string_append(beginning, args[0]);
+        if (args[1] != NULL && args[2] != NULL) {
+            g_string_append(beginning, " ");
+            g_string_append(beginning, args[1]);
+            g_string_append(beginning, " ");
+            g_string_append(beginning, args[2]);
+        }
+        result = autocomplete_param_with_ac(input, size, beginning->str, connect_property_ac);
+        g_string_free(beginning, TRUE);
+        if (result != NULL) {
+            return result;
+        }
+    }
 
     result = autocomplete_param_with_func(input, size, "/connect", accounts_find_enabled);
     if (result != NULL) {