--- a/pidgin/plugins/xmppconsole.c Thu May 31 05:45:28 2012 +0000
+++ b/pidgin/plugins/xmppconsole.c Thu May 31 06:09:59 2012 +0000
@@ -46,7 +46,8 @@
"<html><head><style type='text/css'>" \
- "body { white-space: pre-wrap; margin: 0; }" \
+ "body { word-wrap: break-word; margin: 0; }" \ + "div.tab { padding-left: 1em; }" \ "div.info { color: #777777; }" \
"div.incoming { background-color: #ffcece; }" \
"div.outgoing { background-color: #dcecc4; }" \
@@ -58,20 +59,15 @@
-xmlnode_to_pretty_str(xmlnode *node, int *len, int depth)
+xmlnode_to_pretty_str(xmlnode *node, int *len) GString *text = g_string_new("");
- char *node_name, *esc, *esc2, *tab = NULL;
+ char *node_name, *esc, *esc2; gboolean need_end = FALSE, pretty = TRUE;
g_return_val_if_fail(node != NULL, NULL);
- tab = g_strnfill(depth, '\t');
- text = g_string_append(text, tab);
node_name = g_markup_escape_text(node->name, -1);
g_string_append_printf(text,
"<span class=bracket><</span>"
@@ -115,11 +111,16 @@
"<span class=bracket>></span>%s",
for (c = node->child; c; c = c->next)
if (c->type == XMLNODE_TYPE_TAG) {
- esc = xmlnode_to_pretty_str(c, &esc_len, depth+1);
+ esc = xmlnode_to_pretty_str(c, &esc_len); + g_string_append(text, "<div class=tab>"); text = g_string_append_len(text, esc, esc_len);
} else if (c->type == XMLNODE_TYPE_DATA && c->data_sz > 0) {
@@ -129,8 +130,9 @@
- text = g_string_append(text, tab);
+ g_string_append(text, "</div>"); g_string_append_printf(text,
"<span class=bracket><</span>/"
"<span class=tag>%s</span>"
@@ -143,8 +145,6 @@
@@ -158,7 +158,7 @@
if (!console || console->gc != gc)
- str = xmlnode_to_pretty_str(*packet, NULL, 0);
+ str = xmlnode_to_pretty_str(*packet, NULL); formatted = g_strdup_printf("<div class=incoming>%s</div>", str);
gtk_webview_append_html(GTK_WEBVIEW(console->webview), formatted);
@@ -179,7 +179,7 @@
- str = xmlnode_to_pretty_str(node, NULL, 0);
+ str = xmlnode_to_pretty_str(node, NULL); formatted = g_strdup_printf("<div class=outgoing>%s</div>", str);
gtk_webview_append_html(GTK_WEBVIEW(console->webview), formatted);
@@ -750,8 +750,6 @@
dropdown_changed_cb(GtkComboBox *widget, gpointer nul)
- PurpleAccount *account;