changeset 11102:eac408c8900f

[gaim-migrate @ 13142] I was seeing empty authorization dialogs due to ICQ's lack of encoding support. This should fix them. Thanks to Mark for pointing out which function to use to do the encoding conversion and Daniel for help testing. I don't know if oldstatus is affected by this bug. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Wed, 13 Jul 2005 05:26:33 +0000
parents 8b346ce5cdb8
children d0baed7a3d10
files src/protocols/oscar/oscar.c
diffstat 1 files changed, 29 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/oscar.c	Wed Jul 13 02:52:28 2005 +0000
+++ b/src/protocols/oscar/oscar.c	Wed Jul 13 05:26:33 2005 +0000
@@ -3923,15 +3923,24 @@
 		case 0x06: { /* Someone requested authorization */
 			if (i >= 6) {
 				struct name_data *data = g_new(struct name_data, 1);
-				gchar *dialog_msg = g_strdup_printf(
+				gchar *sn = g_strdup_printf("%u", args->uin);
+				gchar *reason;
+				gchar *dialog_msg;
+
+				if (msg2[5] != NULL)
+					reason = gaim_plugin_oscar_decode_im_part(account, sn, AIM_CHARSET_CUSTOM, 0x0000, msg2[5], strlen(msg2[5]));
+				else
+					reason = g_strdup(_("No reason given."));
+
+				dialog_msg = g_strdup_printf(
 													_("The user %u wants to add %s to their buddy list for the following reason:\n%s"), 
-													args->uin, gaim_account_get_username(gc->account),
-													(msg2[5] ? msg2[5] : _("No reason given.")));
+													args->uin, gaim_account_get_username(gc->account), reason);
+				g_free(reason);
 				gaim_debug_info("oscar",
 						   "Received an authorization request from UIN %u\n",
 						   args->uin);
 				data->gc = gc;
-				data->name = g_strdup_printf("%u", args->uin);
+				data->name = sn;
 				data->nick = NULL;
 
 				gaim_request_action(gc, NULL, _("Authorization Request"),
@@ -4409,7 +4418,7 @@
 		away_utf8 = oscar_encoding_to_utf8(tmp, userinfo->away, userinfo->away_len);
 		g_free(tmp);
 		if (away_utf8 != NULL) {
-			g_string_append_printf(str, "\n<hr>%s", away_utf8);
+			g_string_append_printf(str, "\n<hr>%s<br>", away_utf8);
 			g_free(away_utf8);
 		}
 	}
@@ -4419,7 +4428,7 @@
 		info_utf8 = oscar_encoding_to_utf8(tmp, userinfo->info, userinfo->info_len);
 		g_free(tmp);
 		if (info_utf8 != NULL) {
-			g_string_append_printf(str, "\n<hr>%s", info_utf8);
+			g_string_append_printf(str, "\n<hr>%s<br>", info_utf8);
 			g_free(info_utf8);
 		}
 	}
@@ -6459,8 +6468,12 @@
 static int gaim_ssi_authrequest(aim_session_t *sess, aim_frame_t *fr, ...) {
 	GaimConnection *gc = sess->aux_data;
 	va_list ap;
-	char *sn, *msg;
-	gchar *dialog_msg, *nombre;
+	char *sn;
+	char *msg;
+	GaimAccount *account = gaim_connection_get_account(gc);
+	gchar *nombre;
+	gchar *reason;
+	gchar *dialog_msg;
 	struct name_data *data;
 	GaimBuddy *buddy;
 
@@ -6472,16 +6485,21 @@
 	gaim_debug_info("oscar",
 			   "ssi: received authorization request from %s\n", sn);
 
-	buddy = gaim_find_buddy(gc->account, sn);
+	buddy = gaim_find_buddy(account, sn);
 	if (buddy && (gaim_buddy_get_alias_only(buddy)))
 		nombre = g_strdup_printf("%s (%s)", sn, gaim_buddy_get_alias_only(buddy));
 	else
 		nombre = g_strdup(sn);
 
+	if (msg != NULL)
+		reason = gaim_plugin_oscar_decode_im_part(account, sn, AIM_CHARSET_CUSTOM, 0x0000, msg, strlen(msg));
+	else
+		reason = g_strdup(_("No reason given."));
+
 	dialog_msg = g_strdup_printf(
 								 _("The user %s wants to add %s to their buddy list for the following reason:\n%s"), 
-								 nombre, gaim_account_get_username(gc->account),
-								 (msg ? msg : _("No reason given.")));
+								 nombre, gaim_account_get_username(account), reason);
+	g_free(reason);
 
 	data = g_new(struct name_data, 1);
 	data->gc = gc;