diff options
-rw-r--r-- | src/command/command.c | 13 | ||||
-rw-r--r-- | src/xmpp/form.c | 2 | ||||
-rw-r--r-- | tests/test_form.c | 1 |
3 files changed, 13 insertions, 3 deletions
diff --git a/src/command/command.c b/src/command/command.c index 4c245c87..68df1cc7 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -2128,7 +2128,7 @@ _form_autocomplete(char *input, int *size) form_field_type_t field_type = form_get_field_type(form, tag); // handle boolean (set) - if ((g_strcmp0(args[0], "set") == 0) && field_type == FIELD_BOOLEAN) { + if ((g_strcmp0(args[0], "set") == 0) && field_type == FIELD_BOOLEAN) { found = autocomplete_param_with_func(input, size, beginning->str, prefs_autocomplete_boolean_choice); g_string_free(beginning, TRUE); @@ -2138,7 +2138,7 @@ _form_autocomplete(char *input, int *size) } // handle list-single (set) - if ((g_strcmp0(args[0], "set") == 0) && field_type == FIELD_LIST_SINGLE) { + if ((g_strcmp0(args[0], "set") == 0) && field_type == FIELD_LIST_SINGLE) { Autocomplete ac = form_get_value_ac(form, tag); found = autocomplete_param_with_ac(input, size, beginning->str, ac, TRUE); g_string_free(beginning, TRUE); @@ -2148,6 +2148,15 @@ _form_autocomplete(char *input, int *size) } // handle list-multi (add, remove) + if (((g_strcmp0(args[0], "set") == 0) || (g_strcmp0(args[0], "remove") == 0)) + && field_type == FIELD_LIST_MULTI) { + Autocomplete ac = form_get_value_ac(form, tag); + found = autocomplete_param_with_ac(input, size, beginning->str, ac, TRUE); + g_string_free(beginning, TRUE); + if (found != NULL) { + return found; + } + } // handle text-multi (remove) diff --git a/src/xmpp/form.c b/src/xmpp/form.c index 3b37f204..21382e06 100644 --- a/src/xmpp/form.c +++ b/src/xmpp/form.c @@ -242,7 +242,7 @@ form_create(xmpp_stanza_t * const form_stanza) option->label = _get_attr(field_child, "label"); option->value = _get_property(field_child, "value"); - if (field->type_t == FIELD_LIST_SINGLE) { + if ((field->type_t == FIELD_LIST_SINGLE) || (field->type_t == FIELD_LIST_MULTI)) { autocomplete_add(field->value_ac, option->value); } diff --git a/tests/test_form.c b/tests/test_form.c index d358736d..6f44c389 100644 --- a/tests/test_form.c +++ b/tests/test_form.c @@ -39,6 +39,7 @@ _new_field(void) field->options = NULL; field->var = NULL; field->values = NULL; + field->value_ac = NULL; return field; |