changeset 10565:3b66a8f25bad

[gaim-migrate @ 11947] sf patch #1112296, from Magnus Hult Send ICQ offline messages as the user-specified character encoding instead of UCS-2BE. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 02 Feb 2005 00:07:18 +0000
parents cdeb727d1de3
children 62fc579810f4
files src/protocols/oscar/oscar.c
diffstat 1 files changed, 18 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/oscar.c	Tue Feb 01 16:13:09 2005 +0000
+++ b/src/protocols/oscar/oscar.c	Wed Feb 02 00:07:18 2005 +0000
@@ -511,19 +511,28 @@
 	}
 
 	/*
-	 * If we're sending to an ICQ user, and they are advertising the
-	 * Unicode capability, then attempt to send as UCS-2BE.
+	 * If we're sending to an ICQ user, and they are in our
+	 * buddy list, and they are advertising the Unicode
+	 * capability, and they are online, then attempt to send
+	 * as UCS-2BE.
 	 */
 	if ((destsn != NULL) && aim_sn_is_icq(destsn))
 		userinfo = aim_locate_finduserinfo(od->sess, destsn);
 
-	if ((userinfo != NULL) && (userinfo->capabilities & AIM_CAPS_ICQUTF8)) {
-		*msg = g_convert(from, strlen(from), "UCS-2BE", "UTF-8", NULL, &msglen, NULL);
-		if (*msg != NULL) {
-			*charset = AIM_CHARSET_UNICODE;
-			*charsubset = 0x0000;
-			*msglen_int = msglen;
-			return;
+	if ((userinfo != NULL) && (userinfo->capabilities & AIM_CAPS_ICQUTF8))
+	{
+		GaimBuddy *b;
+		b = gaim_find_buddy(account, destsn);
+		if ((b != NULL) && (GAIM_BUDDY_IS_ONLINE(b)))
+		{
+			*msg = g_convert(from, strlen(from), "UCS-2BE", "UTF-8", NULL, &msglen, NULL);
+			if (*msg != NULL)
+			{
+				*charset = AIM_CHARSET_UNICODE;
+				*charsubset = 0x0000;
+				*msglen_int = msglen;
+				return;
+			}
 		}
 	}