changeset 31920:0cc718e10344

Actually commit the purple_notify_user_info_prepend_pair_plaintext function. I think I left it off my previous commit? Sorry. And rename purple_notify_user_info_prepend_pair to purple_notify_user_info_prepend_pair_html_html
author Mark Doliner <mark@kingant.net>
date Mon, 22 Aug 2011 06:32:44 +0000
parents 090736a289da
children 4f2d99bcb195
files ChangeLog.API libpurple/notify.c libpurple/notify.h libpurple/plugins/perl/common/Notify.xs libpurple/protocols/jabber/buddy.c libpurple/protocols/msn/msn.c
diffstat 6 files changed, 34 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog.API	Mon Aug 22 06:25:23 2011 +0000
+++ b/ChangeLog.API	Mon Aug 22 06:32:44 2011 +0000
@@ -5,6 +5,7 @@
 		Added:
 		* purple_notify_searchresult_column_set_visible
 		* purple_notify_searchresult_column_is_visible
+		* purple_notify_user_info_prepend_pair_plaintext
 		* purple_request_field_set_tooltip
 		* purple_request_field_get_tooltip
 
@@ -15,6 +16,8 @@
 		  purple_notify_user_info_add_pair_html
 		* purple_notify_user_info_get_entries returns a GQueue instead of
 		  a GList
+		* purple_notify_user_info_prepend_pair renamed to
+		  purple_notify_user_info_prepend_pair_html_html
 		* purple_util_fetch_url_request_len now takes a PurpleAccount as
 		  the first parameter
 		* PurpleConnectionUiOps.report_disconnect now passes a
--- a/libpurple/notify.c	Mon Aug 22 06:25:23 2011 +0000
+++ b/libpurple/notify.c	Mon Aug 22 06:32:44 2011 +0000
@@ -594,7 +594,7 @@
 }
 
 void
-purple_notify_user_info_prepend_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value)
+purple_notify_user_info_prepend_pair_html(PurpleNotifyUserInfo *user_info, const char *label, const char *value)
 {
 	PurpleNotifyUserInfoEntry *entry;
 
@@ -603,6 +603,16 @@
 }
 
 void
+purple_notify_user_info_prepend_pair_plaintext(PurpleNotifyUserInfo *user_info, const char *label, const char *value)
+{
+	gchar *escaped;
+
+	escaped = g_markup_escape_text(value, -1);
+	purple_notify_user_info_prepend_pair_html(user_info, label, escaped);
+	g_free(escaped);
+}
+
+void
 purple_notify_user_info_remove_entry(PurpleNotifyUserInfo *user_info, PurpleNotifyUserInfoEntry *entry)
 {
 	g_return_if_fail(user_info != NULL);
--- a/libpurple/notify.h	Mon Aug 22 06:25:23 2011 +0000
+++ b/libpurple/notify.h	Mon Aug 22 06:32:44 2011 +0000
@@ -489,19 +489,16 @@
 void purple_notify_user_info_add_pair_plaintext(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
 
 /**
- * Prepend a label/value pair to a PurpleNotifyUserInfo object
- *
- * @param user_info  The PurpleNotifyUserInfo
- * @param label      A label, which for example might be displayed by a
- *                   UI with a colon after it ("Status:"). Do not include
- *                   a colon.  If NULL, value will be displayed without a
- *                   label.
- * @param value      The value, which might be displayed by a UI after
- *                   the label.  If NULL, label will still be displayed;
- *                   the UI should then treat label as independent and not
- *                   include a colon if it would otherwise.
+ * Like purple_notify_user_info_add_pair_html, but the pair is inserted
+ * at the beginning of the list.
  */
-void purple_notify_user_info_prepend_pair(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
+void purple_notify_user_info_prepend_pair_html(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
+
+/**
+ * Like purple_notify_user_info_prepend_pair_html, but value should be plaintext
+ * and will be escaped using g_markup_escape_text().
+ */
+void purple_notify_user_info_prepend_pair_plaintext(PurpleNotifyUserInfo *user_info, const char *label, const char *value);
 
 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_NOTIFY_C_)
 /**
@@ -525,9 +522,10 @@
  * If added to a PurpleNotifyUserInfo object, this should not be free()'d,
  * as PurpleNotifyUserInfo will do so when destroyed.
  * purple_notify_user_info_add_pair_html(),
- * purple_notify_user_info_add_pair_plaintext() and
- * purple_notify_user_info_prepend_pair() are convenience methods for
- * creating entries and adding them to a PurpleNotifyUserInfo.
+ * purple_notify_user_info_add_pair_plaintext(),
+ * purple_notify_user_info_prepend_pair_html() and
+ * purple_notify_user_info_prepend_pair_plaintext() are convenience
+ * methods for creating entries and adding them to a PurpleNotifyUserInfo.
  *
  * @param label  A label, which for example might be displayed by a UI
  *               with a colon after it ("Status:"). Do not include a
--- a/libpurple/plugins/perl/common/Notify.xs	Mon Aug 22 06:25:23 2011 +0000
+++ b/libpurple/plugins/perl/common/Notify.xs	Mon Aug 22 06:32:44 2011 +0000
@@ -150,7 +150,7 @@
 	const char *label
 	const char *value
 
-void purple_notify_user_info_prepend_pair(user_info, label, value)
+void purple_notify_user_info_prepend_pair_html(user_info, label, value)
 	Purple::NotifyUserInfo user_info
 	const char *label
 	const char *value
--- a/libpurple/protocols/jabber/buddy.c	Mon Aug 22 06:25:23 2011 +0000
+++ b/libpurple/protocols/jabber/buddy.c	Mon Aug 22 06:32:44 2011 +0000
@@ -733,13 +733,13 @@
 		                    (jbr->client.version ? jbr->client.version : ""));
 		/* TODO: Check whether it's correct to call prepend_pair_html,
 		         or if we should be using prepend_pair_plaintext */
-		purple_notify_user_info_prepend_pair(user_info, _("Client"), tmp);
+		purple_notify_user_info_prepend_pair_html(user_info, _("Client"), tmp);
 		g_free(tmp);
 
 		if (jbr->client.os) {
 			/* TODO: Check whether it's correct to call prepend_pair_html,
 			         or if we should be using prepend_pair_plaintext */
-			purple_notify_user_info_prepend_pair(user_info, _("Operating System"), jbr->client.os);
+			purple_notify_user_info_prepend_pair_html(user_info, _("Operating System"), jbr->client.os);
 		}
 	}
 
@@ -784,7 +784,7 @@
 		tmp = g_strdup_printf("%s%s%s", (status_name ? status_name : ""),
 						((status_name && purdy) ? ": " : ""),
 						(purdy ? purdy : ""));
-		purple_notify_user_info_prepend_pair(user_info, _("Status"), tmp);
+		purple_notify_user_info_prepend_pair_html(user_info, _("Status"), tmp);
 
 		g_snprintf(priority, sizeof(priority), "%d", jbr->priority);
 		purple_notify_user_info_prepend_pair_plaintext(user_info, _("Priority"), priority);
@@ -835,7 +835,7 @@
 			if (jbr->name) {
 				/* TODO: Check whether it's correct to call prepend_pair_html,
 				         or if we should be using prepend_pair_plaintext */
-				purple_notify_user_info_prepend_pair(user_info, _("Resource"), jbr->name);
+				purple_notify_user_info_prepend_pair_html(user_info, _("Resource"), jbr->name);
 			}
 		}
 	}
@@ -868,7 +868,7 @@
 				                jbi->last_message ? jbi->last_message : "");
 			/* TODO: Check whether it's correct to call prepend_pair_html,
 			         or if we should be using prepend_pair_plaintext */
-			purple_notify_user_info_prepend_pair(user_info, _("Status"), status);
+			purple_notify_user_info_prepend_pair_html(user_info, _("Status"), status);
 			g_free(status);
 		}
 	}
--- a/libpurple/protocols/msn/msn.c	Mon Aug 22 06:25:23 2011 +0000
+++ b/libpurple/protocols/msn/msn.c	Mon Aug 22 06:32:44 2011 +0000
@@ -2812,7 +2812,7 @@
 			purple_debug_info("msn", "%s is %" G_GSIZE_FORMAT " bytes\n", photo_url_text, len);
 			id = purple_imgstore_add_with_id(g_memdup(url_text, len), len, NULL);
 			g_snprintf(buf, sizeof(buf), "<img id=\"%d\"><br>", id);
-			purple_notify_user_info_prepend_pair(user_info, NULL, buf);
+			purple_notify_user_info_prepend_pair_html(user_info, NULL, buf);
 		}
 	}