changeset 4662:6d8a3e81db48

[gaim-migrate @ 4973] I removed AIM_IMFLAGS_CUSTOMCHARSET because I think it's a little misleading, and a little silly. 3rd party client developers!!! You must set args.charset and args.charsubset before calling aim_im_sendch1_ext. Just set them to 0 for plain ASCII. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 07 Mar 2003 06:39:10 +0000
parents ccc304cb0389
children 788f78343113
files src/protocols/oscar/aim.h src/protocols/oscar/im.c src/protocols/oscar/oscar.c
diffstat 3 files changed, 17 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/aim.h	Fri Mar 07 06:00:37 2003 +0000
+++ b/src/protocols/oscar/aim.h	Fri Mar 07 06:39:10 2003 +0000
@@ -759,7 +759,7 @@
 #define AIM_IMFLAGS_SUBENC_MACINTOSH	0x0040 /* damn that Steve Jobs! */
 #define AIM_IMFLAGS_CUSTOMFEATURES 	0x0080 /* features field present */
 #define AIM_IMFLAGS_EXTDATA		0x0100
-#define AIM_IMFLAGS_CUSTOMCHARSET	0x0200 /* charset fields set */
+#define AIM_IMFLAGS_X			0x0200
 #define AIM_IMFLAGS_MULTIPART		0x0400 /* ->mpmsg section valid */
 #define AIM_IMFLAGS_OFFLINE		0x0800 /* send to offline user */
 #define AIM_IMFLAGS_TYPINGNOT		0x1000 /* typing notification */
--- a/src/protocols/oscar/im.c	Fri Mar 07 06:00:37 2003 +0000
+++ b/src/protocols/oscar/im.c	Fri Mar 07 06:39:10 2003 +0000
@@ -343,19 +343,8 @@
 		aimbs_put16(&fr->data, args->msglen + 0x04);
 
 		/* Character set */
-		if (args->flags & AIM_IMFLAGS_CUSTOMCHARSET) {
-			aimbs_put16(&fr->data, args->charset);
-			aimbs_put16(&fr->data, args->charsubset);
-		} else {
-			if (args->flags & AIM_IMFLAGS_UNICODE)
-				aimbs_put16(&fr->data, 0x0002);
-			else if (args->flags & AIM_IMFLAGS_ISO_8859_1)
-				aimbs_put16(&fr->data, 0x0003);
-			else
-				aimbs_put16(&fr->data, 0x0000);
-
-			aimbs_put16(&fr->data, 0x0000);
-		}
+		aimbs_put16(&fr->data, args->charset);
+		aimbs_put16(&fr->data, args->charsubset);
 
 		/* Message.  Not terminated */
 		aimbs_putraw(&fr->data, args->msg, args->msglen);
@@ -428,6 +417,8 @@
 	args.flags = flags;
 	args.msg = msg;
 	args.msglen = strlen(msg);
+	args.charset = 0x0000;
+	args.charsubset = 0x0000;
 
 	/* Make these don't get set by accident -- they need aim_im_sendch1_ext */
 	args.flags &= ~(AIM_IMFLAGS_CUSTOMFEATURES | AIM_IMFLAGS_HASICON | AIM_IMFLAGS_MULTIPART);
@@ -1304,7 +1295,6 @@
 			/* Great. We found one.  Fill it in. */
 			args->charset = sec->charset;
 			args->charsubset = sec->charsubset;
-			args->icbmflags |= AIM_IMFLAGS_CUSTOMCHARSET;
 
 			/* Set up the simple flags */
 			if (args->charset == 0x0000)
--- a/src/protocols/oscar/oscar.c	Fri Mar 07 06:00:37 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Fri Mar 07 06:39:10 2003 +0000
@@ -1995,13 +1995,16 @@
 			debug_printf("Can't stat buddy icon file!\n");
 	}
 
+	debug_printf("Character set is %hu %hu\n", args->charset, args->charsubset);
 	if (args->icbmflags & AIM_IMFLAGS_UNICODE) {
 		/* This message is marked as UNICODE, so we have to
 		 * convert it to utf-8 before handing it to the gaim core.
 		 * This conversion should *never* fail, if it does it
 		 * means that either the incoming ICBM is corrupted or
-		 * there is something we don't understand about it. */
-		/* For the record, AIM Unicode is big-endian UCS-2 */
+		 * there is something we don't understand about it.
+		 * For the record, AIM Unicode is big-endian UCS-2 */
+
+		debug_printf("Received UNICODE IM\n");
 
 		if (!args->msg || !args->msglen)
 			return 1;
@@ -2019,9 +2022,8 @@
 		 * gaim (everything before 0.60) and other broken clients
 		 * that will happily send ISO-8859-1 without marking it as
 		 * such */
-		if (args->icbmflags & AIM_IMFLAGS_ISO_8859_1) {
+		if (args->icbmflags & AIM_IMFLAGS_ISO_8859_1)
 			debug_printf("Received ISO-8859-1 IM\n");
-		}
 
 		if (!args->msg || !args->msglen)
 			return 1;
@@ -2033,10 +2035,6 @@
 		}
 	}
 
-	if (args->icbmflags & AIM_IMFLAGS_CUSTOMCHARSET) {
-		debug_printf("Custom character set: %hu %hu\n", args->charset, args->charsubset);
-	}
-
 	if (args->icbmflags & AIM_IMFLAGS_TYPINGNOT) {
 		char *who = normalize(userinfo->sn);
 		if (!g_hash_table_lookup(od->supports_tn, who))
@@ -3880,6 +3878,8 @@
 		args.flags |= check_encoding(message);
 		if (args.flags & AIM_IMFLAGS_UNICODE) {
 			debug_printf("Sending Unicode IM\n");
+			args.charset = 0x0002;
+			args.charsubset = 0x0002;
 			args.msg = g_convert(message, len, "UCS-2BE", "UTF-8", NULL, &len, &err);
 			if (err) {
 				debug_printf("Error converting a unicode message: %s\n", err->message);
@@ -3889,6 +3889,8 @@
 			}
 		} else if (args.flags & AIM_IMFLAGS_ISO_8859_1) {
 			debug_printf("Sending ISO-8859-1 IM\n");
+			args.charset = 0x0003;
+			args.charsubset = 0x0003;
 			args.msg = g_convert(message, len, "ISO-8859-1", "UTF-8", NULL, &len, &err);
 			if (err) {
 				debug_printf("conversion error: %s\n", err->message);
@@ -3901,6 +3903,8 @@
 				}
 			}
 		} else {
+			args.charset = 0x0000;
+			args.charsubset = 0x0000;
 			args.msg = message;
 		}
 		args.msglen = len;