# HG changeset patch # User Mark Doliner # Date 1313994764 0 # Node ID 0cc718e10344ec70e2d39c0eb38107f246e691bf # Parent 090736a289da6df2c01da63e77b29a46f149f63c 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 diff -r 090736a289da -r 0cc718e10344 ChangeLog.API --- 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 diff -r 090736a289da -r 0cc718e10344 libpurple/notify.c --- 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); diff -r 090736a289da -r 0cc718e10344 libpurple/notify.h --- 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 diff -r 090736a289da -r 0cc718e10344 libpurple/plugins/perl/common/Notify.xs --- 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 diff -r 090736a289da -r 0cc718e10344 libpurple/protocols/jabber/buddy.c --- 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); } } diff -r 090736a289da -r 0cc718e10344 libpurple/protocols/msn/msn.c --- 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), "
", id); - purple_notify_user_info_prepend_pair(user_info, NULL, buf); + purple_notify_user_info_prepend_pair_html(user_info, NULL, buf); } }