From cba17faf3dd9cb845a8f5734a213a7c708e8a05f Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 5 Feb 2018 21:40:32 +0000 Subject: Add /rooms service autocompletion --- src/command/cmd_ac.c | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'src/command/cmd_ac.c') diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c index a0226d31..bb6e9cd6 100644 --- a/src/command/cmd_ac.c +++ b/src/command/cmd_ac.c @@ -940,6 +940,7 @@ cmd_ac_reset(ProfWin *window) } muc_invites_reset_ac(); + muc_confserver_reset_ac(); accounts_reset_all_search(); accounts_reset_enabled_search(); tlscerts_reset_ac(); @@ -3133,17 +3134,21 @@ _rooms_autocomplete(ProfWin *window, const char *const input, gboolean previous) return found; } } - if ((num_args == 1 && g_strcmp0(args[0], "cache") == 0 && space_at_end) || - (num_args == 2 && g_strcmp0(args[0], "cache") == 0)) { - found = autocomplete_param_with_ac(input, "/rooms cache", rooms_cache_ac, TRUE, previous); + if ((num_args == 1 && g_strcmp0(args[0], "service") == 0 && space_at_end) || + (num_args == 2 && g_strcmp0(args[0], "service") == 0 && !space_at_end)) { + found = autocomplete_param_with_func(input, "/rooms service", muc_confserver_find, previous); if (found) { g_strfreev(args); return found; } } - if ((num_args >= 2) && g_strcmp0(args[0], "cache") == 0) { - g_strfreev(args); - return NULL; + if ((num_args == 1 && g_strcmp0(args[0], "cache") == 0 && space_at_end) || + (num_args == 2 && g_strcmp0(args[0], "cache") == 0 && !space_at_end)) { + found = autocomplete_param_with_ac(input, "/rooms cache", rooms_cache_ac, TRUE, previous); + if (found) { + g_strfreev(args); + return found; + } } if ((num_args == 2 && space_at_end) || (num_args == 3 && !space_at_end)) { GString *beginning = g_string_new("/rooms"); @@ -3155,9 +3160,24 @@ _rooms_autocomplete(ProfWin *window, const char *const input, gboolean previous) return found; } } + if ((num_args == 3 && g_strcmp0(args[2], "service") == 0 && space_at_end) || + (num_args == 4 && g_strcmp0(args[2], "service") == 0 && !space_at_end)) { + GString *beginning = g_string_new("/rooms"); + g_string_append_printf(beginning, " %s %s %s", args[0], args[1], args[2]); + found = autocomplete_param_with_func(input, beginning->str, muc_confserver_find, previous); + g_string_free(beginning, TRUE); + if (found) { + g_strfreev(args); + return found; + } + } + if ((num_args >= 2) && g_strcmp0(args[0], "cache") == 0) { + g_strfreev(args); + return NULL; + } } g_strfreev(args); return NULL; -} \ No newline at end of file +} -- cgit 1.4.1-2-gfad0