comparison libpurple/protocols/oscar/oscar.c @ 30383:2a19f7385ba5

merged from im.pidgin.pidgin
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 18 May 2010 02:29:24 +0900
parents 77aba27f64da 859bb4ab3efe
children 9623db527d1e
comparison
equal deleted inserted replaced
30361:46275cca345e 30383:2a19f7385ba5
2514 curpart = curpart->next; 2514 curpart = curpart->next;
2515 } 2515 }
2516 tmp = g_string_free(message, FALSE); 2516 tmp = g_string_free(message, FALSE);
2517 2517
2518 /* 2518 /*
2519 * If the message is from an ICQ user and to an ICQ user then escape any HTML,
2520 * because HTML is not sent over ICQ as a means to format a message.
2521 * So any HTML we receive is intended to be displayed. Also, \r\n must be
2522 * replaced with <br>
2523 *
2524 * Note: There *may* be some clients which send messages as HTML formatted -
2525 * they need to be special-cased somehow.
2526 *
2527 * Update: Newer ICQ clients have started sending IMs as HTML. We can
2528 * distinguish HTML IMs from non-HTML IMs by looking at the features. If
2529 * the features are "0x 01 06" then the message is plain text. If the
2530 * features are "0x 01" then the message is HTML.
2531 */
2532 if (od->icq && oscar_util_valid_name_icq(userinfo->bn)
2533 && (args->featureslen != 1 || args->features[0] != 0x01))
2534 {
2535 /* being recevied by ICQ from ICQ - escape HTML so it is displayed as sent */
2536 gchar *tmp2 = g_markup_escape_text(tmp, -1);
2537 g_free(tmp);
2538 tmp = tmp2;
2539 tmp2 = purple_strreplace(tmp, "\r\n", "<br>");
2540 g_free(tmp);
2541 tmp = tmp2;
2542 }
2543
2544 /*
2545 * Convert iChat color tags to normal font tags. 2519 * Convert iChat color tags to normal font tags.
2546 */ 2520 */
2547 if (purple_markup_find_tag("body", tmp, &start, &end, &attribs)) 2521 if (purple_markup_find_tag("body", tmp, &start, &end, &attribs))
2548 { 2522 {
2549 int len; 2523 int len;