comparison src/protocols/jabber/roster.c @ 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 a415805c7456
children 6fc412e59214
comparison
equal deleted inserted replaced
13924:0a2fa0177a30 13925:60f39c405dff
54 54
55 static void add_gaim_buddies_in_groups(JabberStream *js, const char *jid, 55 static void add_gaim_buddies_in_groups(JabberStream *js, const char *jid,
56 const char *alias, GSList *groups) 56 const char *alias, GSList *groups)
57 { 57 {
58 GSList *buddies, *g2, *l; 58 GSList *buddies, *g2, *l;
59 gchar *my_bare_jid;
59 60
60 buddies = gaim_find_buddies(js->gc->account, jid); 61 buddies = gaim_find_buddies(js->gc->account, jid);
61 62
62 g2 = groups; 63 g2 = groups;
63 64
65 if(!buddies) 66 if(!buddies)
66 g2 = g_slist_append(g2, g_strdup(_("Buddies"))); 67 g2 = g_slist_append(g2, g_strdup(_("Buddies")));
67 else 68 else
68 return; 69 return;
69 } 70 }
71
72 my_bare_jid = g_strdup_printf("%s@%s", js->user->node, js->user->domain);
70 73
71 while(buddies) { 74 while(buddies) {
72 GaimBuddy *b = buddies->data; 75 GaimBuddy *b = buddies->data;
73 GaimGroup *g = gaim_buddy_get_group(b); 76 GaimGroup *g = gaim_buddy_get_group(b);
74 77
98 gaim_blist_add_group(g, NULL); 101 gaim_blist_add_group(g, NULL);
99 } 102 }
100 103
101 gaim_blist_add_buddy(b, NULL, g, NULL); 104 gaim_blist_add_buddy(b, NULL, g, NULL);
102 gaim_blist_alias_buddy(b, alias); 105 gaim_blist_alias_buddy(b, alias);
106
107
108 /* If we just learned about ourself, then fake our status,
109 * because we won't be receiving a normal presence message
110 * about ourself. */
111 if(!strcmp(b->name, my_bare_jid)) {
112 GaimPresence *gpresence;
113 GaimStatus *status;
114
115 gpresence = gaim_account_get_presence(js->gc->account);
116 status = gaim_presence_get_active_status(gpresence);
117 jabber_presence_fake_to_self(js, status);
118 }
119
120
121
103 g_free(g2->data); 122 g_free(g2->data);
104 g2 = g_slist_delete_link(g2, g2); 123 g2 = g_slist_delete_link(g2, g2);
105 } 124 }
106 125
126 g_free(my_bare_jid);
107 g_slist_free(buddies); 127 g_slist_free(buddies);
108 } 128 }
109 129
110 void jabber_roster_parse(JabberStream *js, xmlnode *packet) 130 void jabber_roster_parse(JabberStream *js, xmlnode *packet)
111 { 131 {