about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-04-23 00:01:18 +0100
committerJames Booth <boothj5@gmail.com>2014-04-23 00:01:18 +0100
commit4d8caee483f265c47c2441d6ad0fec94be88876b (patch)
tree95e4b4893c67129121f37754b124b8a91443b00c
parent1a0f12b0e6d7f191f1d765e426dd0d53d411741a (diff)
downloadprofani-tty-4d8caee483f265c47c2441d6ad0fec94be88876b.tar.gz
Added /otr policy autocompletion
-rw-r--r--src/command/command.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 82e53c05..6e884ceb 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -878,6 +878,7 @@ static Autocomplete group_ac;
 static Autocomplete bookmark_ac;
 static Autocomplete otr_ac;
 static Autocomplete otr_log_ac;
+static Autocomplete otr_policy_ac;
 static Autocomplete connect_property_ac;
 static Autocomplete statuses_ac;
 static Autocomplete statuses_setting_ac;
@@ -1066,12 +1067,18 @@ cmd_init(void)
     autocomplete_add(otr_ac, "log");
     autocomplete_add(otr_ac, "warn");
     autocomplete_add(otr_ac, "libver");
+    autocomplete_add(otr_ac, "policy");
 
     otr_log_ac = autocomplete_new();
     autocomplete_add(otr_log_ac, "on");
     autocomplete_add(otr_log_ac, "off");
     autocomplete_add(otr_log_ac, "redact");
 
+    otr_policy_ac = autocomplete_new();
+    autocomplete_add(otr_policy_ac, "manual");
+    autocomplete_add(otr_policy_ac, "opportunistic");
+    autocomplete_add(otr_policy_ac, "always");
+
     connect_property_ac = autocomplete_new();
     autocomplete_add(connect_property_ac, "server");
     autocomplete_add(connect_property_ac, "port");
@@ -1127,6 +1134,7 @@ cmd_uninit(void)
     autocomplete_free(bookmark_ac);
     autocomplete_free(otr_ac);
     autocomplete_free(otr_log_ac);
+    autocomplete_free(otr_policy_ac);
     autocomplete_free(connect_property_ac);
     autocomplete_free(statuses_ac);
     autocomplete_free(statuses_setting_ac);
@@ -1248,6 +1256,7 @@ cmd_reset_autocomplete()
     autocomplete_reset(bookmark_ac);
     autocomplete_reset(otr_ac);
     autocomplete_reset(otr_log_ac);
+    autocomplete_reset(otr_policy_ac);
     autocomplete_reset(connect_property_ac);
     autocomplete_reset(statuses_ac);
     autocomplete_reset(statuses_setting_ac);
@@ -1751,6 +1760,11 @@ _otr_autocomplete(char *input, int *size)
         return result;
     }
 
+    result = autocomplete_param_with_ac(input, size, "/otr policy", otr_policy_ac);
+    if (result != NULL) {
+        return result;
+    }
+
     result = autocomplete_param_with_func(input, size, "/otr warn",
         prefs_autocomplete_boolean_choice);
     if (result != NULL) {