From: Nathan W. <fac...@us...> - 2005-05-02 04:13:15
|
Update of /cvsroot/gaim/gaim/src/protocols/jabber In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4279/src/protocols/jabber Modified Files: Tag: oldstatus chat.c chat.h presence.c Log Message: jabber stuff, and make the ChangeLog actually reflect reality Index: chat.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/jabber/chat.c,v retrieving revision 1.40.2.3 retrieving revision 1.40.2.4 diff -u -d -p -r1.40.2.3 -r1.40.2.4 --- chat.c 11 Jan 2005 17:27:26 -0000 1.40.2.3 +++ chat.c 2 May 2005 04:13:04 -0000 1.40.2.4 @@ -860,5 +860,50 @@ gboolean jabber_chat_kick_user(JabberCha 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); +} + Index: chat.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/jabber/chat.h,v retrieving revision 1.17 retrieving revision 1.17.2.1 diff -u -d -p -r1.17 -r1.17.2.1 --- chat.h 31 Aug 2004 01:45:08 -0000 1.17 +++ chat.h 2 May 2005 04:13:04 -0000 1.17.2.1 @@ -83,5 +83,7 @@ gboolean jabber_chat_kick_user(JabberCha GaimRoomlist *jabber_roomlist_get_list(GaimConnection *gc); void jabber_roomlist_cancel(GaimRoomlist *list); +void jabber_chat_disco_traffic(JabberChat *chat); + #endif /* _GAIM_JABBER_CHAT_H_ */ Index: presence.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/jabber/presence.c,v retrieving revision 1.56.2.11 retrieving revision 1.56.2.12 diff -u -d -p -r1.56.2.11 -r1.56.2.12 --- presence.c 24 Mar 2005 23:12:27 -0000 1.56.2.11 +++ presence.c 2 May 2005 04:13:04 -0000 1.56.2.12 @@ -433,6 +433,8 @@ void jabber_presence_parse(JabberStream chat->muc = muc; chat->conv = serv_got_joined_chat(js->gc, chat->id, room_jid); gaim_conv_chat_set_nick(GAIM_CONV_CHAT(chat->conv), chat->handle); + + jabber_chat_disco_traffic(chat); } jabber_buddy_track_resource(jb, jid->resource, priority, state, |