changeset 27495:c8390dc125c1

Use js->state to track whether the roster has been retrieved.
author Paul Aurich <paul@darkrain42.org>
date Sun, 07 Jun 2009 05:36:45 +0000
parents 93a41017dca9
children e3c2c3e72d7a
files libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/jabber.h libpurple/protocols/jabber/presence.c libpurple/protocols/jabber/roster.c
diffstat 4 files changed, 8 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Sun Jun 07 00:16:05 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Sun Jun 07 05:36:45 2009 +0000
@@ -1613,7 +1613,8 @@
 
 			break;
 		case JABBER_STREAM_CONNECTED:
-			/* now we can alert the core that we're ready to send status */
+			/* Send initial presence */
+			jabber_presence_send(js, TRUE);
 			purple_connection_set_state(js->gc, PURPLE_CONNECTED);
 			break;
 	}
--- a/libpurple/protocols/jabber/jabber.h	Sun Jun 07 00:16:05 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.h	Sun Jun 07 05:36:45 2009 +0000
@@ -116,7 +116,6 @@
 	char *expected_rspauth;
 
 	GHashTable *buddies;
-	gboolean roster_parsed;
 
 	/*
 	 * This boolean was added to eliminate a heinous bug where we would
--- a/libpurple/protocols/jabber/presence.c	Sun Jun 07 00:16:05 2009 +0000
+++ b/libpurple/protocols/jabber/presence.c	Sun Jun 07 05:36:45 2009 +0000
@@ -133,7 +133,7 @@
 	status = purple_presence_get_active_status(p);
 
 	/* we don't want to send presence before we've gotten our roster */
-	if(!js->roster_parsed) {
+	if (js->state != JABBER_STREAM_CONNECTED) {
 		purple_debug_info("jabber", "attempt to send presence before roster retrieved\n");
 		return;
 	}
--- a/libpurple/protocols/jabber/roster.c	Sun Jun 07 00:16:05 2009 +0000
+++ b/libpurple/protocols/jabber/roster.c	Sun Jun 07 05:36:45 2009 +0000
@@ -244,13 +244,10 @@
 	js->currently_parsing_roster_push = FALSE;
 
 	/* if we're just now parsing the roster for the first time,
-	 * then now would be the time to declare ourselves connected and
-	 * send our initial presence */
-	if(!js->roster_parsed) {
-		js->roster_parsed = TRUE;
-		jabber_presence_send(js, TRUE);
+	 * then now would be the time to declare ourselves connected.
+	 */
+	if (js->state != JABBER_STREAM_CONNECTED)
 		jabber_stream_set_state(js, JABBER_STREAM_CONNECTED);
-	}
 }
 
 static void jabber_roster_update(JabberStream *js, const char *name,
@@ -342,7 +339,8 @@
 	char *my_bare_jid;
 	const char *name;
 
-	if(!js->roster_parsed)
+	/* If we haven't received the roster yet, ignore any adds */
+	if (js->state != JABBER_STREAM_CONNECTED)
 		return;
 
 	name = purple_buddy_get_name(buddy);