diff libpurple/protocols/oscar/odc.c @ 27805:80d3f4ff1cae

- fixed the offset of encoding field in ODC frame to be sent to peer. - added sanitize_utf8() to purple_plugin_oscar_convert_to_utf8() as nosuke pointed it out. - altered encoding candidates in purple_plugin_oscar_decode_im_part() to handle UTF-8 properly. - now direct IM with multi-byte characters works correctly.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Thu, 20 Mar 2008 11:48:40 +0000
parents 35b4f1dc4c8d
children eeee264cd325
line wrap: on
line diff
--- a/libpurple/protocols/oscar/odc.c	Wed Mar 19 19:23:41 2008 +0000
+++ b/libpurple/protocols/oscar/odc.c	Thu Mar 20 11:48:40 2008 +0000
@@ -101,22 +101,28 @@
 	byte_stream_new(&bs, length + frame->payload.len);
 	byte_stream_putraw(&bs, conn->magic, 4);
 	byte_stream_put16(&bs, length);
+
 	byte_stream_put16(&bs, frame->type);
 	byte_stream_put16(&bs, frame->subtype);
 	byte_stream_put16(&bs, 0x0000);
+
 	byte_stream_putraw(&bs, frame->cookie, 8);
 	byte_stream_put16(&bs, 0x0000);
 	byte_stream_put16(&bs, 0x0000);
 	byte_stream_put16(&bs, 0x0000);
 	byte_stream_put16(&bs, 0x0000);
+
 	byte_stream_put32(&bs, frame->payload.len);
-	byte_stream_put16(&bs, 0x0000);
 	byte_stream_put16(&bs, frame->encoding);
 	byte_stream_put16(&bs, 0x0000);
+	byte_stream_put16(&bs, 0x0000);
+
 	byte_stream_put16(&bs, frame->flags);
 	byte_stream_put16(&bs, 0x0000);
 	byte_stream_put16(&bs, 0x0000);
+
 	byte_stream_putraw(&bs, frame->sn, 32);
+
 	byte_stream_putraw(&bs, frame->payload.data, frame->payload.len);
 
 	peer_connection_send(conn, &bs);
@@ -496,13 +502,17 @@
 	frame->type = byte_stream_get16(bs);
 	frame->subtype = byte_stream_get16(bs);
 	byte_stream_advance(bs, 2);
+
 	byte_stream_getrawbuf(bs, frame->cookie, 8);
 	byte_stream_advance(bs, 8);
+
 	frame->payload.len = byte_stream_get32(bs);
 	frame->encoding = byte_stream_get16(bs);
 	byte_stream_advance(bs, 4);
+
 	frame->flags = byte_stream_get16(bs);
 	byte_stream_advance(bs, 4);
+
 	byte_stream_getrawbuf(bs, frame->sn, 32);
 
 	purple_debug_info("oscar", "Incoming ODC frame from %s with "