Mercurial > pidgin
diff libpurple/protocols/myspace/myspace.c @ 19592:d6802883e96e
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.
author | Jeffrey Connelly <jaconnel@calpoly.edu> |
---|---|
date | Mon, 03 Sep 2007 05:16:36 +0000 |
parents | 94a2a1ccd6ec |
children | 30625863ae2b |
line wrap: on
line diff
--- 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) {