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

added support of captcha in a MUC

This commit is contained in:
Dmitry Podgorny 2013-06-09 16:05:37 +03:00
parent f7dc09efc3
commit c84cb17bd4
2 changed files with 13 additions and 0 deletions

View File

@ -184,6 +184,7 @@ _conference_message_handler(xmpp_conn_t * const conn,
{
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;
@ -235,6 +236,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"