libpurple/protocols/myspace/markup.c

branch
release-2.2.1
changeset 20166
49c243c1fe12
parent 20139
f0cc6a81a9b3
child 20198
90ae53934c28
child 20404
d5e4f520e5e7
child 20762
47abf40987f3
child 20791
0ce6682959f1
equal deleted inserted replaced
20164:669e8210cc58 20166:49c243c1fe12
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", (root->name ? root->name : "(NULL)"));
519 msim_unrecognized(NULL, NULL, err);
520 g_free(err);
508 } 521 }
509 } 522 }
510 523
511 /** Convert an xmlnode of msim markup or HTML to an HTML string or msim markup. 524 /** Convert an xmlnode of msim markup or HTML to an HTML string or msim markup.
512 * 525 *

mercurial