diff options
author | James Booth <boothj5@gmail.com> | 2014-09-04 23:15:51 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-09-04 23:15:51 +0100 |
commit | 5e1023dfd98c0d978958d1763ced483fa2e53ce2 (patch) | |
tree | 795c26f9bb99c7e59c3efe6d0fb85f0a594fa9ad /src/xmpp/iq.c | |
parent | 763356464ad35b3d6823341604eeefffec741584 (diff) | |
download | profani-tty-5e1023dfd98c0d978958d1763ced483fa2e53ce2.tar.gz |
Parse data form for room configuration
Diffstat (limited to 'src/xmpp/iq.c')
-rw-r--r-- | src/xmpp/iq.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/xmpp/iq.c b/src/xmpp/iq.c index 5c954b53..ab3a29a0 100644 --- a/src/xmpp/iq.c +++ b/src/xmpp/iq.c @@ -592,10 +592,29 @@ _room_config_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, log_error("No from attribute for IQ destroy room result"); } else { // get form + xmpp_stanza_t *query = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_QUERY); + if (query == NULL) { + log_error("No query element found parsing room config response"); + handle_room_configuration_form_error(); + return 0; + } + xmpp_stanza_t *x = xmpp_stanza_get_child_by_ns(query, STANZA_NS_DATA); + if (x == NULL) { + log_error("No x element found with %s namespace parsing room config response", STANZA_NS_DATA); + handle_room_configuration_form_error(); + return 0; + } + char *type = xmpp_stanza_get_attribute(x, STANZA_ATTR_TYPE); + if (g_strcmp0(type, "form") != 0) { + log_error("x element not of type 'form' parsing room config response"); + handle_room_configuration_form_error(); + return 0; + } -// handle_room_configure(from); + DataForm *form = stanza_create_form(x); + handle_room_configure(from, form); } return 0; |