comparison libpurple/protocols/jabber/roster.c @ 26237:eb21f65728c0

propagate from branch 'im.pidgin.pidgin' (head bc80dc424bc7a7e274901f9124173538e5b43f41) to branch 'im.pidgin.soc.2008.yahoo' (head 42700e96e9188523e8d99406abde695abf97caf5)
author Sulabh Mahajan <sulabh@soc.pidgin.im>
date Wed, 12 Nov 2008 10:18:49 +0000
parents 5e51360bb22c
children 16734635febf fae699fece1f
comparison
equal deleted inserted replaced
26236:618d122af044 26237:eb21f65728c0
29 #include "roster.h" 29 #include "roster.h"
30 #include "iq.h" 30 #include "iq.h"
31 31
32 #include <string.h> 32 #include <string.h>
33 33
34
35 void jabber_roster_request(JabberStream *js) 34 void jabber_roster_request(JabberStream *js)
36 { 35 {
37 JabberIq *iq; 36 JabberIq *iq;
38 37
39 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:roster"); 38 iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:roster");
82 buddies = g_slist_remove(buddies, b); 81 buddies = g_slist_remove(buddies, b);
83 82
84 if((l = g_slist_find_custom(g2, g->name, (GCompareFunc)strcmp))) { 83 if((l = g_slist_find_custom(g2, g->name, (GCompareFunc)strcmp))) {
85 const char *servernick; 84 const char *servernick;
86 85
86 /* Previously stored serverside / buddy-supplied alias */
87 if((servernick = purple_blist_node_get_string((PurpleBlistNode*)b, "servernick"))) 87 if((servernick = purple_blist_node_get_string((PurpleBlistNode*)b, "servernick")))
88 serv_got_alias(js->gc, jid, servernick); 88 serv_got_alias(js->gc, jid, servernick);
89 89
90 /* Alias from our roster retrieval */
90 if(alias && (!b->alias || strcmp(b->alias, alias))) 91 if(alias && (!b->alias || strcmp(b->alias, alias)))
91 purple_blist_alias_buddy(b, alias); 92 purple_serv_got_private_alias(js->gc, jid, alias);
92 g_free(l->data); 93 g_free(l->data);
93 g2 = g_slist_delete_link(g2, l); 94 g2 = g_slist_delete_link(g2, l);
94 } else { 95 } else {
95 pool = g_list_prepend(pool, b); 96 pool = g_list_prepend(pool, b);
96 } 97 }
166 } 167 }
167 168
168 query = xmlnode_get_child(packet, "query"); 169 query = xmlnode_get_child(packet, "query");
169 if(!query) 170 if(!query)
170 return; 171 return;
172
173 js->currently_parsing_roster_push = TRUE;
171 174
172 for(item = xmlnode_get_child(query, "item"); item; item = xmlnode_get_next_twin(item)) 175 for(item = xmlnode_get_child(query, "item"); item; item = xmlnode_get_next_twin(item))
173 { 176 {
174 const char *jid, *name, *subscription, *ask; 177 const char *jid, *name, *subscription, *ask;
175 JabberBuddy *jb; 178 JabberBuddy *jb;
249 } 252 }
250 add_purple_buddies_to_groups(js, jid, name, groups); 253 add_purple_buddies_to_groups(js, jid, name, groups);
251 } 254 }
252 } 255 }
253 256
257 js->currently_parsing_roster_push = FALSE;
258
254 /* if we're just now parsing the roster for the first time, 259 /* if we're just now parsing the roster for the first time,
255 * then now would be the time to send our initial presence */ 260 * then now would be the time to send our initial presence */
256 if(!js->roster_parsed) { 261 if(!js->roster_parsed) {
257 js->roster_parsed = TRUE; 262 js->roster_parsed = TRUE;
258 263
266 PurpleBuddy *b; 271 PurpleBuddy *b;
267 PurpleGroup *g; 272 PurpleGroup *g;
268 GSList *groups = NULL, *l; 273 GSList *groups = NULL, *l;
269 JabberIq *iq; 274 JabberIq *iq;
270 xmlnode *query, *item, *group; 275 xmlnode *query, *item, *group;
276
277 if (js->currently_parsing_roster_push)
278 return;
271 279
272 if(!(b = purple_find_buddy(js->gc->account, name))) 280 if(!(b = purple_find_buddy(js->gc->account, name)))
273 return; 281 return;
274 282
275 if(grps) { 283 if(grps) {