Mercurial > pidgin.yaz
comparison libgaim/protocols/jabber/presence.c @ 15058:f227feab8c78
[gaim-migrate @ 17841]
Ok... let's throw this to the wild.
Support for "So-and-so want's authorization" in the core.
It creates a new mini-dialog in the blist for this with an
Authorize and Deny button, which do as you might imagine.
Clicking Authorize will also spawn an "Add buddy" dialog
if that person isn't already a buddy. I'm not sure I like
this, since I never add buddies that I authorize, but it
seems the best option.
I considered a checkbox in the dialog (but it only applies
when you hit "Authorize," which could be weird), and a
third "Authorize and Add" button (but that was too big for
the blist).
I'll come back to the UI later, I'm sure. I'd like to see
that the prpl changes all work. Yahoo, especially, looked
confusing, and had the most changes.
I'm mostly happy with this.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Wed, 29 Nov 2006 01:13:21 +0000 |
parents | 7ac8259f355d |
children | 31603a03cc02 |
comparison
equal
deleted
inserted
replaced
15057:e8ba9f4a3a7d | 15058:f227feab8c78 |
---|---|
179 char *who; | 179 char *who; |
180 }; | 180 }; |
181 | 181 |
182 static void authorize_add_cb(struct _jabber_add_permit *jap) | 182 static void authorize_add_cb(struct _jabber_add_permit *jap) |
183 { | 183 { |
184 GaimBuddy *buddy = NULL; | |
185 | |
186 jabber_presence_subscription_set(jap->gc->proto_data, jap->who, | 184 jabber_presence_subscription_set(jap->gc->proto_data, jap->who, |
187 "subscribed"); | 185 "subscribed"); |
188 #if 0 | |
189 buddy = gaim_find_buddy(jap->gc->account, jap->who); | |
190 | |
191 if (buddy) { | |
192 JabberBuddy *jb = NULL; | |
193 | |
194 jb = jabber_buddy_find(jap->js, jap->who, TRUE); | |
195 | |
196 if ((jb->subscription & JABBER_SUB_TO) == 0) { | |
197 gaim_account_request_add(jap->gc->account, | |
198 jap->who, NULL, | |
199 NULL, NULL); | |
200 } else { | |
201 gaim_account_notify_added(jap->gc->account, | |
202 jap->who, NULL, | |
203 NULL, NULL); | |
204 } | |
205 } else { | |
206 gaim_account_request_add(jap->gc->account, jap->who, | |
207 NULL, NULL, NULL); | |
208 } | |
209 #endif | |
210 g_free(jap->who); | 186 g_free(jap->who); |
211 g_free(jap); | 187 g_free(jap); |
212 } | 188 } |
213 | 189 |
214 static void deny_add_cb(struct _jabber_add_permit *jap) | 190 static void deny_add_cb(struct _jabber_add_permit *jap) |
302 | 278 |
303 state = JABBER_BUDDY_STATE_ERROR; | 279 state = JABBER_BUDDY_STATE_ERROR; |
304 jb->error_msg = msg ? msg : g_strdup(_("Unknown Error in presence")); | 280 jb->error_msg = msg ? msg : g_strdup(_("Unknown Error in presence")); |
305 } else if(type && !strcmp(type, "subscribe")) { | 281 } else if(type && !strcmp(type, "subscribe")) { |
306 struct _jabber_add_permit *jap = g_new0(struct _jabber_add_permit, 1); | 282 struct _jabber_add_permit *jap = g_new0(struct _jabber_add_permit, 1); |
307 char *msg; | 283 |
308 | |
309 msg = g_strdup_printf(_("The user %s wants to add %s to his or " | |
310 "her buddy list."), | |
311 from, gaim_account_get_username(js->gc->account)); | |
312 jap->gc = js->gc; | 284 jap->gc = js->gc; |
313 jap->who = g_strdup(from); | 285 jap->who = g_strdup(from); |
314 jap->js = js; | 286 jap->js = js; |
315 | 287 |
316 gaim_request_action(js->gc, NULL, msg, NULL, GAIM_DEFAULT_ACTION_NONE, | 288 gaim_account_request_authorization(gaim_connection_get_account(js->gc), from, NULL, NULL, NULL, |
317 jap, 2, | 289 G_CALLBACK(authorize_add_cb), G_CALLBACK(deny_add_cb), jap); |
318 _("_Authorize"), G_CALLBACK(authorize_add_cb), | |
319 _("_Deny"), G_CALLBACK(deny_add_cb)); | |
320 g_free(msg); | |
321 jabber_id_free(jid); | 290 jabber_id_free(jid); |
322 return; | 291 return; |
323 } else if(type && !strcmp(type, "subscribed")) { | 292 } else if(type && !strcmp(type, "subscribed")) { |
324 /* we've been allowed to see their presence, but we don't care */ | 293 /* we've been allowed to see their presence, but we don't care */ |
325 jabber_id_free(jid); | 294 jabber_id_free(jid); |