1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Dont check for var attribute on form fields of type fixed

This commit is contained in:
James Booth 2014-09-30 20:44:00 +01:00
parent 780a3f1cc7
commit fbeb107cbe
3 changed files with 58 additions and 51 deletions

5
.gitignore vendored
View File

@ -54,3 +54,8 @@ Profanity.workspace
pageing.txt
cppcheck.out
gitpushall.sh
Debug/
compile_commands.json
profanity.mk
profanity.project
profanity.workspace

View File

@ -2041,7 +2041,7 @@ _ui_show_form(ProfWin *window, const char * const room, DataForm *form)
while (curr_field != NULL) {
FormField *field = curr_field->data;
if (g_strcmp0(field->type, "hidden") != 0) {
if (g_strcmp0(field->type, "hidden") != 0 && field->var) {
char *tag = g_hash_table_lookup(form->var_to_tag, field->var);
_ui_handle_form_field(window, tag, field);
}

View File

@ -211,7 +211,7 @@ form_create(xmpp_stanza_t * const form_stanza)
field->var = _get_attr(field_stanza, "var");
if (field->type_t != FIELD_HIDDEN) {
if (field->type_t != FIELD_HIDDEN && field->var != NULL) {
GString *tag = g_string_new("");
g_string_printf(tag, "field%d", tag_num++);
g_hash_table_insert(form->var_to_tag, strdup(field->var), strdup(tag->str));
@ -287,6 +287,7 @@ form_create_submission(DataForm *form)
while (curr_field) {
FormField *field = curr_field->data;
if (field->type_t != FIELD_FIXED) {
xmpp_stanza_t *field_stanza = xmpp_stanza_new(ctx);
xmpp_stanza_set_name(field_stanza, "field");
xmpp_stanza_set_attribute(field_stanza, "var", field->var);
@ -296,7 +297,6 @@ form_create_submission(DataForm *form)
switch (field->type_t) {
case FIELD_HIDDEN:
case FIELD_FIXED:
case FIELD_TEXT_SINGLE:
case FIELD_TEXT_PRIVATE:
case FIELD_BOOLEAN:
@ -339,12 +339,14 @@ form_create_submission(DataForm *form)
curr_value = g_slist_next(curr_value);
}
break;
case FIELD_FIXED:
default:
break;
}
xmpp_stanza_add_child(x, field_stanza);
xmpp_stanza_release(field_stanza);
}
curr_field = g_slist_next(curr_field);
}