Mercurial > pidgin.yaz
comparison src/protocols/oscar/oscar.c @ 4800:4af15fbcb00a
[gaim-migrate @ 5120]
Paco-Paco is cool, he fixed my mess, and then fixed other messes I didn't
even know we had.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sun, 16 Mar 2003 17:49:11 +0000 |
parents | 7fd8a82a7c36 |
children | 9810ce8e7a96 |
comparison
equal
deleted
inserted
replaced
4799:7fd8a82a7c36 | 4800:4af15fbcb00a |
---|---|
2033 | 2033 |
2034 tmp = g_convert(args->msg, args->msglen, "UTF-8", "UCS-2BE", NULL, &convlen, &err); | 2034 tmp = g_convert(args->msg, args->msglen, "UTF-8", "UCS-2BE", NULL, &convlen, &err); |
2035 if (err) { | 2035 if (err) { |
2036 debug_printf("Unicode IM conversion: %s\n", err->message); | 2036 debug_printf("Unicode IM conversion: %s\n", err->message); |
2037 tmp = strdup(_("(There was an error receiving this message)")); | 2037 tmp = strdup(_("(There was an error receiving this message)")); |
2038 g_error_free(err); | |
2038 } | 2039 } |
2039 } else { | 2040 } else { |
2040 /* This will get executed for both AIM_IMFLAGS_ISO_8859_1 and | 2041 /* This will get executed for both AIM_IMFLAGS_ISO_8859_1 and |
2041 * unflagged messages, which are ASCII. That's OK because | 2042 * unflagged messages, which are ASCII. That's OK because |
2042 * ASCII is a strict subset of ISO-8859-1; this should | 2043 * ASCII is a strict subset of ISO-8859-1; this should |
2052 | 2053 |
2053 tmp = g_convert(args->msg, args->msglen, "UTF-8", "ISO-8859-1", NULL, &convlen, &err); | 2054 tmp = g_convert(args->msg, args->msglen, "UTF-8", "ISO-8859-1", NULL, &convlen, &err); |
2054 if (err) { | 2055 if (err) { |
2055 debug_printf("ISO-8859-1 IM conversion: %s\n", err->message); | 2056 debug_printf("ISO-8859-1 IM conversion: %s\n", err->message); |
2056 tmp = strdup(_("(There was an error receiving this message)")); | 2057 tmp = strdup(_("(There was an error receiving this message)")); |
2058 g_error_free(err); | |
2057 } | 2059 } |
2058 } | 2060 } |
2059 | 2061 |
2060 /* strip_linefeed(tmp); */ | 2062 /* strip_linefeed(tmp); */ |
2061 serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL), -1); | 2063 serv_got_im(gc, userinfo->sn, tmp, flags, time(NULL), -1); |
2323 msg1 = g_strsplit(args->msg, "\376", 0); | 2325 msg1 = g_strsplit(args->msg, "\376", 0); |
2324 msg2 = (gchar **)g_malloc(10*sizeof(gchar *)); /* XXX - 10 is a guess */ | 2326 msg2 = (gchar **)g_malloc(10*sizeof(gchar *)); /* XXX - 10 is a guess */ |
2325 for (i=0; msg1[i]; i++) { | 2327 for (i=0; msg1[i]; i++) { |
2326 strip_linefeed(msg1[i]); | 2328 strip_linefeed(msg1[i]); |
2327 msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err); | 2329 msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err); |
2328 if (err) | 2330 if (err) { |
2329 debug_printf("Error converting a string from ISO-8859-1 to UTF-8 in oscar ICBM channel 4 parsing\n"); | 2331 debug_printf("Error converting a string from ISO-8859-1 to UTF-8 in oscar ICBM channel 4 parsing\n"); |
2332 g_error_free(err); | |
2333 } | |
2330 } | 2334 } |
2331 msg2[i] = NULL; | 2335 msg2[i] = NULL; |
2332 | 2336 |
2333 switch (args->type) { | 2337 switch (args->type) { |
2334 case 0x01: { /* MacICQ message or basic offline message */ | 2338 case 0x01: { /* MacICQ message or basic offline message */ |
3965 if (err) { | 3969 if (err) { |
3966 debug_printf("Error converting a unicode message: %s\n", err->message); | 3970 debug_printf("Error converting a unicode message: %s\n", err->message); |
3967 debug_printf("This really shouldn't happen!\n"); | 3971 debug_printf("This really shouldn't happen!\n"); |
3968 /* We really shouldn't try to send the | 3972 /* We really shouldn't try to send the |
3969 * IM now, but I'm not sure what to do */ | 3973 * IM now, but I'm not sure what to do */ |
3974 g_error_free(err); | |
3970 } | 3975 } |
3971 } else if (args.flags & AIM_IMFLAGS_ISO_8859_1) { | 3976 } else if (args.flags & AIM_IMFLAGS_ISO_8859_1) { |
3972 debug_printf("Sending ISO-8859-1 IM\n"); | 3977 debug_printf("Sending ISO-8859-1 IM\n"); |
3973 args.charset = 0x0003; | 3978 args.charset = 0x0003; |
3974 args.charsubset = 0x0000; | 3979 args.charsubset = 0x0000; |
3976 if (err) { | 3981 if (err) { |
3977 debug_printf("conversion error: %s\n", err->message); | 3982 debug_printf("conversion error: %s\n", err->message); |
3978 debug_printf("Someone tell Ethan his 8859-1 detection is wrong\n"); | 3983 debug_printf("Someone tell Ethan his 8859-1 detection is wrong\n"); |
3979 args.flags ^= AIM_IMFLAGS_ISO_8859_1 | AIM_IMFLAGS_UNICODE; | 3984 args.flags ^= AIM_IMFLAGS_ISO_8859_1 | AIM_IMFLAGS_UNICODE; |
3980 len = strlen(message); | 3985 len = strlen(message); |
3986 g_error_free(err); | |
3981 args.msg = g_convert(message, len, "UCS-2BE", "UTF8", NULL, &len, &err); | 3987 args.msg = g_convert(message, len, "UCS-2BE", "UTF8", NULL, &len, &err); |
3982 if (err) { | 3988 if (err) { |
3983 debug_printf("Error in unicode fallback: %s\n", err->message); | 3989 debug_printf("Error in unicode fallback: %s\n", err->message); |
3990 g_error_free(err); | |
3984 } | 3991 } |
3985 } | 3992 } |
3986 } else { | 3993 } else { |
3987 args.charset = 0x0000; | 3994 args.charset = 0x0000; |
3988 args.charsubset = 0x0000; | 3995 args.charsubset = 0x0000; |