# HG changeset patch # User Luke Schierer # Date 1034455500 0 # Node ID 5b439da85c3b5540f4896409d19c8b5156e30d2f # Parent 50122d258d6d7305b2664330d367e9318ad063b1 [gaim-migrate @ 3788] more i18n work from paco-paco and a fix for colors with high intensity from Alex Converse (alex4) committer: Tailor Script diff -r 50122d258d6d -r 5b439da85c3b src/dialogs.c --- a/src/dialogs.c Sat Oct 12 20:23:06 2002 +0000 +++ b/src/dialogs.c Sat Oct 12 20:45:00 2002 +0000 @@ -3046,9 +3046,9 @@ c = gtk_object_get_user_data(GTK_OBJECT(colorsel)); /* GTK_IS_EDITABLE(c->entry); huh? */ - text_color.red = text_color.red * 256 / 65535; - text_color.green = text_color.green * 256 /65535; - text_color.blue = text_color.blue * 256 / 65535; + text_color.red = text_color.red / 256; + text_color.green = text_color.green / 256; + text_color.blue = text_color.blue / 256; c->fgcol = text_color; c->hasfg = 1; @@ -3073,9 +3073,9 @@ c = gtk_object_get_user_data(GTK_OBJECT(colorsel)); /* GTK_IS_EDITABLE(c->entry); huh? */ - text_color.red = text_color.red * 256 / 65535; - text_color.green = text_color.green * 256 /65535; - text_color.blue = text_color.blue * 256 / 65535; + text_color.red = text_color.red / 256; + text_color.green = text_color.green / 256; + text_color.blue = text_color.blue / 256; c->bgcol = text_color; c->hasbg = 1; diff -r 50122d258d6d -r 5b439da85c3b src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Sat Oct 12 20:23:06 2002 +0000 +++ b/src/protocols/oscar/oscar.c Sat Oct 12 20:45:00 2002 +0000 @@ -1713,6 +1713,8 @@ struct gaim_connection *gc = sess->aux_data; struct oscar_data *od = gc->proto_data; int flags = 0; + int convlen; + GError *err = NULL; if (args->icbmflags & AIM_IMFLAGS_AWAY) flags |= IM_FLAG_AWAY; @@ -1769,37 +1771,20 @@ * HTML entity. */ if (args->icbmflags & AIM_IMFLAGS_UNICODE) { - int i, j; - GError *err = NULL; - - tmp = g_convert(args->msg, args->msglen, "UTF-8", "UCS-2BE", &j, &i, &err); - if (err) - debug_printf("Unicode IM conversion: %s\n", err->message); - if (!tmp) { - /* Conversion to HTML entities isn't a bad fallback */ - debug_printf ("AIM charset conversion failed!\n"); - for (i = 0, tmp[0] = '\0'; i < args->msglen; i += 2) { - unsigned short uni; - - uni = ((args->msg[i] & 0xff) << 8) | (args->msg[i+1] & 0xff); - - if ((uni < 128) || ((uni >= 160) && (uni <= 255))) { /* ISO 8859-1 */ - - g_snprintf(tmp+strlen(tmp), BUF_LONG-strlen(tmp), "%c", uni); - - } else { /* something else, do UNICODE entity */ - g_snprintf(tmp+strlen(tmp), BUF_LONG-strlen(tmp), "&#%04x;", uni); - } - - } + tmp = g_convert(args->msg, args->msglen, "UTF-8", "UCS-2BE", NULL, &convlen, &err); + if (err) { + debug_printf("Unicode IM conversion: %s\n", err->message); + tmp = strdup(_("(There was an error receiving this message)")); } } else if (args->icbmflags & AIM_IMFLAGS_ISO_8859_1) { int i; - debug_printf("ISO-8859-1 IM"); - tmp = g_convert(args->msg, args->msglen, "UTF-8", "ISO-8859-1", NULL, &i, NULL); + tmp = g_convert(args->msg, args->msglen, "UTF-8", "ISO-8859-1", NULL, &convlen, &err); + if (err) { + debug_printf("ISO-8859-1 IM conversion: %s\n", err->message); + tmp = strdup(_("(There was an error receiving this message)")); + } } else { /* ASCII is valid UTF-8 */ - debug_printf("ASCII IM\n"); tmp = g_strdup(args->msg); } @@ -3289,6 +3274,7 @@ struct oscar_data *odata = (struct oscar_data *)gc->proto_data; struct direct_im *dim = find_direct_im(odata, name); int ret = 0; + GError *err = NULL; if (dim) { if (dim->connected) { /* If we're not connected yet, send through server */ @@ -3374,23 +3360,35 @@ while (message[i]) { /* ISO-8859-1 is 0x00-0xbf in the first byte * followed by 0xc0-0xc3 in the second */ - if ((unsigned char)message[i] > 0x80 && ((unsigned char)message[i] > 0xbf || - ((unsigned char)message[i + 1] < 0xc0 || (unsigned char)message[i + 1] > 0xc3))) { - args.flags ^= AIM_IMFLAGS_ISO_8859_1; - args.flags |= AIM_IMFLAGS_UNICODE; - break; + if ((unsigned char)message[i] < 0x80 || + ((unsigned char)message[i] & 0xc0 == 0x80 && + (unsigned char)message[i + 1] & 0xfc == 0xc0)) { + i++; + continue; } - i++; + args.flags ^= AIM_IMFLAGS_ISO_8859_1; + args.flags |= AIM_IMFLAGS_UNICODE; + break; } if (args.flags & AIM_IMFLAGS_UNICODE) { - args.msg = g_convert(message, len, "UCS-2BE", "UTF-8", NULL, &len, NULL); + 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); + debug_printf("This really shouldn't happen!\n"); + /* We really shouldn't try to send the + * IM now, but I'm not sure what to do */ + } } else if (args.flags & AIM_IMFLAGS_UNICODE) { - args.msg = g_convert(message, len, "ISO-8859-1", "UTF-8", NULL, &len, NULL); - if (!args.msg) { + args.msg = g_convert(message, len, "ISO-8859-1", "UTF-8", NULL, &len, &err); + if (err) { + debug_printf("conversion error: %s\n", err->message); debug_printf("Someone tell Ethan his 8859-1 detection is wrong\n"); args.flags ^= AIM_IMFLAGS_ISO_8859_1 | AIM_IMFLAGS_UNICODE; len = strlen(message); - args.msg = g_convert(message, len, "UCS-2BE", "UTF8", NULL, &len, NULL); + args.msg = g_convert(message, len, "UCS-2BE", "UTF8", NULL, &len, &err); + if (err) { + debug_printf ("Error in unicode fallback: %s\n", err->message); + } } } else { args.msg = message;