Mercurial > pidgin
diff src/protocols/jabber/roster.c @ 12285:af257d8679fe
[gaim-migrate @ 14589]
Ok, so I'm changing the semantics of gaim_account_notify_added, having it
check for the existance of a buddy was breaking some jabber scenarios. So
buddy checks should now be done in the prpls. I also added a
gaim_account_request_add. _notify_added only notifies the user of the add,
request_add notifies the user AND asks them if they want to add the buddy to
their buddy list.
I only updated jabber for these changes because it's the only protocol I
really know at all well. So everyone PLEASE make sure that the other protocols
get updated for this. That is make sure that when you expect to prompt the
user to add the buddy you use _request_add instead of just using _notify_added
and expecting the core to determine if it needs to prompt the user.
Oh, there are also some other jabber changes which should hopefully fix some
issues that people were seeing, like buddies not signing off when you
unsubscribed with them, etc. Let me know if anyone notices any jabber oddities
after this.
committer: Tailor Script <tailor@pidgin.im>
author | Etan Reisner <pidgin@unreliablesource.net> |
---|---|
date | Thu, 01 Dec 2005 20:09:27 +0000 |
parents | 980c877bd238 |
children | a415805c7456 |
line wrap: on
line diff
--- a/src/protocols/jabber/roster.c Thu Dec 01 19:55:35 2005 +0000 +++ b/src/protocols/jabber/roster.c Thu Dec 01 20:09:27 2005 +0000 @@ -54,7 +54,6 @@ static void add_gaim_buddies_in_groups(JabberStream *js, const char *jid, const char *alias, GSList *groups) { - GaimPresence *presence = NULL; GSList *buddies, *g2, *l; buddies = gaim_find_buddies(js->gc->account, jid); @@ -68,10 +67,6 @@ return; } - if(buddies) { - presence = gaim_buddy_get_presence((GaimBuddy*)buddies->data); - } - while(buddies) { GaimBuddy *b = buddies->data; GaimGroup *g = gaim_buddy_get_group(b); @@ -102,10 +97,6 @@ gaim_blist_add_group(g, NULL); } - /* XXX: this hack may need to change */ - /* Is this change better? */ - b->presence = presence; - gaim_blist_add_buddy(b, NULL, g, NULL); gaim_blist_alias_buddy(b, alias); g_free(g2->data); @@ -162,7 +153,21 @@ continue; if(subscription) { - if(!strcmp(subscription, "to")) + gint me = -1; + char *jid_norm; + const char *username; + + jid_norm = g_strdup(jabber_normalize(js->gc->account, jid)); + username = gaim_account_get_username(js->gc->account); + me = g_utf8_collate(jid_norm, + jabber_normalize(js->gc->account, + username)); + + if(me == 0) + jb->subscription = JABBER_SUB_BOTH; + else if(!strcmp(subscription, "none")) + jb->subscription = JABBER_SUB_NONE; + else if(!strcmp(subscription, "to")) jb->subscription = JABBER_SUB_TO; else if(!strcmp(subscription, "from")) jb->subscription = JABBER_SUB_FROM; @@ -173,6 +178,14 @@ /* XXX: if subscription is now "from" or "none" we need to * fake a signoff, since we won't get any presence from them * anymore */ + /* YYY: I was going to use this, but I'm not sure it's necessary + * anymore, but it's here in case it is. */ + /* + if ((jb->subscription & JABBER_SUB_FROM) || + (jb->subscription & JABBER_SUB_NONE)) { + gaim_prpl_got_user_status(js->gc->account, jid, "offline", NULL); + } + */ } if(ask && !strcmp(ask, "subscribe"))