# HG changeset patch # User Jeffrey Connelly # Date 1188796596 0 # Node ID d6802883e96e1a6b6c99a01218eaaac248f3fd8b # Parent 94a2a1ccd6ece41ba72c702541f9708e0a0d1f2c Treat status messages as the plaintext that they are. Specifically, strip markup on user-entered status text, and escape special characters on incoming status messages. Now status messages should be displayed correctly. Closes #2637. diff -r 94a2a1ccd6ec -r d6802883e96e libpurple/protocols/myspace/markup.c --- a/libpurple/protocols/myspace/markup.c Sun Sep 02 02:27:12 2007 +0000 +++ b/libpurple/protocols/myspace/markup.c Mon Sep 03 05:16:36 2007 +0000 @@ -669,6 +669,8 @@ /** High-level function to convert Purple (HTML) to MySpaceIM markup. * + * TODO: consider using purple_markup_html_to_xhtml() to make valid XML. + * * @return HTML markup string, must be g_free()'d. */ gchar * html_to_msim_markup(MsimSession *session, const gchar *raw) diff -r 94a2a1ccd6ec -r d6802883e96e libpurple/protocols/myspace/myspace.c --- a/libpurple/protocols/myspace/myspace.c Sun Sep 02 02:27:12 2007 +0000 +++ b/libpurple/protocols/myspace/myspace.c Mon Sep 03 05:16:36 2007 +0000 @@ -1066,9 +1066,12 @@ statstring = purple_status_get_attr_string(status, "message"); if (!statstring) { - statstring = g_strdup(""); + statstring = ""; } + /* Status strings are plain text. */ + statstring = purple_markup_strip_html(statstring); + msim_set_status_code(session, status_code, g_strdup(statstring)); } @@ -1713,7 +1716,7 @@ PurpleBuddyList *blist; MsimUser *user; GList *list; - gchar *status_headline; + gchar *status_headline, *status_headline_escaped; gint status_code, purple_status_code; gchar *username; @@ -1768,8 +1771,16 @@ purple_debug_info("msim", "msim_status: found buddy %s\n", username); } + /* The status headline is plaintext, but libpurple treats it as HTML, + * so escape any HTML characters to their entity equivalents. */ + status_headline_escaped = g_markup_escape_text(status_headline, strlen(status_headline)); + g_free(status_headline); + + if (user->headline) + g_free(user->headline); + /* don't copy; let the MsimUser own the headline, memory-wise */ - user->headline = status_headline; + user->headline = status_headline_escaped; /* Set user status */ switch (status_code) {