cpw.darkrain42.roster: 31cd08b6: Pass around a copy of our bare JID

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sun Jun 21 18:20:35 EDT 2009


-----------------------------------------------------------------
Revision: 31cd08b695486b425c3178512fe9474a4bf53943
Ancestor: 192cf9a4c78719d100adffeb17cb30bfbc2040df
Author: darkrain42 at pidgin.im
Date: 2009-06-10T03:58:11
Branch: im.pidgin.cpw.darkrain42.roster
URL: http://d.pidgin.im/viewmtn/revision/info/31cd08b695486b425c3178512fe9474a4bf53943

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

ChangeLog: 

Pass around a copy of our bare JID

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/roster.c	f25e5dead825b0a80c435360dad4d46335a5c5c1
+++ libpurple/protocols/jabber/roster.c	becd141095c32132af66d96f091a57c959223b83
@@ -53,10 +53,9 @@ static void add_purple_buddy_to_groups(J
 }
 
 static void add_purple_buddy_to_groups(JabberStream *js, const char *jid,
-		const char *alias, GSList *groups)
+		const char *alias, GSList *groups, const char *own_jid)
 {
 	GSList *buddies, *l;
-	gchar *my_bare_jid;
 	GList *pool = NULL;
 
 	buddies = purple_find_buddies(js->gc->account, jid);
@@ -74,8 +73,6 @@ static void add_purple_buddy_to_groups(J
 		}
 	}
 
-	my_bare_jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain);
-
 	while(buddies) {
 		PurpleBuddy *b = buddies->data;
 		PurpleGroup *g = purple_buddy_get_group(b);
@@ -132,7 +129,7 @@ static void add_purple_buddy_to_groups(J
 		/* If we just learned about ourself, then fake our status,
 		 * because we won't be receiving a normal presence message
 		 * about ourself. */
-		if(!strcmp(purple_buddy_get_name(b), my_bare_jid))
+		if(!strcmp(purple_buddy_get_name(b), own_jid))
 			jabber_presence_fake_to_self(js, NULL);
 
 		g_free(groups->data);
@@ -147,7 +144,6 @@ static void add_purple_buddy_to_groups(J
 		pool = g_list_delete_link(pool, pool);
 	}
 
-	g_free(my_bare_jid);
 	g_slist_free(buddies);
 }
 
@@ -228,7 +224,7 @@ void jabber_roster_parse(JabberStream *j
 				groups = g_slist_prepend(groups, group_name);
 			}
 
-			add_purple_buddy_to_groups(js, jid, name, groups);
+			add_purple_buddy_to_groups(js, jid, name, groups, own_jid);
 		}
 	}
 
@@ -328,7 +324,7 @@ void jabber_roster_add_buddy(PurpleConne
 	char *who;
 	JabberBuddy *jb;
 	JabberBuddyResource *jbr;
-	char *my_bare_jid;
+	char *own_jid;
 	const char *name;
 
 	/* If we haven't received the roster yet, ignore any adds */
@@ -346,8 +342,8 @@ void jabber_roster_add_buddy(PurpleConne
 
 	jabber_roster_update(js, who, NULL);
 
-	my_bare_jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain);
-	if(!strcmp(who, my_bare_jid)) {
+	own_jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain);
+	if (g_str_equal(who, own_jid)) {
 		jabber_presence_fake_to_self(js, NULL);
 	} else if(!jb || !(jb->subscription & JABBER_SUB_TO)) {
 		jabber_presence_subscription_set(js, who, "subscribe");
@@ -357,7 +353,7 @@ void jabber_roster_add_buddy(PurpleConne
 				"priority", jbr->priority, jbr->status ? "message" : NULL, jbr->status, NULL);
 	}
 
-	g_free(my_bare_jid);
+	g_free(own_jid);
 	g_free(who);
 }
 


More information about the Commits mailing list