# HG changeset patch # User Sean Egan # Date 1180048446 0 # Node ID 77b15be2179f269eb2526b4fce6351fc02bf217b # Parent a7c07b57f3e4010fc6be1f596f1b157bcb6cc2ee Convert newlines to ' ' when receiving XHTML from Jabber diff -r a7c07b57f3e4 -r 77b15be2179f libpurple/protocols/jabber/message.c --- a/libpurple/protocols/jabber/message.c Thu May 24 22:39:22 2007 +0000 +++ b/libpurple/protocols/jabber/message.c Thu May 24 23:14:06 2007 +0000 @@ -324,8 +324,17 @@ g_free(msg); } } else if(!strcmp(child->name, "html")) { - if(!jm->xhtml && xmlnode_get_child(child, "body")) + if(!jm->xhtml && xmlnode_get_child(child, "body")) { + char *c; jm->xhtml = xmlnode_to_str(child, NULL); + /* Convert all newlines to whitespace. Technically, even regular, non-XML HTML is supposed to ignore newlines, but Pidgin has, as convention + * treated \n as a newline for compatibility with other protocols + */ + for (c = jm->xhtml; *c != '\0'; c++) { + if (*c == '\n') + *c = ' '; + } + } } else if(!strcmp(child->name, "active")) { jm->chat_state = JM_STATE_ACTIVE; jm->typing_style |= JM_TS_JEP_0085; @@ -535,6 +544,7 @@ char *buf; char *xhtml; char *resource; + char *c; if(!who || !msg) return 0; @@ -569,7 +579,7 @@ } buf = g_strdup_printf("%s", msg); - + purple_markup_html_to_xhtml(buf, &xhtml, &jm->body); g_free(buf);