diff options
author | James Booth <boothj5@gmail.com> | 2014-09-15 23:28:12 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-09-15 23:28:12 +0100 |
commit | f494faac99958fac8e04834e91f6e8c61984f361 (patch) | |
tree | dc90661b07e6092c3a59d73db233ff9b5a4b4ed2 /src/xmpp/form.c | |
parent | 6b575aa8fced566b6a2dfb5f5a9543363e211390 (diff) | |
download | profani-tty-f494faac99958fac8e04834e91f6e8c61984f361.tar.gz |
Show form fields after updating
Diffstat (limited to 'src/xmpp/form.c')
-rw-r--r-- | src/xmpp/form.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/xmpp/form.c b/src/xmpp/form.c index 66a5a981..a7b9fe0a 100644 --- a/src/xmpp/form.c +++ b/src/xmpp/form.c @@ -593,6 +593,23 @@ _form_field_contains_option(DataForm *form, const char * const tag, char *value) return FALSE; } +static FormField * +_form_get_field_by_tag(DataForm *form, const char * const tag) +{ + char *var = g_hash_table_lookup(form->tag_to_var, tag); + if (var != NULL) { + GSList *curr = form->fields; + while (curr != NULL) { + FormField *field = curr->data; + if (g_strcmp0(field->var, var) == 0) { + return field; + } + curr = g_slist_next(curr); + } + } + return NULL; +} + void form_init_module(void) { @@ -607,4 +624,5 @@ form_init_module(void) form_field_contains_option = _form_field_contains_option; form_tag_exists = _form_tag_exists; form_get_value_count = _form_get_value_count; + form_get_field_by_tag = _form_get_field_by_tag; } |