about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-07-09 20:32:28 +0100
committerJames Booth <boothj5@gmail.com>2014-07-09 20:32:28 +0100
commit2f3234a5f50639911add9a24c32095a92791502e (patch)
tree538d0c3ccc4d57845572d6575ab4fedfa2c21120
parent954661e59e7cfc994c93f08b5b9694286b00adc5 (diff)
downloadprofani-tty-2f3234a5f50639911add9a24c32095a92791502e.tar.gz
Added quote param to autocomplete_param_with_ac
-rw-r--r--src/command/command.c66
-rw-r--r--src/muc.c4
-rw-r--r--src/tools/autocomplete.c4
-rw-r--r--src/tools/autocomplete.h2
4 files changed, 38 insertions, 38 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 8ac8a8c4..fba1dae5 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -1526,7 +1526,7 @@ _cmd_complete_parameters(char *input, int *size)
 
             for (i = 0; i < ARRAY_SIZE(nick_choices); i++) {
                 result = autocomplete_param_with_ac(input, size, nick_choices[i],
-                    nick_ac);
+                    nick_ac, TRUE);
                 if (result != NULL) {
                     ui_replace_input(input, result, size);
                     g_free(result);
@@ -1582,7 +1582,7 @@ _cmd_complete_parameters(char *input, int *size)
     Autocomplete completers[] = { help_ac, prefs_ac, disco_ac, close_ac, wins_ac };
 
     for (i = 0; i < ARRAY_SIZE(cmds); i++) {
-        result = autocomplete_param_with_ac(input, size, cmds[i], completers[i]);
+        result = autocomplete_param_with_ac(input, size, cmds[i], completers[i], TRUE);
         if (result != NULL) {
             ui_replace_input(input, result, size);
             g_free(result);
@@ -1647,7 +1647,7 @@ _sub_autocomplete(char *input, int *size)
     if (result != NULL) {
         return result;
     }
-    result = autocomplete_param_with_ac(input, size, "/sub", sub_ac);
+    result = autocomplete_param_with_ac(input, size, "/sub", sub_ac, TRUE);
     if (result != NULL) {
         return result;
     }
@@ -1671,7 +1671,7 @@ _who_autocomplete(char *input, int *size)
         }
     }
 
-    result = autocomplete_param_with_ac(input, size, "/who", who_ac);
+    result = autocomplete_param_with_ac(input, size, "/who", who_ac, TRUE);
     if (result != NULL) {
         return result;
     }
@@ -1695,7 +1695,7 @@ _roster_autocomplete(char *input, int *size)
     if (result != NULL) {
         return result;
     }
-    result = autocomplete_param_with_ac(input, size, "/roster", roster_ac);
+    result = autocomplete_param_with_ac(input, size, "/roster", roster_ac, TRUE);
     if (result != NULL) {
         return result;
     }
@@ -1728,7 +1728,7 @@ _group_autocomplete(char *input, int *size)
     if (result != NULL) {
         return result;
     }
-    result = autocomplete_param_with_ac(input, size, "/group", group_ac);
+    result = autocomplete_param_with_ac(input, size, "/group", group_ac, TRUE);
     if (result != NULL) {
         return result;
     }
@@ -1787,7 +1787,7 @@ _bookmark_autocomplete(char *input, int *size)
         if (autojoin) {
             found = autocomplete_param_with_func(input, size, beginning->str, prefs_autocomplete_boolean_choice);
         } else {
-            found = autocomplete_param_with_ac(input, size, beginning->str, bookmark_property_ac);
+            found = autocomplete_param_with_ac(input, size, beginning->str, bookmark_property_ac, TRUE);
         }
         g_string_free(beginning, TRUE);
         if (found != NULL) {
@@ -1808,7 +1808,7 @@ _bookmark_autocomplete(char *input, int *size)
         return found;
     }
 
-    found = autocomplete_param_with_ac(input, size, "/bookmark", bookmark_ac);
+    found = autocomplete_param_with_ac(input, size, "/bookmark", bookmark_ac, TRUE);
     return found;
 }
 
@@ -1843,17 +1843,17 @@ _notify_autocomplete(char *input, int *size)
         return result;
     }
 
-    result = autocomplete_param_with_ac(input, size, "/notify room", notify_room_ac);
+    result = autocomplete_param_with_ac(input, size, "/notify room", notify_room_ac, TRUE);
     if (result != NULL) {
         return result;
     }
 
-    result = autocomplete_param_with_ac(input, size, "/notify message", notify_message_ac);
+    result = autocomplete_param_with_ac(input, size, "/notify message", notify_message_ac, TRUE);
     if (result != NULL) {
         return result;
     }
 
-    result = autocomplete_param_with_ac(input, size, "/notify typing", notify_typing_ac);
+    result = autocomplete_param_with_ac(input, size, "/notify typing", notify_typing_ac, TRUE);
     if (result != NULL) {
         return result;
     }
@@ -1867,7 +1867,7 @@ _notify_autocomplete(char *input, int *size)
         }
     }
 
-    result = autocomplete_param_with_ac(input, size, "/notify", notify_ac);
+    result = autocomplete_param_with_ac(input, size, "/notify", notify_ac, TRUE);
     if (result != NULL) {
         return result;
     }
@@ -1880,7 +1880,7 @@ _autoaway_autocomplete(char *input, int *size)
 {
     char *result = NULL;
 
-    result = autocomplete_param_with_ac(input, size, "/autoaway mode", autoaway_mode_ac);
+    result = autocomplete_param_with_ac(input, size, "/autoaway mode", autoaway_mode_ac, TRUE);
     if (result != NULL) {
         return result;
     }
@@ -1889,7 +1889,7 @@ _autoaway_autocomplete(char *input, int *size)
     if (result != NULL) {
         return result;
     }
-    result = autocomplete_param_with_ac(input, size, "/autoaway", autoaway_ac);
+    result = autocomplete_param_with_ac(input, size, "/autoaway", autoaway_ac, TRUE);
     if (result != NULL) {
         return result;
     }
@@ -1912,7 +1912,7 @@ _log_autocomplete(char *input, int *size)
     if (result != NULL) {
         return result;
     }
-    result = autocomplete_param_with_ac(input, size, "/log", log_ac);
+    result = autocomplete_param_with_ac(input, size, "/log", log_ac, TRUE);
     if (result != NULL) {
         return result;
     }
@@ -1930,7 +1930,7 @@ _autoconnect_autocomplete(char *input, int *size)
         return result;
     }
 
-    result = autocomplete_param_with_ac(input, size, "/autoconnect", autoconnect_ac);
+    result = autocomplete_param_with_ac(input, size, "/autoconnect", autoconnect_ac, TRUE);
     if (result != NULL) {
         return result;
     }
@@ -1948,7 +1948,7 @@ _otr_autocomplete(char *input, int *size)
         return found;
     }
 
-    found = autocomplete_param_with_ac(input, size, "/otr log", otr_log_ac);
+    found = autocomplete_param_with_ac(input, size, "/otr log", otr_log_ac, TRUE);
     if (found != NULL) {
         return found;
     }
@@ -1969,7 +1969,7 @@ _otr_autocomplete(char *input, int *size)
         }
     }
 
-    found = autocomplete_param_with_ac(input, size, "/otr policy", otr_policy_ac);
+    found = autocomplete_param_with_ac(input, size, "/otr policy", otr_policy_ac, TRUE);
     if (found != NULL) {
         return found;
     }
@@ -1980,7 +1980,7 @@ _otr_autocomplete(char *input, int *size)
         return found;
     }
 
-    found = autocomplete_param_with_ac(input, size, "/otr", otr_ac);
+    found = autocomplete_param_with_ac(input, size, "/otr", otr_ac, TRUE);
     if (found != NULL) {
         return found;
     }
@@ -2003,12 +2003,12 @@ _theme_autocomplete(char *input, int *size)
             g_slist_free(themes);
             autocomplete_add(theme_load_ac, "default");
         }
-        result = autocomplete_param_with_ac(input, size, "/theme set", theme_load_ac);
+        result = autocomplete_param_with_ac(input, size, "/theme set", theme_load_ac, TRUE);
         if (result != NULL) {
             return result;
         }
     }
-    result = autocomplete_param_with_ac(input, size, "/theme", theme_ac);
+    result = autocomplete_param_with_ac(input, size, "/theme", theme_ac, TRUE);
     if (result != NULL) {
         return result;
     }
@@ -2021,22 +2021,22 @@ _statuses_autocomplete(char *input, int *size)
 {
     char *result = NULL;
 
-    result = autocomplete_param_with_ac(input, size, "/statuses console", statuses_setting_ac);
+    result = autocomplete_param_with_ac(input, size, "/statuses console", statuses_setting_ac, TRUE);
     if (result != NULL) {
         return result;
     }
 
-    result = autocomplete_param_with_ac(input, size, "/statuses chat", statuses_setting_ac);
+    result = autocomplete_param_with_ac(input, size, "/statuses chat", statuses_setting_ac, TRUE);
     if (result != NULL) {
         return result;
     }
 
-    result = autocomplete_param_with_ac(input, size, "/statuses muc", statuses_setting_ac);
+    result = autocomplete_param_with_ac(input, size, "/statuses muc", statuses_setting_ac, TRUE);
     if (result != NULL) {
         return result;
     }
 
-    result = autocomplete_param_with_ac(input, size, "/statuses", statuses_ac);
+    result = autocomplete_param_with_ac(input, size, "/statuses", statuses_ac, TRUE);
     if (result != NULL) {
         return result;
     }
@@ -2049,12 +2049,12 @@ _alias_autocomplete(char *input, int *size)
 {
     char *result = NULL;
 
-    result = autocomplete_param_with_ac(input, size, "/alias remove", aliases_ac);
+    result = autocomplete_param_with_ac(input, size, "/alias remove", aliases_ac, TRUE);
     if (result != NULL) {
         return result;
     }
 
-    result = autocomplete_param_with_ac(input, size, "/alias", alias_ac);
+    result = autocomplete_param_with_ac(input, size, "/alias", alias_ac, TRUE);
     if (result != NULL) {
         return result;
     }
@@ -2080,7 +2080,7 @@ _connect_autocomplete(char *input, int *size)
             g_string_append(beginning, " ");
             g_string_append(beginning, args[2]);
         }
-        found = autocomplete_param_with_ac(input, size, beginning->str, connect_property_ac);
+        found = autocomplete_param_with_ac(input, size, beginning->str, connect_property_ac, TRUE);
         g_string_free(beginning, TRUE);
         if (found != NULL) {
             return found;
@@ -2119,7 +2119,7 @@ _join_autocomplete(char *input, int *size)
             g_string_append(beginning, " ");
             g_string_append(beginning, args[2]);
         }
-        found = autocomplete_param_with_ac(input, size, beginning->str, join_property_ac);
+        found = autocomplete_param_with_ac(input, size, beginning->str, join_property_ac, TRUE);
         g_string_free(beginning, TRUE);
         if (found != NULL) {
             return found;
@@ -2144,13 +2144,13 @@ _account_autocomplete(char *input, int *size)
         if ((g_strv_length(args) > 3) && (g_strcmp0(args[2], "otr")) == 0) {
             g_string_append(beginning, " ");
             g_string_append(beginning, args[2]);
-            found = autocomplete_param_with_ac(input, size, beginning->str, otr_policy_ac);
+            found = autocomplete_param_with_ac(input, size, beginning->str, otr_policy_ac, TRUE);
             g_string_free(beginning, TRUE);
             if (found != NULL) {
                 return found;
             }
         } else {
-            found = autocomplete_param_with_ac(input, size, beginning->str, account_set_ac);
+            found = autocomplete_param_with_ac(input, size, beginning->str, account_set_ac, TRUE);
             g_string_free(beginning, TRUE);
             if (found != NULL) {
                 return found;
@@ -2161,7 +2161,7 @@ _account_autocomplete(char *input, int *size)
     if ((strncmp(input, "/account clear", 14) == 0) && (result == TRUE)) {
         GString *beginning = g_string_new("/account clear ");
         g_string_append(beginning, args[1]);
-        found = autocomplete_param_with_ac(input, size, beginning->str, account_clear_ac);
+        found = autocomplete_param_with_ac(input, size, beginning->str, account_clear_ac, TRUE);
         g_string_free(beginning, TRUE);
         if (found != NULL) {
             return found;
@@ -2182,6 +2182,6 @@ _account_autocomplete(char *input, int *size)
         }
     }
 
-    found = autocomplete_param_with_ac(input, size, "/account", account_ac);
+    found = autocomplete_param_with_ac(input, size, "/account", account_ac, TRUE);
     return found;
 }
diff --git a/src/muc.c b/src/muc.c
index 11d92a50..f84a52c1 100644
--- a/src/muc.c
+++ b/src/muc.c
@@ -578,11 +578,11 @@ muc_autocomplete(char *input, int *size)
         gchar *last_space = g_strrstr(input, " ");
         char *result = NULL;
         if (last_space == NULL) {
-            result = autocomplete_complete(nick_ac, input, TRUE);
+            result = autocomplete_complete(nick_ac, input, FALSE);
         } else {
             int len = (last_space - input);
             char *start_str = strndup(input, len);
-            result = autocomplete_param_with_ac(input, size, start_str, nick_ac);
+            result = autocomplete_param_with_ac(input, size, start_str, nick_ac, FALSE);
             free(start_str);
         }
         if (result != NULL) {
diff --git a/src/tools/autocomplete.c b/src/tools/autocomplete.c
index 288548c8..9a57ddac 100644
--- a/src/tools/autocomplete.c
+++ b/src/tools/autocomplete.c
@@ -220,7 +220,7 @@ autocomplete_param_with_func(char *input, int *size, char *command,
 
 char *
 autocomplete_param_with_ac(char *input, int *size, char *command,
-    Autocomplete ac)
+    Autocomplete ac, gboolean quote)
 {
     GString *auto_msg = NULL;
     char *result = NULL;
@@ -235,7 +235,7 @@ autocomplete_param_with_ac(char *input, int *size, char *command,
         }
         inp_cpy[(*size) - len] = '\0';
 
-        char *found = autocomplete_complete(ac, inp_cpy, TRUE);
+        char *found = autocomplete_complete(ac, inp_cpy, quote);
         if (found != NULL) {
             auto_msg = g_string_new(command_cpy);
             g_string_append(auto_msg, found);
diff --git a/src/tools/autocomplete.h b/src/tools/autocomplete.h
index 6aaa607f..987bc12f 100644
--- a/src/tools/autocomplete.h
+++ b/src/tools/autocomplete.h
@@ -50,7 +50,7 @@ char * autocomplete_param_with_func(char *input, int *size, char *command,
     autocomplete_func func);
 
 char * autocomplete_param_with_ac(char *input, int *size, char *command,
-    Autocomplete ac);
+    Autocomplete ac, gboolean quote);
 
 char * autocomplete_param_no_with_func(char *input, int *size, char *command,
     int arg_number, autocomplete_func func);