libpurple/protocols/jabber/buddy.c

branch
cpw.darkrain42.xmpp.bosh
changeset 24868
f580641e5c84
parent 24827
5e3f3d989002
parent 24825
f928f0d7ac2a
child 24869
7c2d54f2398d
--- a/libpurple/protocols/jabber/buddy.c	Sat Nov 29 18:20:58 2008 +0000
+++ b/libpurple/protocols/jabber/buddy.c	Sat Nov 29 18:41:39 2008 +0000
@@ -180,9 +180,8 @@
 		g_free(cmd);
 		jbr->commands = g_list_delete_link(jbr->commands, jbr->commands);
 	}
-	
-	jabber_caps_free_clientinfo(jbr->caps);
 
+	/* jbr->caps is owned by the caps code */
 	g_free(jbr->name);
 	g_free(jbr->status);
 	g_free(jbr->thread_id);
@@ -497,9 +496,6 @@
 
 void jabber_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img)
 {
-	PurplePresence *gpresence;
-	PurpleStatus *status;
-	
 	if(((JabberStream*)gc->proto_data)->pep) {
 		/* XEP-0084: User Avatars */
 		if(img) {
@@ -629,9 +625,7 @@
 	/* publish vCard for those poor older clients */
 	jabber_set_info(gc, purple_account_get_user_info(gc->account));
 
-	gpresence = purple_account_get_presence(gc->account);
-	status = purple_presence_get_active_status(gpresence);
-	jabber_presence_send(gc->account, status);
+	jabber_presence_send(gc->proto_data, FALSE);
 }
 
 /*
@@ -2505,7 +2499,7 @@
 gboolean
 jabber_resource_has_capability(const JabberBuddyResource *jbr, const gchar *cap)
 {
-	const GList *iter = NULL;
+	const GList *node = NULL;
 
 	if (!jbr->caps) {
 		purple_debug_error("jabber",
@@ -2513,15 +2507,14 @@
 		return FALSE;
 	}
 
-	for (iter = jbr->caps->features ; iter ; iter = g_list_next(iter)) {
-		if (strcmp(iter->data, cap) == 0) {
-			purple_debug_info("jabber", "Found cap: %s\n", (char *)iter->data);
-			return TRUE;
-		}
-	}
+	node = g_list_find_custom(jbr->caps->features, cap, (GCompareFunc)strcmp);
+	/* TODO: Are these messages actually useful? */
+	if (node)
+		purple_debug_info("jabber", "Found cap: %s\n", cap);
+	else
+		purple_debug_info("jabber", "Cap %s not found\n", cap); 
 
-	purple_debug_info("jabber", "Cap %s not found\n", cap);
-	return FALSE;
+	return (node != NULL);
 }
 
 gboolean

mercurial