1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Merge remote-tracking branch 'dmitry/captcha-2' into captcha

This commit is contained in:
James Booth 2013-06-16 18:58:18 +01:00
commit 96496ca219
2 changed files with 13 additions and 0 deletions

View File

@ -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;

View File

@ -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"