comparison src/protocols/oscar/oscar.c @ 6051:a170c50b2a48

[gaim-migrate @ 6501] This should fix a somewhat rare ICQ crash. http://sourceforge.net/tracker/index.php?func=detail&aid=749156&group_id=235&atid=100235 committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 07 Jul 2003 02:59:13 +0000
parents 80e3641ee9eb
children c062c4bf58ac
comparison
equal deleted inserted replaced
6050:72403c3c84e1 6051:a170c50b2a48
2533 2533
2534 static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args, time_t t) { 2534 static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_t *userinfo, struct aim_incomingim_ch4_args *args, time_t t) {
2535 GaimConnection *gc = sess->aux_data; 2535 GaimConnection *gc = sess->aux_data;
2536 gchar **msg1, **msg2; 2536 gchar **msg1, **msg2;
2537 GError *err = NULL; 2537 GError *err = NULL;
2538 int i; 2538 int i, numtoks;
2539 2539
2540 if (!args->type || !args->msg || !args->uin) 2540 if (!args->type || !args->msg || !args->uin)
2541 return 1; 2541 return 1;
2542 2542
2543 gaim_debug(GAIM_DEBUG_INFO, "oscar", 2543 gaim_debug(GAIM_DEBUG_INFO, "oscar",
2544 "Received a channel 4 message of type 0x%02hhx.\n", args->type); 2544 "Received a channel 4 message of type 0x%02hhx.\n", args->type);
2545 2545
2546 /* Split up the message at the delimeter character, then convert each string to UTF-8 */ 2546 /* Split up the message at the delimeter character, then convert each string to UTF-8 */
2547 msg1 = g_strsplit(args->msg, "\376", 0); 2547 msg1 = g_strsplit(args->msg, "\376", 0);
2548 msg2 = (gchar **)g_malloc(10*sizeof(gchar *)); /* XXX - 10 is a guess */ 2548 for (numtoks=0; msg1[numtoks]; numtoks++);
2549 msg2 = (gchar **)g_malloc((numtoks+1)*sizeof(gchar *));
2549 for (i=0; msg1[i]; i++) { 2550 for (i=0; msg1[i]; i++) {
2550 strip_linefeed(msg1[i]); 2551 strip_linefeed(msg1[i]);
2551 msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err); 2552 msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err);
2552 if (err) { 2553 if (err) {
2553 gaim_debug(GAIM_DEBUG_ERROR, "oscar", 2554 gaim_debug(GAIM_DEBUG_ERROR, "oscar",