about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2020-05-24 17:43:04 +0200
committerMichael Vetter <jubalh@iodoru.org>2020-05-24 17:55:15 +0200
commitf6799029dbec5bc2b306e1154104ec971f56e4d8 (patch)
tree6b8dd365aa2467ef735c00893e31e442175faca4
parentbe4a6cac78d9f9bd41a55985945446d60fde3a76 (diff)
downloadprofani-tty-f6799029dbec5bc2b306e1154104ec971f56e4d8.tar.gz
Add `/bookmark ignore` autocompletion
Regards https://github.com/profanity-im/profanity/issues/1115
-rw-r--r--src/command/cmd_ac.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index 8c6117b0..94081510 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -180,6 +180,7 @@ static Autocomplete roster_private_ac;
 static Autocomplete group_ac;
 static Autocomplete bookmark_ac;
 static Autocomplete bookmark_property_ac;
+static Autocomplete bookmark_ignore_ac;
 #ifdef HAVE_LIBOTR
 static Autocomplete otr_ac;
 static Autocomplete otr_log_ac;
@@ -610,6 +611,7 @@ cmd_ac_init(void)
     autocomplete_add(bookmark_ac, "remove");
     autocomplete_add(bookmark_ac, "join");
     autocomplete_add(bookmark_ac, "invites");
+    autocomplete_add(bookmark_ac, "ignore");
 
     bookmark_property_ac = autocomplete_new();
     autocomplete_add(bookmark_property_ac, "nick");
@@ -617,6 +619,10 @@ cmd_ac_init(void)
     autocomplete_add(bookmark_property_ac, "autojoin");
     autocomplete_add(bookmark_property_ac, "name");
 
+    bookmark_ignore_ac = autocomplete_new();
+    autocomplete_add(bookmark_ignore_ac, "add");
+    autocomplete_add(bookmark_ignore_ac, "remove");
+
 #ifdef HAVE_LIBOTR
     otr_ac = autocomplete_new();
     autocomplete_add(otr_ac, "gen");
@@ -1242,6 +1248,7 @@ cmd_ac_reset(ProfWin *window)
     autocomplete_reset(wintitle_ac);
     autocomplete_reset(bookmark_ac);
     autocomplete_reset(bookmark_property_ac);
+    autocomplete_reset(bookmark_ignore_ac);
 #ifdef HAVE_LIBOTR
     autocomplete_reset(otr_ac);
     autocomplete_reset(otr_log_ac);
@@ -1397,6 +1404,7 @@ cmd_ac_uninit(void)
     autocomplete_free(group_ac);
     autocomplete_free(bookmark_ac);
     autocomplete_free(bookmark_property_ac);
+    autocomplete_free(bookmark_ignore_ac);
 #ifdef HAVE_LIBOTR
     autocomplete_free(otr_ac);
     autocomplete_free(otr_log_ac);
@@ -2136,6 +2144,19 @@ _bookmark_autocomplete(ProfWin *window, const char *const input, gboolean previo
         return found;
     }
 
+    found = autocomplete_param_with_ac(input, "/bookmark ignore", bookmark_ignore_ac, TRUE, previous);
+    if (found) {
+        return found;
+    }
+    found = autocomplete_param_with_func(input, "/bookmark ignore add", bookmark_find, previous, NULL);
+    if (found) {
+        return found;
+    }
+    found = autocomplete_param_with_func(input, "/bookmark ignore remove", bookmark_find, previous, NULL);
+    if (found) {
+        return found;
+    }
+
     found = autocomplete_param_with_ac(input, "/bookmark", bookmark_ac, TRUE, previous);
     return found;
 }