diff options
Diffstat (limited to 'src/xmpp')
-rw-r--r-- | src/xmpp/iq.c | 21 | ||||
-rw-r--r-- | src/xmpp/stanza.h | 11 | ||||
-rw-r--r-- | src/xmpp/xmpp.h | 10 |
3 files changed, 31 insertions, 11 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; diff --git a/src/xmpp/stanza.h b/src/xmpp/stanza.h index ea8e0cdb..b13c2960 100644 --- a/src/xmpp/stanza.h +++ b/src/xmpp/stanza.h @@ -36,6 +36,7 @@ #define XMPP_STANZA_H #include <strophe.h> +#include <xmpp/xmpp.h> #define STANZA_NAME_ACTIVE "active" #define STANZA_NAME_INACTIVE "inactive" @@ -154,16 +155,6 @@ #define STANZA_DATAFORM_SOFTWARE "urn:xmpp:dataforms:softwareinfo" -typedef struct form_field_t { - char *var; - GSList *values; -} FormField; - -typedef struct data_form_t { - char *form_type; - GSList *fields; -} DataForm; - xmpp_stanza_t* stanza_create_bookmarks_storage_request(xmpp_ctx_t *ctx); xmpp_stanza_t* stanza_create_chat_state(xmpp_ctx_t *ctx, diff --git a/src/xmpp/xmpp.h b/src/xmpp/xmpp.h index c1060c69..38fde49f 100644 --- a/src/xmpp/xmpp.h +++ b/src/xmpp/xmpp.h @@ -86,6 +86,16 @@ typedef struct disco_identity_t { char *category; } DiscoIdentity; +typedef struct form_field_t { + char *var; + GSList *values; +} FormField; + +typedef struct data_form_t { + char *form_type; + GSList *fields; +} DataForm; + void jabber_init_module(void); void bookmark_init_module(void); void capabilities_init_module(void); |