comparison libpurple/protocols/myspace/markup.c @ 20685:02df6998b466

propagate from branch 'im.pidgin.rlaager.merging.2_2_1_conflicts' (head 4ad1081695d083df424898e6e7091f731b401265) to branch 'im.pidgin.pidgin' (head d33243e8f5347776c81f81a0e4ba3a76ae5505a5)
author Richard Laager <rlaager@wiktel.com>
date Fri, 28 Sep 2007 16:34:43 +0000
parents 5440eed4ec7e 7efdc052539d
children 4b91ac9fa549
comparison
equal deleted inserted replaced
20258:509ca8ebe515 20685:02df6998b466
424 /** Convert an individual HTML tag to msim markup. */ 424 /** Convert an individual HTML tag to msim markup. */
425 static void 425 static void
426 html_tag_to_msim_markup(MsimSession *session, xmlnode *root, gchar **begin, 426 html_tag_to_msim_markup(MsimSession *session, xmlnode *root, gchar **begin,
427 gchar **end) 427 gchar **end)
428 { 428 {
429 if (!purple_utf8_strcasecmp(root->name, "root") ||
430 !purple_utf8_strcasecmp(root->name, "html")) {
431 *begin = g_strdup("");
432 *end = g_strdup("");
429 /* TODO: Coalesce nested tags into one <f> tag! 433 /* TODO: Coalesce nested tags into one <f> tag!
430 * Currently, the 's' value will be overwritten when b/i/u is nested 434 * Currently, the 's' value will be overwritten when b/i/u is nested
431 * within another one, and only the inner-most formatting will be 435 * within another one, and only the inner-most formatting will be
432 * applied to the text. */ 436 * applied to the text. */
433 if (!purple_utf8_strcasecmp(root->name, "root")) {
434 *begin = g_strdup("");
435 *end = g_strdup("");
436 } else if (!purple_utf8_strcasecmp(root->name, "b")) { 437 } else if (!purple_utf8_strcasecmp(root->name, "b")) {
437 *begin = g_strdup_printf("<f s='%d'>", MSIM_TEXT_BOLD); 438 *begin = g_strdup_printf("<f s='%d'>", MSIM_TEXT_BOLD);
438 *end = g_strdup("</f>"); 439 *end = g_strdup("</f>");
439 } else if (!purple_utf8_strcasecmp(root->name, "i")) { 440 } else if (!purple_utf8_strcasecmp(root->name, "i")) {
440 *begin = g_strdup_printf("<f s='%d'>", MSIM_TEXT_ITALIC); 441 *begin = g_strdup_printf("<f s='%d'>", MSIM_TEXT_ITALIC);
501 502
502 *end = g_strdup("</f>"); 503 *end = g_strdup("</f>");
503 504
504 /* TODO: color (bg uses <body>), emoticons */ 505 /* TODO: color (bg uses <body>), emoticons */
505 } else { 506 } else {
507 gchar *err;
508
509 #ifdef MSIM_MARKUP_SHOW_UNKNOWN_TAGS
506 *begin = g_strdup_printf("[%s]", root->name); 510 *begin = g_strdup_printf("[%s]", root->name);
507 *end = g_strdup_printf("[/%s]", root->name); 511 *end = g_strdup_printf("[/%s]", root->name);
512 #else
513 *begin = g_strdup("");
514 *end = g_strdup("");
515 #endif
516
517 err = g_strdup_printf("html_tag_to_msim_markup: unrecognized "
518 "HTML tag %s was sent by the IM client; ignoring",
519 root->name ? root->name : "(NULL)");
520 msim_unrecognized(NULL, NULL, err);
521 g_free(err);
508 } 522 }
509 } 523 }
510 524
511 /** Convert an xmlnode of msim markup or HTML to an HTML string or msim markup. 525 /** Convert an xmlnode of msim markup or HTML to an HTML string or msim markup.
512 * 526 *