diff options
author | Will Song <incertia9474@gmail.com> | 2015-01-08 10:03:15 -0600 |
---|---|---|
committer | Will Song <incertia9474@gmail.com> | 2015-01-08 10:03:15 -0600 |
commit | 89aaaddfbb0ba818111b3f1faf6c4478545dd3e7 (patch) | |
tree | 0bc639f9a6e205c0dc80e1047071fe9c926b4358 /src | |
parent | f1641f3cf74fb71acbfca5e49d299f6cd786eccf (diff) | |
parent | 4898ed10a45581a98986fed5a2fabe6a6e7a9dab (diff) | |
download | profani-tty-89aaaddfbb0ba818111b3f1faf6c4478545dd3e7.tar.gz |
Merge remote-tracking branch 'upstream/master' into exit-title
Diffstat (limited to 'src')
-rw-r--r-- | src/xmpp/message.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/xmpp/message.c b/src/xmpp/message.c index c1c1ac14..d87c5fb2 100644 --- a/src/xmpp/message.c +++ b/src/xmpp/message.c @@ -73,7 +73,7 @@ message_add_handlers(void) HANDLE(NULL, STANZA_TYPE_ERROR, _message_error_handler); HANDLE(NULL, STANZA_TYPE_GROUPCHAT, _groupchat_handler); - HANDLE(NULL, STANZA_TYPE_CHAT, _chat_handler); + HANDLE(NULL, NULL, _chat_handler); HANDLE(STANZA_NS_MUC_USER, NULL, _muc_user_handler); HANDLE(STANZA_NS_CONFERENCE, NULL, _conference_handler); HANDLE(STANZA_NS_CAPTCHA, NULL, _captcha_handler); @@ -315,7 +315,6 @@ _conference_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, jid_destroy(jidp); - return 1; } @@ -419,8 +418,23 @@ static int _chat_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata) { + // ignore if type not chat or absent + char *type = xmpp_stanza_get_type(stanza); + if (!(g_strcmp0(type, "chat") == 0 || type == NULL)) { + return 1; + } + + // ignore handled namespaces + xmpp_stanza_t *conf = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_CONFERENCE); + xmpp_stanza_t *mucuser = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_MUC_USER); + xmpp_stanza_t *captcha = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_CAPTCHA); + if (conf || mucuser || captcha) { + return 1; + } + xmpp_ctx_t *ctx = connection_get_ctx(); gchar *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM); + Jid *jid = jid_create(from); // private message from chat room use full jid (room/nick) |