diff --git a/src/xmpp/message.c b/src/xmpp/message.c index 29a7cd98..1111d6f5 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -185,6 +185,7 @@ _conference_message_handler(xmpp_conn_t * const conn, xmpp_ctx_t *ctx = connection_get_ctx(); xmpp_stanza_t *x_muc = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_MUC_USER); xmpp_stanza_t *x_groupchat = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_CONFERENCE); + xmpp_stanza_t *captcha = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_CAPTCHA); char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); char *room = NULL; char *invitor = NULL; @@ -239,6 +240,17 @@ _conference_message_handler(xmpp_conn_t * const conn, prof_handle_room_invite(INVITE_DIRECT, invitor, room, reason); jid_destroy(jidp); + + // XEP-0158 + } else if (captcha != NULL) { + xmpp_stanza_t *body = xmpp_stanza_get_child_by_name(stanza, STANZA_NAME_BODY); + if (body != NULL) { + char *message = xmpp_stanza_get_text(body); + if (message != NULL) { + prof_handle_room_broadcast(from, message); + xmpp_free(ctx, message); + } + } } return 1; diff --git a/src/xmpp/stanza.h b/src/xmpp/stanza.h index b35486e8..d1f55890 100644 --- a/src/xmpp/stanza.h +++ b/src/xmpp/stanza.h @@ -99,6 +99,7 @@ #define STANZA_NS_DATA "jabber:x:data" #define STANZA_NS_VERSION "jabber:iq:version" #define STANZA_NS_CONFERENCE "jabber:x:conference" +#define STANZA_NS_CAPTCHA "urn:xmpp:captcha" #define STANZA_DATAFORM_SOFTWARE "urn:xmpp:dataforms:softwareinfo"