changeset 13925:60f39c405dff

[gaim-migrate @ 16442] It is currently possible for yourself to not show up in your own buddy list at signon with Jabber. To reproduce: 1. Sign on and add yourself to your buddy list 2. Sign off and exit Gaim 3. Delete your blist.xml 4. Sign on The same bug would also appear when signing into your Jabber account using Gaim for the first time. Normally this works because the Jabber PRPL fakes showing your status whenever jabber_presence_send() is called. However, the call to jabber_presence_send() can happen BEFORE we receive the roster from the server (it usually does, I think) so the PRPL tries to set the status for yourself, but your GaimBuddy node doesn't exist yet. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 06 Jul 2006 08:24:26 +0000
parents 0a2fa0177a30
children 756c3d7177d9
files src/protocols/jabber/roster.c
diffstat 1 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/jabber/roster.c	Thu Jul 06 08:11:41 2006 +0000
+++ b/src/protocols/jabber/roster.c	Thu Jul 06 08:24:26 2006 +0000
@@ -56,6 +56,7 @@
 		const char *alias, GSList *groups)
 {
 	GSList *buddies, *g2, *l;
+	gchar *my_bare_jid;
 
 	buddies = gaim_find_buddies(js->gc->account, jid);
 
@@ -68,6 +69,8 @@
 			return;
 	}
 
+	my_bare_jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain);
+
 	while(buddies) {
 		GaimBuddy *b = buddies->data;
 		GaimGroup *g = gaim_buddy_get_group(b);
@@ -100,10 +103,27 @@
 
 		gaim_blist_add_buddy(b, NULL, g, NULL);
 		gaim_blist_alias_buddy(b, alias);
+
+
+		/* If we just learned about ourself, then fake our status,
+		 * because we won't be receiving a normal presence message
+		 * about ourself. */
+		if(!strcmp(b->name, my_bare_jid)) {
+			GaimPresence *gpresence;
+			GaimStatus *status;
+
+			gpresence = gaim_account_get_presence(js->gc->account);
+			status = gaim_presence_get_active_status(gpresence);
+			jabber_presence_fake_to_self(js, status);
+		}
+
+
+
 		g_free(g2->data);
 		g2 = g_slist_delete_link(g2, g2);
 	}
 
+	g_free(my_bare_jid);
 	g_slist_free(buddies);
 }