Mercurial > pidgin
diff src/protocols/jabber/chat.c @ 10941:cef48e318125
[gaim-migrate @ 12731]
sick of having my tree be so far out of sync...here's all my jabber stuff
most notable is the "iChat" buddy icon support
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Thu, 26 May 2005 04:13:06 +0000 |
parents | c4cb90065e1d |
children | b6cafdeda2a8 |
line wrap: on
line diff
--- a/src/protocols/jabber/chat.c Thu May 26 03:54:25 2005 +0000 +++ b/src/protocols/jabber/chat.c Thu May 26 04:13:06 2005 +0000 @@ -883,5 +883,50 @@ return TRUE; } +static void jabber_chat_disco_traffic_cb(JabberStream *js, xmlnode *packet, gpointer data) +{ + JabberChat *chat; + xmlnode *query, *x, *error; + int id = GPOINTER_TO_INT(data); + + if(!(chat = jabber_chat_find_by_id(js, id))) + return; + + if((error = xmlnode_get_child(packet, "error"))) { + /* defaults, in case the conference server doesn't + * support this request */ + chat->xhtml = TRUE; + return; + } + + if(!(query = xmlnode_get_child(packet, "query"))) + return; + + for(x = xmlnode_get_child(query, "feature"); x; x = xmlnode_get_next_twin(x)) { + const char *var = xmlnode_get_attrib(x, "var"); + + if(var && !strcmp(var, "http://jabber.org/protocol/xhtml-im")) { + chat->xhtml = TRUE; + } + } +} + +void jabber_chat_disco_traffic(JabberChat *chat) +{ + JabberIq *iq; + xmlnode *query; + + iq = jabber_iq_new_query(chat->js, JABBER_IQ_GET, + "http://jabber.org/protocol/disco#info"); + + query = xmlnode_get_child(iq->node, "query"); + + xmlnode_set_attrib(query, "node", "http://jabber.org/protocol/muc#traffic"); + + jabber_iq_set_callback(iq, jabber_chat_disco_traffic_cb, GINT_TO_POINTER(chat->id)); + + jabber_iq_send(iq); +} +