diff libpurple/notify.c @ 31361:0123c69ec0e5

Add a purple_notify_user_info_add_pair_plaintext function that accepts a plaintext value and escapes it. This is a convenience function. Previously callers would have to escape the value themselves. The motivation for this is that a lot of callers didn't escape the value when they should have. See these screenshots for an example of the problem this causes: Here's what I set my jabber info to: http://img29.imageshack.us/i/screenshotafter.png/ Here's what the old code displayed when I viewed info for myself (incorrect): http://img691.imageshack.us/i/screenshotbeforev.png/ Here's what the new code displays (correct): http://img192.imageshack.us/i/screenshotafter.png/
author Mark Doliner <mark@kingant.net>
date Thu, 08 Jul 2010 22:38:33 +0000
parents 584063555949
children 63fb41aa3dbe
line wrap: on
line diff
--- a/libpurple/notify.c	Thu Jul 08 22:23:43 2010 +0000
+++ b/libpurple/notify.c	Thu Jul 08 22:38:33 2010 +0000
@@ -602,6 +602,18 @@
 }
 
 void
+purple_notify_user_info_add_pair_plaintext(PurpleNotifyUserInfo *user_info, const char *label, const char *value)
+{
+	gchar *escaped;
+	PurpleNotifyUserInfoEntry *entry;
+
+	escaped = g_markup_escape_text(value, -1);
+	entry = purple_notify_user_info_entry_new(label, escaped);
+	g_free(escaped);
+	user_info->user_info_entries = g_list_append(user_info->user_info_entries, entry);
+}
+
+void
 purple_notify_user_info_prepend_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value)
 {
 	PurpleNotifyUserInfoEntry *entry;