diff src/protocols/oscar/chat.c @ 8233:4f70e8b3e05e

[gaim-migrate @ 8956] Smore changes to oscar chat stuff. Shouldn't be anything noticable. For some reason when I paste "c?mo" followed by some Japanese text into a chat it isn't received correctly. I think there is something weird with the conversation to UCS-2BE, but I'm not really sure what. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 12 Feb 2004 03:07:52 +0000
parents 9790cda80d52
children 35f69749b226
line wrap: on
line diff
--- a/src/protocols/oscar/chat.c	Thu Feb 12 00:50:16 2004 +0000
+++ b/src/protocols/oscar/chat.c	Thu Feb 12 03:07:52 2004 +0000
@@ -320,8 +320,8 @@
  *
  * XXX convert this to use tlvchains 
  */
-faim_export int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, fu16_t flags, const char *msg, int msglen, char *charset)
-{   
+faim_export int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, fu16_t flags, const char *msg, int msglen, const char *encoding, const char *language)
+{
 	int i;
 	aim_frame_t *fr;
 	aim_msgcookie_t *cookie;
@@ -378,10 +378,17 @@
 	 */
 	aim_tlvlist_add_raw(&itl, 0x0001, msglen, msg);
 
-        /*
-         * SubTLV: Type 2: Encoding
-         */
-        aim_tlvlist_add_raw(&itl, 0x0002, strlen(charset), charset);
+	/*
+	 * SubTLV: Type 2: Encoding
+	 */
+	if (encoding != NULL)
+		aim_tlvlist_add_raw(&itl, 0x0002, strlen(encoding), encoding);
+
+	/*
+	 * SubTLV: Type 3: Language
+	 */
+	if (language != NULL)
+		aim_tlvlist_add_raw(&itl, 0x0003, strlen(language), language);
 
 	/*
 	 * Type 5: Message block.  Contains more TLVs.
@@ -437,7 +444,7 @@
 	aim_tlvlist_t *otl;
 	char *msg = NULL;
 	int len;
-	char *charset = NULL;
+	char *encoding = NULL, *language = NULL;
 	aim_msgcookie_t *ck;
 
 	memset(&userinfo, 0, sizeof(aim_userinfo_t));
@@ -511,17 +518,23 @@
 			len = aim_tlv_gettlv(itl, 0x0001, 1)->length;
 		}
 
-		/* 
-		 * Type 0x0002: Charset.
+		/*
+		 * Type 0x0002: Encoding.
 		 */	
 		if (aim_tlv_gettlv(itl, 0x0002, 1))
-			charset = aim_tlv_getstr(itl, 0x0002, 1);
+			encoding = aim_tlv_getstr(itl, 0x0002, 1);
+
+		/*
+		 * Type 0x0003: Language.
+		 */	
+		if (aim_tlv_gettlv(itl, 0x0003, 1))
+			language = aim_tlv_getstr(itl, 0x0003, 1);
 
 		aim_tlvlist_free(&itl); 
 	}
 
 	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))
-		ret = userfunc(sess, rx, &userinfo, len, msg, charset);
+		ret = userfunc(sess, rx, &userinfo, len, msg, encoding, language);
 
 	aim_info_free(&userinfo);
 	free(msg);