pidgin: 9ba255f7: Fetch and track capabilities for MUC mem...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Wed Apr 29 02:11:27 EDT 2009


-----------------------------------------------------------------
Revision: 9ba255f7af2e689ca7a409b0978bc324f31068bd
Ancestor: 5185dfd520b5ad9924dded045aaa0b84ee8a3ef9
Author: darkrain42 at pidgin.im
Date: 2009-04-29T06:06:41
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/9ba255f7af2e689ca7a409b0978bc324f31068bd

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

ChangeLog: 

Fetch and track capabilities for MUC members. Add a further constraint for
fetching that *node && *ver (someone in chat at c.j.o was advertising
<c node="" ver="">).

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/presence.c	d698adbc46de47ac6c5246408413806196420e41
+++ libpurple/protocols/jabber/presence.c	3ca36c3b6cd75ab4f5426ffcb5078dc92596eb78
@@ -778,26 +778,6 @@ void jabber_presence_parse(JabberStream 
 			} else {
 				jbr->idle = 0;
 			}
-
-			if(caps) {
-				/* handle XEP-0115 */
-				const char *node = xmlnode_get_attrib(caps,"node");
-				const char *ver = xmlnode_get_attrib(caps,"ver");
-				const char *hash = xmlnode_get_attrib(caps,"hash");
-				const char *ext = xmlnode_get_attrib(caps,"ext");
-
-				/* v1.3 uses: node, ver, and optionally ext.
-				 * v1.5 uses: node, ver, and hash. */
-				if (node && ver) {
-					JabberPresenceCapabilities *userdata = g_new0(JabberPresenceCapabilities, 1);
-					userdata->js = js;
-					userdata->jb = jb;
-					userdata->from = g_strdup(from);
-					jabber_caps_get_info(js, from, node, ver, hash, ext,
-					    (jabber_caps_get_info_cb)jabber_presence_set_capabilities,
-					    userdata);
-				}
-			}
 		}
 
 		if((found_jbr = jabber_buddy_find_resource(jb, NULL))) {
@@ -809,6 +789,27 @@ void jabber_presence_parse(JabberStream 
 		}
 		g_free(buddy_name);
 	}
+
+	if (caps && (!type || g_str_equal(type, "available"))) {
+		/* handle Entity Capabilities (XEP-0115) */
+		const char *node = xmlnode_get_attrib(caps, "node");
+		const char *ver  = xmlnode_get_attrib(caps, "ver");
+		const char *hash = xmlnode_get_attrib(caps, "hash");
+		const char *ext  = xmlnode_get_attrib(caps, "ext");
+
+		/* v1.3 uses: node, ver, and optionally ext.
+		 * v1.5 uses: node, ver, and hash. */
+		if (node && *node && ver && *ver) {
+			JabberPresenceCapabilities *userdata = g_new0(JabberPresenceCapabilities, 1);
+			userdata->js = js;
+			userdata->jb = jb;
+			userdata->from = g_strdup(from);
+			jabber_caps_get_info(js, from, node, ver, hash, ext,
+			    (jabber_caps_get_info_cb)jabber_presence_set_capabilities,
+			    userdata);
+		}
+	}
+
 	g_free(status);
 	jabber_id_free(jid);
 	g_free(avatar_hash);


More information about the Commits mailing list