changeset 18124:f88c2a41200d

fix inital presence (fixes #1395)
author Nathan Walp <nwalp@pidgin.im>
date Sun, 17 Jun 2007 04:50:18 +0000
parents ca965dfd3875
children af0b9c6cbeb8
files libpurple/protocols/jabber/buddy.c libpurple/protocols/jabber/disco.c libpurple/protocols/jabber/roster.c
diffstat 3 files changed, 10 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/buddy.c	Sun Jun 17 04:44:03 2007 +0000
+++ b/libpurple/protocols/jabber/buddy.c	Sun Jun 17 04:50:18 2007 +0000
@@ -443,14 +443,9 @@
 
 void jabber_set_buddy_icon(PurpleConnection *gc, PurpleStoredImage *img)
 {
-	PurplePresence *gpresence;
-	PurpleStatus *status;
-
 	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->account, NULL);
 }
 
 /*
--- a/libpurple/protocols/jabber/disco.c	Sun Jun 17 04:44:03 2007 +0000
+++ b/libpurple/protocols/jabber/disco.c	Sun Jun 17 04:50:18 2007 +0000
@@ -226,10 +226,7 @@
 		jabber_roster_request(js);
 	}
 
-	/* Send initial presence; this will trigger receipt of presence for contacts on the roster */
-	gpresence = purple_account_get_presence(js->gc->account);
-	status = purple_presence_get_active_status(gpresence);
-	jabber_presence_send(js->gc->account, status);
+	/* when we get the roster back, we'll send our initial presence */
 }
 
 static void
--- a/libpurple/protocols/jabber/roster.c	Sun Jun 17 04:44:03 2007 +0000
+++ b/libpurple/protocols/jabber/roster.c	Sun Jun 17 04:50:18 2007 +0000
@@ -153,8 +153,6 @@
 	if(!query)
 		return;
 
-	js->roster_parsed = TRUE;
-
 	for(item = xmlnode_get_child(query, "item"); item; item = xmlnode_get_next_twin(item))
 	{
 		const char *jid, *name, *subscription, *ask;
@@ -232,6 +230,14 @@
 			add_purple_buddies_to_groups(js, jid, name, groups);
 		}
 	}
+
+	/* if we're just now parsing the roster for the first time,
+	 * then now would be the time to send our initial presence */
+	if(!js->roster_parsed) {
+		js->roster_parsed = TRUE;
+
+		jabber_presence_send(js->gc->account, NULL);
+	}
 }
 
 static void jabber_roster_update(JabberStream *js, const char *name,