Mercurial > pidgin
comparison plugins/msn/msn.c @ 2038:cb4fbcdae9eb
[gaim-migrate @ 2048]
msn updates
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Sat, 16 Jun 2001 17:55:57 +0000 |
parents | b86f639ff99f |
children | 859e9c2c5813 |
comparison
equal
deleted
inserted
replaced
2037:3155db0c1990 | 2038:cb4fbcdae9eb |
---|---|
376 if (ms->chat) { | 376 if (ms->chat) { |
377 char *user, *tmp = buf; | 377 char *user, *tmp = buf; |
378 GET_NEXT(tmp); | 378 GET_NEXT(tmp); |
379 user = tmp; | 379 user = tmp; |
380 remove_chat_buddy(ms->chat, user); | 380 remove_chat_buddy(ms->chat, user); |
381 } | 381 } else |
382 msn_kill_switch(ms); | |
382 } else if (!g_strncasecmp(buf, "CAL", 3)) { | 383 } else if (!g_strncasecmp(buf, "CAL", 3)) { |
383 } else if (!g_strncasecmp(buf, "IRO", 3)) { | 384 } else if (!g_strncasecmp(buf, "IRO", 3)) { |
384 char *tot, *user, *tmp = buf; | 385 char *tot, *user, *tmp = buf; |
385 | 386 |
386 GET_NEXT(tmp); | 387 GET_NEXT(tmp); |
424 debug_printf("\n"); | 425 debug_printf("\n"); |
425 } | 426 } |
426 } else if (!g_strncasecmp(buf, "MSG", 3)) { | 427 } else if (!g_strncasecmp(buf, "MSG", 3)) { |
427 char *user, *tmp = buf; | 428 char *user, *tmp = buf; |
428 int length; | 429 int length; |
429 char *msg, *content, *skiphead, *utf, *final; | 430 char *msg, *content, *utf; |
430 int len; | 431 int len; |
431 | 432 |
432 GET_NEXT(tmp); | 433 GET_NEXT(tmp); |
433 user = tmp; | 434 user = tmp; |
434 | 435 |
446 return; | 447 return; |
447 | 448 |
448 } | 449 } |
449 | 450 |
450 content = strstr(msg, "Content-Type: "); | 451 content = strstr(msg, "Content-Type: "); |
451 if (content) { | 452 if (!content) { |
452 if (g_strncasecmp(content, "Content-Type: text/plain", | 453 g_free(msg); |
453 strlen("Content-Type: text/plain"))) { | 454 return; |
455 } | |
456 if (!g_strncasecmp(content, "Content-Type: text/plain", | |
457 strlen("Content-Type: text/plain"))) { | |
458 char *final, *skiphead; | |
459 skiphead = strstr(msg, "\r\n\r\n"); | |
460 if (!skiphead || !skiphead[4]) { | |
454 g_free(msg); | 461 g_free(msg); |
455 return; | 462 return; |
456 } | 463 } |
457 } | 464 skiphead += 4; |
458 | 465 utf = utf8_to_str(skiphead); |
459 skiphead = strstr(msg, "\r\n\r\n"); | 466 len = MAX(strlen(utf) + 1, BUF_LEN); |
460 if (!skiphead || !skiphead[4]) { | 467 final = g_malloc(len); |
461 g_free(msg); | 468 g_snprintf(final, len, "%s", utf); |
462 return; | 469 g_free(utf); |
463 } | 470 |
464 skiphead += 4; | 471 if (ms->chat) |
465 utf = utf8_to_str(skiphead); | 472 serv_got_chat_in(gc, ms->chat->id, user, 0, final, time(NULL)); |
466 len = MAX(strlen(utf) + 1, BUF_LEN); | 473 else |
467 final = g_malloc(len); | 474 serv_got_im(gc, user, final, 0, time(NULL)); |
468 g_snprintf(final, len, "%s", utf); | 475 |
469 g_free(utf); | 476 g_free(final); |
470 | 477 } |
471 if (ms->chat) | |
472 serv_got_chat_in(gc, ms->chat->id, user, 0, final, time(NULL)); | |
473 else | |
474 serv_got_im(gc, user, final, 0, time(NULL)); | |
475 | |
476 g_free(final); | |
477 g_free(msg); | 478 g_free(msg); |
478 } else if (!g_strncasecmp(buf, "NAK", 3)) { | 479 } else if (!g_strncasecmp(buf, "NAK", 3)) { |
479 do_error_dialog("A message may not have been received.", "MSN Error"); | 480 do_error_dialog("A message may not have been received.", "MSN Error"); |
480 } else if (!g_strncasecmp(buf, "NLN", 3)) { | 481 } else if (!g_strncasecmp(buf, "NLN", 3)) { |
481 } else if (!g_strncasecmp(buf, "OUT", 3)) { | 482 } else if (!g_strncasecmp(buf, "OUT", 3)) { |