From f6799029dbec5bc2b306e1154104ec971f56e4d8 Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Sun, 24 May 2020 17:43:04 +0200 Subject: [PATCH] Add `/bookmark ignore` autocompletion Regards https://github.com/profanity-im/profanity/issues/1115 --- src/command/cmd_ac.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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; }