pidgin: 8b50f041: Don't arbitrarily default font settings ...
datallah at pidgin.im
datallah at pidgin.im
Thu Aug 28 00:21:53 EDT 2008
-----------------------------------------------------------------
Revision: 8b50f0410aa97238e285e2a9966b0d078871d2a9
Ancestor: b50ff09adaf269000d42ce67d90d588b1d73748c
Author: datallah at pidgin.im
Date: 2008-08-28T04:12:31
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/8b50f0410aa97238e285e2a9966b0d078871d2a9
Modified files:
libpurple/protocols/bonjour/jabber.c
ChangeLog:
Don't arbitrarily default font settings when none are specified for incoming
Bonjour messages. Thanks to Simon Wenner for noticing and figuring out why
this was happening.
Fixes #6601
-------------- next part --------------
============================================================
--- libpurple/protocols/bonjour/jabber.c 1f2ed46583c6d3fa13de13dd6cd1741f36744508
+++ libpurple/protocols/bonjour/jabber.c 9079aa3a3729d2e676746acb7241dffca5eef3eb
@@ -171,19 +171,13 @@ _jabber_parse_and_write_message_to_ui(xm
html_body_node = xmlnode_get_child(html_node, "body");
if (html_body_node != NULL) {
xmlnode *html_body_font_node;
- const char *ichat_balloon_color = NULL;
- const char *ichat_text_color = NULL;
- const char *font_face = NULL;
- const char *font_size = NULL;
- const char *font_color = NULL;
- ichat_balloon_color = xmlnode_get_attrib(html_body_node, "ichatballooncolor");
- ichat_text_color = xmlnode_get_attrib(html_body_node, "ichattextcolor");
html_body_font_node = xmlnode_get_child(html_body_node, "font");
-
/* Types of messages sent by iChat */
if (html_body_font_node != NULL) {
gchar *html_body;
+ const char *font_face, *font_size, *font_color,
+ *ichat_balloon_color, *ichat_text_color;
font_face = xmlnode_get_attrib(html_body_font_node, "face");
/* The absolute iChat font sizes should be converted to 1..7 range */
@@ -191,23 +185,30 @@ _jabber_parse_and_write_message_to_ui(xm
if (font_size != NULL)
font_size = _font_size_ichat_to_purple(atoi(font_size));
font_color = xmlnode_get_attrib(html_body_font_node, "color");
+ ichat_balloon_color = xmlnode_get_attrib(html_body_node, "ichatballooncolor");
+ ichat_text_color = xmlnode_get_attrib(html_body_node, "ichattextcolor");
+
html_body = get_xmlnode_contents(html_body_font_node);
if (html_body == NULL)
- /* This is the kind of formated messages that Purple creates */
+ /* This is the kind of formatted messages that Purple creates */
html_body = xmlnode_to_str(html_body_font_node, NULL);
if (html_body != NULL) {
- /* Use some sane defaults */
- if (font_face == NULL) font_face = "Helvetica";
- if (font_size == NULL) font_size = "3";
- if (ichat_text_color == NULL) ichat_text_color = "#000000";
- if (ichat_balloon_color == NULL) ichat_balloon_color = "#FFFFFF";
+ GString *str = g_string_new("<font");
- body = g_strdup_printf("<font face='%s' size='%s' color='%s' back='%s'>%s</font>",
- font_face, font_size, ichat_text_color, ichat_balloon_color,
- html_body);
+ if (font_face)
+ g_string_append_printf(str, " face='%s'", font_face);
+ if (font_size)
+ g_string_append_printf(str, " size='%s'", font_size);
+ if (ichat_text_color)
+ g_string_append_printf(str, " color='%s'", ichat_text_color);
+ if (ichat_balloon_color)
+ g_string_append_printf(str, " back='%s'", ichat_balloon_color);
+ g_string_append_printf(str, ">%s</font>", html_body);
+ body = g_string_free(str, FALSE);
+
g_free(html_body);
}
}
More information about the Commits
mailing list