cpw.darkrain42.roster: e13a9adf: Use js->state to track whether the roste...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sun Jun 7 02:25:44 EDT 2009


-----------------------------------------------------------------
Revision: e13a9adfb5cfaadc61d615911babc67fcdb332ac
Ancestor: d091729988805684afa360dc1f96ed46cd10e080
Author: darkrain42 at pidgin.im
Date: 2009-06-07T05:36:45
Branch: im.pidgin.cpw.darkrain42.roster
URL: http://d.pidgin.im/viewmtn/revision/info/e13a9adfb5cfaadc61d615911babc67fcdb332ac

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

ChangeLog: 

Use js->state to track whether the roster has been retrieved.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jabber.c	1bc54bcc611846f5b3edc84ba8ebc1f4274a1271
+++ libpurple/protocols/jabber/jabber.c	6d75eefad859fe70d94afedf483ce0272e4ddb6c
@@ -1613,7 +1613,8 @@ void jabber_stream_set_state(JabberStrea
 
 			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;
 	}
============================================================
--- libpurple/protocols/jabber/jabber.h	68f4a86b04521eecd98908f31c949aaae27511e7
+++ libpurple/protocols/jabber/jabber.h	84a7cfcfe872e46c6c6ca1115a7a718e533f4e15
@@ -116,7 +116,6 @@ struct _JabberStream
 	char *expected_rspauth;
 
 	GHashTable *buddies;
-	gboolean roster_parsed;
 
 	/*
 	 * This boolean was added to eliminate a heinous bug where we would
============================================================
--- libpurple/protocols/jabber/presence.c	8e84724e28ac7953a70cd3b572f8e439984406a7
+++ libpurple/protocols/jabber/presence.c	662161ab470b3230414ef616c1fc97676e0dcf81
@@ -133,7 +133,7 @@ void jabber_presence_send(JabberStream *
 	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;
 	}
============================================================
--- libpurple/protocols/jabber/roster.c	7e18333bfd21f177232eb51d613dc941f93cbb6f
+++ libpurple/protocols/jabber/roster.c	49ffaa61edfb406efef23bf4ecf4b5bd297a7be5
@@ -244,13 +244,10 @@ void jabber_roster_parse(JabberStream *j
 	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 @@ void jabber_roster_add_buddy(PurpleConne
 	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);


More information about the Commits mailing list