Mercurial > pidgin.yaz
changeset 32371:7422716de669
Now that there's no speed difference between
purple_notify_user_info_add_pair_html and
purple_notify_user_info_prepend_pair, use the former to that we don't
add items in reverse order. This is hopefully a little less error
prone? It also means we won't have to create separate prepend_pair_html
and prepend_pair_plaintext functions
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 22 Aug 2011 05:39:00 +0000 |
parents | 8a55048115ab |
children | 16f241146576 e1b70ca6bfd7 |
files | libpurple/protocols/jabber/buddy.c |
diffstat | 1 files changed, 40 insertions(+), 39 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/buddy.c Mon Aug 22 04:24:12 2011 +0000 +++ b/libpurple/protocols/jabber/buddy.c Mon Aug 22 05:39:00 2011 +0000 @@ -726,16 +726,39 @@ jbir = g_hash_table_lookup(jbi->resources, resource); user_info = jbi->user_info; - if (jbr && jbr->client.name) { - char *tmp = - g_strdup_printf("%s%s%s", jbr->client.name, - (jbr->client.version ? " " : ""), - (jbr->client.version ? jbr->client.version : "")); - purple_notify_user_info_prepend_pair(user_info, _("Client"), tmp); + if (jbr) { + char *purdy = NULL; + char *tmp; + char priority[12]; + const char *status_name = jabber_buddy_state_get_name(jbr->state); + + g_snprintf(priority, sizeof(priority), "%d", jbr->priority); + purple_notify_user_info_add_pair_html(user_info, _("Priority"), priority); + + if (jbr->status) { + tmp = purple_markup_escape_text(jbr->status, -1); + purdy = purple_strdup_withhtml(tmp); + g_free(tmp); + + if (purple_strequal(status_name, purdy)) + status_name = NULL; + } + + tmp = g_strdup_printf("%s%s%s", (status_name ? status_name : ""), + ((status_name && purdy) ? ": " : ""), + (purdy ? purdy : "")); + purple_notify_user_info_add_pair_html(user_info, _("Status"), tmp); + g_free(tmp); + g_free(purdy); + } else { + purple_notify_user_info_add_pair_html(user_info, _("Status"), _("Unknown")); + } - if (jbr->client.os) - purple_notify_user_info_prepend_pair(user_info, _("Operating System"), jbr->client.os); + if (jbir && jbir->idle_seconds > 0) { + char *idle = purple_str_seconds_to_string(jbir->idle_seconds); + purple_notify_user_info_add_pair_html(user_info, _("Idle"), idle); + g_free(idle); } if (jbr && jbr->tz_off != PURPLE_NO_TZ_OFF) { @@ -751,43 +774,21 @@ jbr->tz_off < 0 ? '-' : '+', abs(jbr->tz_off / (60*60)), abs((jbr->tz_off % (60*60)) / 60)); - purple_notify_user_info_prepend_pair(user_info, _("Local Time"), timestamp); + purple_notify_user_info_add_pair_html(user_info, _("Local Time"), timestamp); g_free(timestamp); } - if (jbir && jbir->idle_seconds > 0) { - char *idle = purple_str_seconds_to_string(jbir->idle_seconds); - purple_notify_user_info_prepend_pair(user_info, _("Idle"), idle); - g_free(idle); - } + if (jbr && jbr->client.name) { + char *tmp; - if (jbr) { - char *purdy = NULL; - char *tmp; - char priority[12]; - const char *status_name = jabber_buddy_state_get_name(jbr->state); - - if (jbr->status) { - tmp = purple_markup_escape_text(jbr->status, -1); - purdy = purple_strdup_withhtml(tmp); - g_free(tmp); + if (jbr->client.os) + purple_notify_user_info_add_pair_html(user_info, _("Operating System"), jbr->client.os); - if (purple_strequal(status_name, purdy)) - status_name = NULL; - } - - 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); - - g_snprintf(priority, sizeof(priority), "%d", jbr->priority); - purple_notify_user_info_prepend_pair(user_info, _("Priority"), priority); - + tmp = g_strdup_printf("%s%s%s", jbr->client.name, + (jbr->client.version ? " " : ""), + (jbr->client.version ? jbr->client.version : "")); + purple_notify_user_info_add_pair_html(user_info, _("Client"), tmp); g_free(tmp); - g_free(purdy); - } else { - purple_notify_user_info_prepend_pair(user_info, _("Status"), _("Unknown")); } }