comparison libgaim/protocols/oscar/oscar.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 06b0b50d3617
children 17e367667cbf
comparison
equal deleted inserted replaced
15057:e8ba9f4a3a7d 15058:f227feab8c78
2315 case 0x06: { /* Someone requested authorization */ 2315 case 0x06: { /* Someone requested authorization */
2316 if (i >= 6) { 2316 if (i >= 6) {
2317 struct name_data *data = g_new(struct name_data, 1); 2317 struct name_data *data = g_new(struct name_data, 1);
2318 gchar *sn = g_strdup_printf("%u", args->uin); 2318 gchar *sn = g_strdup_printf("%u", args->uin);
2319 gchar *reason; 2319 gchar *reason;
2320 gchar *dialog_msg;
2321 2320
2322 if (msg2[5] != NULL) 2321 if (msg2[5] != NULL)
2323 reason = gaim_plugin_oscar_decode_im_part(account, sn, AIM_CHARSET_CUSTOM, 0x0000, msg2[5], strlen(msg2[5])); 2322 reason = gaim_plugin_oscar_decode_im_part(account, sn, AIM_CHARSET_CUSTOM, 0x0000, msg2[5], strlen(msg2[5]));
2324 else 2323 else
2325 reason = g_strdup(_("No reason given.")); 2324 reason = NULL;
2326 2325
2327 dialog_msg = g_strdup_printf(_("The user %u wants to add %s to their buddy list for the following reason:\n%s"),
2328 args->uin, gaim_account_get_username(gc->account), reason);
2329 g_free(reason);
2330 gaim_debug_info("oscar", 2326 gaim_debug_info("oscar",
2331 "Received an authorization request from UIN %u\n", 2327 "Received an authorization request from UIN %u\n",
2332 args->uin); 2328 args->uin);
2333 data->gc = gc; 2329 data->gc = gc;
2334 data->name = sn; 2330 data->name = sn;
2335 data->nick = NULL; 2331 data->nick = NULL;
2336 2332
2337 gaim_request_action(gc, NULL, _("Authorization Request"), 2333 gaim_account_request_authorization(gaim_connection_get_account(gc), sn, NULL, NULL, reason,
2338 dialog_msg, GAIM_DEFAULT_ACTION_NONE, data, 2334 G_CALLBACK(gaim_auth_grant), G_CALLBACK(gaim_auth_dontgrant_msgprompt), data);
2339 2, _("_Authorize"), 2335 g_free(reason);
2340 G_CALLBACK(gaim_auth_grant),
2341 _("_Deny"),
2342 G_CALLBACK(gaim_auth_dontgrant_msgprompt));
2343 g_free(dialog_msg);
2344 } 2336 }
2345 } break; 2337 } break;
2346 2338
2347 case 0x07: { /* Someone has denied you authorization */ 2339 case 0x07: { /* Someone has denied you authorization */
2348 if (i >= 1) { 2340 if (i >= 1) {
5012 char *sn; 5004 char *sn;
5013 char *msg; 5005 char *msg;
5014 GaimAccount *account = gaim_connection_get_account(gc); 5006 GaimAccount *account = gaim_connection_get_account(gc);
5015 gchar *nombre; 5007 gchar *nombre;
5016 gchar *reason = NULL; 5008 gchar *reason = NULL;
5017 gchar *dialog_msg;
5018 struct name_data *data; 5009 struct name_data *data;
5019 GaimBuddy *buddy; 5010 GaimBuddy *buddy;
5020 5011
5021 va_start(ap, fr); 5012 va_start(ap, fr);
5022 sn = va_arg(ap, char *); 5013 sn = va_arg(ap, char *);
5033 nombre = g_strdup(sn); 5024 nombre = g_strdup(sn);
5034 5025
5035 if (msg != NULL) 5026 if (msg != NULL)
5036 reason = gaim_plugin_oscar_decode_im_part(account, sn, AIM_CHARSET_CUSTOM, 0x0000, msg, strlen(msg)); 5027 reason = gaim_plugin_oscar_decode_im_part(account, sn, AIM_CHARSET_CUSTOM, 0x0000, msg, strlen(msg));
5037 5028
5038 if (reason == NULL)
5039 reason = g_strdup(_("No reason given."));
5040
5041 dialog_msg = g_strdup_printf(
5042 _("The user %s wants to add %s to their buddy list for the following reason:\n%s"),
5043 nombre, gaim_account_get_username(account), reason);
5044 g_free(reason);
5045
5046 data = g_new(struct name_data, 1); 5029 data = g_new(struct name_data, 1);
5047 data->gc = gc; 5030 data->gc = gc;
5048 data->name = g_strdup(sn); 5031 data->name = g_strdup(sn);
5049 data->nick = NULL; 5032 data->nick = NULL;
5050 5033
5051 gaim_request_action(gc, NULL, _("Authorization Request"), dialog_msg, 5034 gaim_account_request_authorization(gaim_connection_get_account(gc), nombre, NULL, NULL, reason,
5052 GAIM_DEFAULT_ACTION_NONE, data, 2, 5035 G_CALLBACK(gaim_auth_grant), G_CALLBACK(gaim_auth_dontgrant_msgprompt), data);
5053 _("_Authorize"), G_CALLBACK(gaim_auth_grant),
5054 _("_Deny"), G_CALLBACK(gaim_auth_dontgrant_msgprompt));
5055
5056 g_free(dialog_msg);
5057 g_free(nombre); 5036 g_free(nombre);
5037 g_free(reason);
5058 5038
5059 return 1; 5039 return 1;
5060 } 5040 }
5061 5041
5062 static int gaim_ssi_authreply(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) { 5042 static int gaim_ssi_authreply(OscarData *od, FlapConnection *conn, FlapFrame *fr, ...) {