Mercurial > pidgin.yaz
comparison libpurple/protocols/oscar/oscar.c @ 25541:411b5a604a17
propagate from branch 'im.pidgin.pidgin' (head cb5420b4b28888af9a419d6ca29f524e552c9cf0)
to branch 'im.pidgin.pidgin.yaz' (head 2fb9c50de147c3e10a2bb579beca0cf90ab363d0)
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Tue, 14 Aug 2007 07:13:22 +0000 |
parents | 536ee8e459ef 47942d19f301 |
children | 5e76304ebcc8 |
comparison
equal
deleted
inserted
replaced
25540:d892a9275d0d | 25541:411b5a604a17 |
---|---|
499 const gchar *charsetstr; | 499 const gchar *charsetstr; |
500 gsize msglen; | 500 gsize msglen; |
501 | 501 |
502 /* Attempt to send as ASCII */ | 502 /* Attempt to send as ASCII */ |
503 if (oscar_charset_check(from) == AIM_CHARSET_ASCII) { | 503 if (oscar_charset_check(from) == AIM_CHARSET_ASCII) { |
504 *msg = g_convert(from, strlen(from), "ASCII", "UTF-8", NULL, &msglen, NULL); | 504 *msg = g_convert(from, -1, "ASCII", "UTF-8", NULL, &msglen, NULL); |
505 *charset = AIM_CHARSET_ASCII; | 505 *charset = AIM_CHARSET_ASCII; |
506 *charsubset = 0x0000; | 506 *charsubset = 0x0000; |
507 *msglen_int = msglen; | 507 *msglen_int = msglen; |
508 return; | 508 return; |
509 } | 509 } |
545 | 545 |
546 /* | 546 /* |
547 * XXX - We need a way to only attempt to convert if we KNOW "from" | 547 * XXX - We need a way to only attempt to convert if we KNOW "from" |
548 * can be converted to "charsetstr" | 548 * can be converted to "charsetstr" |
549 */ | 549 */ |
550 *msg = g_convert(from, strlen(from), charsetstr, "UTF-8", NULL, &msglen, NULL); | 550 *msg = g_convert(from, -1, charsetstr, "UTF-8", NULL, &msglen, NULL); |
551 if (*msg != NULL) { | 551 if (*msg != NULL) { |
552 *charset = AIM_CHARSET_CUSTOM; | 552 *charset = AIM_CHARSET_CUSTOM; |
553 *charsubset = 0x0000; | 553 *charsubset = 0x0000; |
554 *msglen_int = msglen; | 554 *msglen_int = msglen; |
555 return; | 555 return; |
2285 purple_auth_sendrequest(gc, buddy->name); | 2285 purple_auth_sendrequest(gc, buddy->name); |
2286 } | 2286 } |
2287 | 2287 |
2288 /* When other people ask you for authorization */ | 2288 /* When other people ask you for authorization */ |
2289 static void | 2289 static void |
2290 purple_auth_grant(struct name_data *data) | 2290 purple_auth_grant(gpointer cbdata) |
2291 { | 2291 { |
2292 struct name_data *data = cbdata; | |
2292 PurpleConnection *gc = data->gc; | 2293 PurpleConnection *gc = data->gc; |
2293 OscarData *od = gc->proto_data; | 2294 OscarData *od = gc->proto_data; |
2294 | 2295 |
2295 aim_ssi_sendauthreply(od, data->name, 0x01, NULL); | 2296 aim_ssi_sendauthreply(od, data->name, 0x01, NULL); |
2296 | 2297 |
2306 | 2307 |
2307 aim_ssi_sendauthreply(od, data->name, 0x00, msg ? msg : _("No reason given.")); | 2308 aim_ssi_sendauthreply(od, data->name, 0x00, msg ? msg : _("No reason given.")); |
2308 } | 2309 } |
2309 | 2310 |
2310 static void | 2311 static void |
2311 purple_auth_dontgrant_msgprompt(struct name_data *data) | 2312 purple_auth_dontgrant_msgprompt(gpointer cbdata) |
2312 { | 2313 { |
2314 struct name_data *data = cbdata; | |
2313 purple_request_input(data->gc, NULL, _("Authorization Denied Message:"), | 2315 purple_request_input(data->gc, NULL, _("Authorization Denied Message:"), |
2314 NULL, _("No reason given."), TRUE, FALSE, NULL, | 2316 NULL, _("No reason given."), TRUE, FALSE, NULL, |
2315 _("_OK"), G_CALLBACK(purple_auth_dontgrant), | 2317 _("_OK"), G_CALLBACK(purple_auth_dontgrant), |
2316 _("_Cancel"), G_CALLBACK(oscar_free_name_data), | 2318 _("_Cancel"), G_CALLBACK(oscar_free_name_data), |
2317 purple_connection_get_account(data->gc), data->name, NULL, | 2319 purple_connection_get_account(data->gc), data->name, NULL, |
2428 data->name = sn; | 2430 data->name = sn; |
2429 data->nick = NULL; | 2431 data->nick = NULL; |
2430 | 2432 |
2431 purple_account_request_authorization(account, sn, NULL, NULL, | 2433 purple_account_request_authorization(account, sn, NULL, NULL, |
2432 reason, purple_find_buddy(account, sn) != NULL, | 2434 reason, purple_find_buddy(account, sn) != NULL, |
2433 G_CALLBACK(purple_auth_grant), | 2435 purple_auth_grant, |
2434 G_CALLBACK(purple_auth_dontgrant_msgprompt), data); | 2436 purple_auth_dontgrant_msgprompt, data); |
2435 g_free(reason); | 2437 g_free(reason); |
2436 } | 2438 } |
2437 } break; | 2439 } break; |
2438 | 2440 |
2439 case 0x07: { /* Someone has denied you authorization */ | 2441 case 0x07: { /* Someone has denied you authorization */ |
4374 if (charset == AIM_CHARSET_UNICODE) { | 4376 if (charset == AIM_CHARSET_UNICODE) { |
4375 encoded = g_convert(str, strlen(str), "UCS-2BE", "UTF-8", NULL, ret_len, NULL); | 4377 encoded = g_convert(str, strlen(str), "UCS-2BE", "UTF-8", NULL, ret_len, NULL); |
4376 botch_ucs(encoded, *ret_len); | 4378 botch_ucs(encoded, *ret_len); |
4377 *encoding = "unicode-2-0"; | 4379 *encoding = "unicode-2-0"; |
4378 } else if (charset == AIM_CHARSET_CUSTOM) { | 4380 } else if (charset == AIM_CHARSET_CUSTOM) { |
4379 encoded = g_convert(str, strlen(str), "ISO-8859-1", "UTF-8", NULL, ret_len, NULL); | 4381 encoded = g_convert(str, -1, "ISO-8859-1", "UTF-8", NULL, ret_len, NULL); |
4380 *encoding = "iso-8859-1"; | 4382 *encoding = "iso-8859-1"; |
4381 } else { | 4383 } else { |
4382 encoded = g_strdup(str); | 4384 encoded = g_strdup(str); |
4383 *ret_len = strlen(str); | 4385 *ret_len = strlen(str); |
4384 *encoding = "us-ascii"; | 4386 *encoding = "us-ascii"; |
5195 data->name = g_strdup(sn); | 5197 data->name = g_strdup(sn); |
5196 data->nick = (buddy ? g_strdup(purple_buddy_get_alias_only(buddy)) : NULL); | 5198 data->nick = (buddy ? g_strdup(purple_buddy_get_alias_only(buddy)) : NULL); |
5197 | 5199 |
5198 purple_account_request_authorization(account, sn, NULL, | 5200 purple_account_request_authorization(account, sn, NULL, |
5199 (buddy ? purple_buddy_get_alias_only(buddy) : NULL), | 5201 (buddy ? purple_buddy_get_alias_only(buddy) : NULL), |
5200 reason, buddy != NULL, G_CALLBACK(purple_auth_grant), | 5202 reason, buddy != NULL, purple_auth_grant, |
5201 G_CALLBACK(purple_auth_dontgrant_msgprompt), data); | 5203 purple_auth_dontgrant_msgprompt, data); |
5202 g_free(reason); | 5204 g_free(reason); |
5203 | 5205 |
5204 return 1; | 5206 return 1; |
5205 } | 5207 } |
5206 | 5208 |