Mercurial > pidgin
comparison 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 |
comparison
equal
deleted
inserted
replaced
12284:ecd471d1eeec | 12285:af257d8679fe |
---|---|
52 } | 52 } |
53 | 53 |
54 static void add_gaim_buddies_in_groups(JabberStream *js, const char *jid, | 54 static void add_gaim_buddies_in_groups(JabberStream *js, const char *jid, |
55 const char *alias, GSList *groups) | 55 const char *alias, GSList *groups) |
56 { | 56 { |
57 GaimPresence *presence = NULL; | |
58 GSList *buddies, *g2, *l; | 57 GSList *buddies, *g2, *l; |
59 | 58 |
60 buddies = gaim_find_buddies(js->gc->account, jid); | 59 buddies = gaim_find_buddies(js->gc->account, jid); |
61 | 60 |
62 g2 = groups; | 61 g2 = groups; |
64 if(!groups) { | 63 if(!groups) { |
65 if(!buddies) | 64 if(!buddies) |
66 g2 = g_slist_append(g2, g_strdup(_("Buddies"))); | 65 g2 = g_slist_append(g2, g_strdup(_("Buddies"))); |
67 else | 66 else |
68 return; | 67 return; |
69 } | |
70 | |
71 if(buddies) { | |
72 presence = gaim_buddy_get_presence((GaimBuddy*)buddies->data); | |
73 } | 68 } |
74 | 69 |
75 while(buddies) { | 70 while(buddies) { |
76 GaimBuddy *b = buddies->data; | 71 GaimBuddy *b = buddies->data; |
77 GaimGroup *g = gaim_buddy_get_group(b); | 72 GaimGroup *g = gaim_buddy_get_group(b); |
100 if(!g) { | 95 if(!g) { |
101 g = gaim_group_new(g2->data); | 96 g = gaim_group_new(g2->data); |
102 gaim_blist_add_group(g, NULL); | 97 gaim_blist_add_group(g, NULL); |
103 } | 98 } |
104 | 99 |
105 /* XXX: this hack may need to change */ | |
106 /* Is this change better? */ | |
107 b->presence = presence; | |
108 | |
109 gaim_blist_add_buddy(b, NULL, g, NULL); | 100 gaim_blist_add_buddy(b, NULL, g, NULL); |
110 gaim_blist_alias_buddy(b, alias); | 101 gaim_blist_alias_buddy(b, alias); |
111 g_free(g2->data); | 102 g_free(g2->data); |
112 g2 = g_slist_delete_link(g2, g2); | 103 g2 = g_slist_delete_link(g2, g2); |
113 } | 104 } |
160 | 151 |
161 if(!(jb = jabber_buddy_find(js, jid, TRUE))) | 152 if(!(jb = jabber_buddy_find(js, jid, TRUE))) |
162 continue; | 153 continue; |
163 | 154 |
164 if(subscription) { | 155 if(subscription) { |
165 if(!strcmp(subscription, "to")) | 156 gint me = -1; |
157 char *jid_norm; | |
158 const char *username; | |
159 | |
160 jid_norm = g_strdup(jabber_normalize(js->gc->account, jid)); | |
161 username = gaim_account_get_username(js->gc->account); | |
162 me = g_utf8_collate(jid_norm, | |
163 jabber_normalize(js->gc->account, | |
164 username)); | |
165 | |
166 if(me == 0) | |
167 jb->subscription = JABBER_SUB_BOTH; | |
168 else if(!strcmp(subscription, "none")) | |
169 jb->subscription = JABBER_SUB_NONE; | |
170 else if(!strcmp(subscription, "to")) | |
166 jb->subscription = JABBER_SUB_TO; | 171 jb->subscription = JABBER_SUB_TO; |
167 else if(!strcmp(subscription, "from")) | 172 else if(!strcmp(subscription, "from")) |
168 jb->subscription = JABBER_SUB_FROM; | 173 jb->subscription = JABBER_SUB_FROM; |
169 else if(!strcmp(subscription, "both")) | 174 else if(!strcmp(subscription, "both")) |
170 jb->subscription = JABBER_SUB_BOTH; | 175 jb->subscription = JABBER_SUB_BOTH; |
171 else if(!strcmp(subscription, "remove")) | 176 else if(!strcmp(subscription, "remove")) |
172 jb->subscription = JABBER_SUB_REMOVE; | 177 jb->subscription = JABBER_SUB_REMOVE; |
173 /* XXX: if subscription is now "from" or "none" we need to | 178 /* XXX: if subscription is now "from" or "none" we need to |
174 * fake a signoff, since we won't get any presence from them | 179 * fake a signoff, since we won't get any presence from them |
175 * anymore */ | 180 * anymore */ |
181 /* YYY: I was going to use this, but I'm not sure it's necessary | |
182 * anymore, but it's here in case it is. */ | |
183 /* | |
184 if ((jb->subscription & JABBER_SUB_FROM) || | |
185 (jb->subscription & JABBER_SUB_NONE)) { | |
186 gaim_prpl_got_user_status(js->gc->account, jid, "offline", NULL); | |
187 } | |
188 */ | |
176 } | 189 } |
177 | 190 |
178 if(ask && !strcmp(ask, "subscribe")) | 191 if(ask && !strcmp(ask, "subscribe")) |
179 jb->subscription |= JABBER_SUB_PENDING; | 192 jb->subscription |= JABBER_SUB_PENDING; |
180 else | 193 else |