diff src/protocols/oscar/info.c @ 6292:6651ecdda5d6

[gaim-migrate @ 6791] This makes umlauts and accents and other suck iso-8859-1 characters show up in available messages--and not crash Gaim. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 24 Jul 2003 02:04:19 +0000
parents 30d4c432101c
children 96196cfb132e
line wrap: on
line diff
--- a/src/protocols/oscar/info.c	Wed Jul 23 23:42:29 2003 +0000
+++ b/src/protocols/oscar/info.c	Thu Jul 24 02:04:19 2003 +0000
@@ -450,7 +450,8 @@
 faim_internal void aim_info_free(aim_userinfo_t *info)
 {
 	free(info->iconcsum);
-	free(info->availablemsg);
+	free(info->availmsg_encoding);
+	free(info->availmsg);
 }
 
 /*
@@ -675,7 +676,7 @@
 
 				switch (type2) {
 					case 0x0000: { /* This is an official buddy icon? */
-						/* This is always 5 bytes? */
+						/* This is always 5 bytes of "0x02 01 d2 04 72"? */
 						aim_bstream_advance(bs, length2);
 					} break;
 
@@ -690,8 +691,16 @@
 
 					case 0x0002: { /* An available message */
 						if (length2 > 4) {
-							free(outinfo->availablemsg);
-							outinfo->availablemsg = aimbs_getstr(bs, aimbs_get16(bs));
+							free(outinfo->availmsg);
+							outinfo->availmsg_len = aimbs_get16(bs);
+							outinfo->availmsg = aimbs_getraw(bs, outinfo->availmsg_len);
+							if (aimbs_get16(bs) == 0x0001) { /* We have an encoding */
+								aimbs_get16(bs);
+								outinfo->availmsg_encoding = aimbs_getstr(bs, aimbs_get16(bs));
+							} else {
+								/* No explicit encoding, client should use UTF-8 */
+								outinfo->availmsg_encoding = NULL;
+							}
 						} else
 							aim_bstream_advance(bs, length2);
 					} break;