cpw.darkrain42.xmpp.roster: e5329975: jabber: Require server to explicitly adv...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sun Apr 4 20:40:42 EDT 2010


-----------------------------------------------------------------
Revision: e532997536e8713c32ea164716299e4ca78c2e81
Ancestor: f51f384c6f3724c1a7dd3f2d75db48f508426479
Author: darkrain42 at pidgin.im
Date: 2010-04-05T00:36:33
Branch: im.pidgin.cpw.darkrain42.xmpp.roster
URL: http://d.pidgin.im/viewmtn/revision/info/e532997536e8713c32ea164716299e4ca78c2e81

Modified files:
        libpurple/protocols/jabber/roster.c

ChangeLog: 

jabber: Require server to explicitly advertise the feature.

This was a change in the spec revealed by Facebook's server choking
on this attribute on the roster request.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/roster.c	c990ce6c735e517ca7bea9141558a7492ae2045b
+++ libpurple/protocols/jabber/roster.c	50b5a05652603b6032b523e5bafd1080dc8e333f
@@ -86,8 +86,10 @@ void jabber_roster_request(JabberStream 
 
 	iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:roster");
 	query = xmlnode_get_child(iq->node, "query");
-	xmlnode_set_attrib(query, "ver", ver);
 
+	if (js->server_caps & JABBER_CAP_ROSTER_VERSIONING)
+		xmlnode_set_attrib(query, "ver", ver);
+
 	if (js->server_caps & JABBER_CAP_GOOGLE_ROSTER) {
 		xmlnode_set_attrib(query, "xmlns:gr", NS_GOOGLE_ROSTER);
 		xmlnode_set_attrib(query, "gr:ext", "2");
@@ -202,9 +204,6 @@ void jabber_roster_parse(JabberStream *j
                          JabberIqType type, const char *id, xmlnode *query)
 {
 	xmlnode *item, *group;
-#if 0
-	const char *ver;
-#endif
 
 	if (!jabber_is_own_account(js, from)) {
 		purple_debug_warning("jabber", "Received bogon roster push from %s\n",
@@ -281,10 +280,12 @@ void jabber_roster_parse(JabberStream *j
 	}
 
 #if 0
-	ver = xmlnode_get_attrib(query, "ver");
-	if (ver) {
-		 PurpleAccount *account = purple_connection_get_account(js->gc);
-		 purple_account_set_string(account, "roster_ver", ver);
+	if (js->server_caps & JABBER_CAP_ROSTER_VERSIONING) {
+		const char *ver = xmlnode_get_attrib(query, "ver");
+		if (ver) {
+			PurpleAccount *account = purple_connection_get_account(js->gc);
+			purple_account_set_string(account, "roster_ver", ver);
+		}
 	}
 #endif
 


More information about the Commits mailing list