Mercurial > pidgin
comparison libpurple/protocols/myspace/markup.c @ 24793:9a5a201e69a3
Add support for foreground and background font colors in MySpace IMs
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 17 Dec 2008 04:02:25 +0000 |
parents | cd0071208174 |
children | 41f5dff0059f |
comparison
equal
deleted
inserted
replaced
24792:cd0071208174 | 24793:9a5a201e69a3 |
---|---|
495 g_free(link_text); | 495 g_free(link_text); |
496 root->child = NULL; | 496 root->child = NULL; |
497 | 497 |
498 *end = g_strdup(""); | 498 *end = g_strdup(""); |
499 } else if (!purple_utf8_strcasecmp(root->name, "font")) { | 499 } else if (!purple_utf8_strcasecmp(root->name, "font")) { |
500 GString *tmpbegin, *tmpend; | |
500 const gchar *size; | 501 const gchar *size; |
501 const gchar *face; | 502 const gchar *face; |
503 const gchar *color; | |
502 | 504 |
503 size = xmlnode_get_attrib(root, "size"); | 505 size = xmlnode_get_attrib(root, "size"); |
504 face = xmlnode_get_attrib(root, "face"); | 506 face = xmlnode_get_attrib(root, "face"); |
505 | 507 color = xmlnode_get_attrib(root, "color"); |
506 if (face && size) { | 508 |
507 *begin = g_strdup_printf("<f f='%s' h='%d'>", face, | 509 tmpbegin = g_string_new("<f"); |
508 msim_point_to_height(session, | 510 tmpend = g_string_new("</f>"); |
509 msim_purple_size_to_point(session, atoi(size)))); | 511 |
510 } else if (face) { | 512 if (face != NULL) |
511 *begin = g_strdup_printf("<f f='%s'>", face); | 513 g_string_append_printf(tmpbegin, "f='%s'>", face); |
512 } else if (size) { | 514 |
513 *begin = g_strdup_printf("<f h='%d'>", | 515 if (size != NULL) |
516 g_string_append_printf(tmpbegin, "h='%d'", | |
514 msim_point_to_height(session, | 517 msim_point_to_height(session, |
515 msim_purple_size_to_point(session, atoi(size)))); | 518 msim_purple_size_to_point(session, atoi(size)))); |
516 } else { | 519 |
517 *begin = g_strdup("<f>"); | 520 /* Close the <f> tag */ |
518 } | 521 g_string_append(tmpbegin, ">"); |
519 | 522 |
520 *end = g_strdup("</f>"); | 523 if (color != NULL) { |
521 | 524 g_string_append_printf(tmpbegin, "<c v='%s'>", color); |
522 /* TODO: color (bg uses <body>), emoticons */ | 525 g_string_prepend(tmpend, "</c>"); |
526 } | |
527 | |
528 *begin = g_string_free(tmpbegin, FALSE); | |
529 *end = g_string_free(tmpend, FALSE); | |
530 | |
531 } else if (!purple_utf8_strcasecmp(root->name, "body")) { | |
532 const gchar *bgcolor; | |
533 | |
534 bgcolor = xmlnode_get_attrib(root, "bgcolor"); | |
535 | |
536 if (bgcolor != NULL) { | |
537 *begin = g_strdup_printf("<b v='%s'>", bgcolor); | |
538 *end = g_strdup("</b>"); | |
539 } | |
540 | |
523 } else { | 541 } else { |
524 gchar *err; | 542 gchar *err; |
525 | 543 |
526 #ifdef MSIM_MARKUP_SHOW_UNKNOWN_TAGS | 544 #ifdef MSIM_MARKUP_SHOW_UNKNOWN_TAGS |
527 *begin = g_strdup_printf("[%s]", root->name); | 545 *begin = g_strdup_printf("[%s]", root->name); |