diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2006-05-22 11:11:49 +0200 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2006-05-22 11:11:49 +0200 | 
| commit | 73cf7fd5f066d3c0720f58af840affa3e61bad12 (patch) | |
| tree | ff33f75152bea4769375158b4538159b03f498bb /protocols | |
| parent | 619a68171055ca6ec460557176bd59817c09b736 (diff) | |
Trying to fix charset issues with outgoing AIM chat messages.
Diffstat (limited to 'protocols')
| -rw-r--r-- | protocols/oscar/aim.h | 7 | ||||
| -rw-r--r-- | protocols/oscar/chat.c | 14 | ||||
| -rw-r--r-- | protocols/oscar/oscar.c | 9 | 
3 files changed, 25 insertions, 5 deletions
| diff --git a/protocols/oscar/aim.h b/protocols/oscar/aim.h index 24cd7730..93887103 100644 --- a/protocols/oscar/aim.h +++ b/protocols/oscar/aim.h @@ -727,8 +727,11 @@ struct aim_chat_exchangeinfo {  	char *lang2;  }; -#define AIM_CHATFLAGS_NOREFLECT 0x0001 -#define AIM_CHATFLAGS_AWAY      0x0002 +#define AIM_CHATFLAGS_NOREFLECT 	0x0001 +#define AIM_CHATFLAGS_AWAY      	0x0002 +#define AIM_CHATFLAGS_UNICODE		0x0004 +#define AIM_CHATFLAGS_ISO_8859_1	0x0008 +  int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, guint16 flags, const char *msg, int msglen);  int aim_chat_join(aim_session_t *sess, aim_conn_t *conn, guint16 exchange, const char *roomname, guint16 instance);  int aim_chat_attachname(aim_conn_t *conn, guint16 exchange, const char *roomname, guint16 instance); diff --git a/protocols/oscar/chat.c b/protocols/oscar/chat.c index 033c2577..8843b499 100644 --- a/protocols/oscar/chat.c +++ b/protocols/oscar/chat.c @@ -158,7 +158,19 @@ int aim_chat_send_im(aim_session_t *sess, aim_conn_t *conn, guint16 flags, const  	 */  	if (flags & AIM_CHATFLAGS_AWAY)  		aim_addtlvtochain_noval(&otl, 0x0007); - +	 +	/* [WvG] This wasn't there originally, but we really should send +	         the right charset flags, as we also do with normal +	         messages. Hope this will work. :-) */ +	if (flags & AIM_CHATFLAGS_UNICODE) +		aimbs_put16(&fr->data, 0x0002); +	else if (flags & AIM_CHATFLAGS_ISO_8859_1) +		aimbs_put16(&fr->data, 0x0003); +	else +		aimbs_put16(&fr->data, 0x0000); +	 +	aimbs_put16(&fr->data, 0x0000); +	  	/*  	 * SubTLV: Type 1: Message  	 */ diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index fecc11c0..4e75fe0a 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -2501,6 +2501,7 @@ int oscar_chat_send(struct gaim_connection * gc, int id, char *message)  	struct chat_connection * ccon;  	int ret;  	guint8 len = strlen(message); +	guint16 flags;  	char *s;  	if(!(ccon = find_oscar_chat(gc, id))) @@ -2509,15 +2510,19 @@ int oscar_chat_send(struct gaim_connection * gc, int id, char *message)  	for (s = message; *s; s++)  		if (*s & 128)  			break; -	  	 +	 +	flags = AIM_CHATFLAGS_NOREFLECT; +	  	/* Message contains high ASCII chars, time for some translation! */  	if (*s) {  		s = g_malloc(BUF_LONG);  		/* Try if we can put it in an ISO8859-1 string first.  		   If we can't, fall back to UTF16. */  		if ((ret = do_iconv("UTF-8", "ISO8859-1", message, s, len, BUF_LONG)) >= 0) { +			flags |= AIM_CHATFLAGS_ISO_8859_1;  			len = ret;  		} else if ((ret = do_iconv("UTF-8", "UNICODEBIG", message, s, len, BUF_LONG)) >= 0) { +			flags |= AIM_CHATFLAGS_UNICODE;  			len = ret;  		} else {  			/* OOF, translation failed... Oh well.. */ @@ -2528,7 +2533,7 @@ int oscar_chat_send(struct gaim_connection * gc, int id, char *message)  		s = message;  	} -	ret = aim_chat_send_im(od->sess, ccon->conn, AIM_CHATFLAGS_NOREFLECT, s, len); +	ret = aim_chat_send_im(od->sess, ccon->conn, flags, s, len);  	if (s != message) {	  		g_free(s); | 
