changeset 15060:17e367667cbf

[gaim-migrate @ 17844] On win32, use the current locale charset as the default fallback for oscar. Sean suggested this, it is based on the idea that you're likely to be talking people using a similar locale to you - so if they are using an ICQ client that just sends it in the current locale encoding, it will just work. For the en_US locale, this becomes the "CP1252" encoding. I also removed some duplicate definitions. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Wed, 29 Nov 2006 05:27:49 +0000
parents a9e9633f394e
children 75034345bf52
files libgaim/protocols/oscar/oscar.c libgaim/protocols/oscar/oscarcommon.h
diffstat 2 files changed, 22 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/protocols/oscar/oscar.c	Wed Nov 29 01:20:34 2006 +0000
+++ b/libgaim/protocols/oscar/oscar.c	Wed Nov 29 05:27:49 2006 +0000
@@ -62,13 +62,6 @@
 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3"
 
 #define OSCAR_CONNECT_STEPS 6
-#define OSCAR_DEFAULT_LOGIN_SERVER "login.oscar.aol.com"
-#define OSCAR_DEFAULT_LOGIN_PORT 5190
-#define OSCAR_DEFAULT_CUSTOM_ENCODING "ISO-8859-1"
-#define OSCAR_DEFAULT_AUTHORIZATION TRUE
-#define OSCAR_DEFAULT_HIDE_IP TRUE
-#define OSCAR_DEFAULT_WEB_AWARE FALSE
-#define OSCAR_DEFAULT_ALWAYS_USE_RV_PROXY FALSE
 
 static OscarCapability gaim_caps = OSCAR_CAPABILITY_CHAT | OSCAR_CAPABILITY_BUDDYICON | OSCAR_CAPABILITY_DIRECTIM | OSCAR_CAPABILITY_SENDFILE | OSCAR_CAPABILITY_UNICODE | OSCAR_CAPABILITY_INTEROPERATE | OSCAR_CAPABILITY_ICHAT;
 
@@ -215,6 +208,15 @@
 	g_free(data);
 }
 
+#ifdef _WIN32
+const char *oscar_get_locale_charset(void) {
+	static const char *charset = NULL;
+	if (charset == NULL)
+		g_get_charset(&charset);
+	return charset;
+}
+#endif
+
 /**
  * Determine how we can send this message.  Per the warnings elsewhere
  * in this file, these little checks determine the simplest encoding
@@ -2316,12 +2318,10 @@
 			if (i >= 6) {
 				struct name_data *data = g_new(struct name_data, 1);
 				gchar *sn = g_strdup_printf("%u", args->uin);
-				gchar *reason;
+				gchar *reason = NULL;
 
 				if (msg2[5] != NULL)
 					reason = gaim_plugin_oscar_decode_im_part(account, sn, AIM_CHARSET_CUSTOM, 0x0000, msg2[5], strlen(msg2[5]));
-				else
-					reason = NULL; 
 
 				gaim_debug_info("oscar",
 						   "Received an authorization request from UIN %u\n",
@@ -2329,7 +2329,7 @@
 				data->gc = gc;
 				data->name = sn;
 				data->nick = NULL;
-				
+
 				gaim_account_request_authorization(gaim_connection_get_account(gc), sn, NULL, NULL, reason,
 						G_CALLBACK(gaim_auth_grant), G_CALLBACK(gaim_auth_dontgrant_msgprompt), data);
 				g_free(reason);
@@ -3503,9 +3503,9 @@
 
 	aim_clientready(od, conn);
 
-        if (gaim_account_get_user_info(account) != NULL)
-        	serv_set_info(gc, gaim_account_get_user_info(account));
-	
+	if (gaim_account_get_user_info(account) != NULL)
+		serv_set_info(gc, gaim_account_get_user_info(account));
+
 	/* Set our available message based on the current status */
 	status = gaim_account_get_active_status(account);
 	if (gaim_status_is_available(status))
@@ -5031,7 +5031,7 @@
 	data->name = g_strdup(sn);
 	data->nick = NULL;
 
-	gaim_account_request_authorization(gaim_connection_get_account(gc), nombre, NULL, NULL, reason, 
+	gaim_account_request_authorization(gaim_connection_get_account(gc), nombre, NULL, NULL, reason,
 			G_CALLBACK(gaim_auth_grant), G_CALLBACK(gaim_auth_dontgrant_msgprompt), data);
 	g_free(nombre);
 	g_free(reason);
--- a/libgaim/protocols/oscar/oscarcommon.h	Wed Nov 29 01:20:34 2006 +0000
+++ b/libgaim/protocols/oscar/oscarcommon.h	Wed Nov 29 05:27:49 2006 +0000
@@ -31,12 +31,19 @@
 
 #define OSCAR_DEFAULT_LOGIN_SERVER "login.oscar.aol.com"
 #define OSCAR_DEFAULT_LOGIN_PORT 5190
+#ifndef _WIN32
 #define OSCAR_DEFAULT_CUSTOM_ENCODING "ISO-8859-1"
+#else
+#define OSCAR_DEFAULT_CUSTOM_ENCODING oscar_get_locale_charset()
+#endif
 #define OSCAR_DEFAULT_AUTHORIZATION TRUE
 #define OSCAR_DEFAULT_HIDE_IP TRUE
 #define OSCAR_DEFAULT_WEB_AWARE FALSE
 #define OSCAR_DEFAULT_ALWAYS_USE_RV_PROXY FALSE
 
+#ifdef _WIN32
+const char *oscar_get_locale_charset(void);
+#endif
 const char *oscar_list_icon_icq(GaimAccount *a, GaimBuddy *b);
 const char *oscar_list_icon_aim(GaimAccount *a, GaimBuddy *b);
 void oscar_list_emblems(GaimBuddy *b, const char **se, const char **sw, const char **nw, const char **ne);