Mercurial > pidgin.yaz
changeset 19716:a359452f9ea2
Take aliases into account for the attention messages.
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Mon, 10 Sep 2007 21:06:14 +0000 |
parents | 472e263e88a8 |
children | 159a46ec0e33 |
files | libpurple/server.c |
diffstat | 1 files changed, 18 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/server.c Mon Sep 10 20:56:02 2007 +0000 +++ b/libpurple/server.c Mon Sep 10 21:06:14 2007 +0000 @@ -274,7 +274,8 @@ PurplePlugin *prpl; PurpleConversation *conv; gboolean (*send_attention)(PurpleConnection *, const char *, guint); - + PurpleBuddy *buddy; + const char *alias; gchar *description; time_t mtime; @@ -289,10 +290,15 @@ attn = purple_get_attention_type_from_code(gc->account, type_code); + if ((buddy = purple_find_buddy(purple_connection_get_account(gc), who)) != NULL) + alias = purple_buddy_get_contact_alias(buddy); + else + alias = who; + if (attn && attn->outgoing_description) { - description = g_strdup_printf(attn->outgoing_description, who); + description = g_strdup_printf(attn->outgoing_description, alias); } else { - description = g_strdup_printf(_("Requesting %s's attention..."), who); + description = g_strdup_printf(_("Requesting %s's attention..."), alias); } flags = PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_NOTIFY | PURPLE_MESSAGE_SYSTEM; @@ -314,6 +320,8 @@ { PurpleMessageFlags flags; PurpleAttentionType *attn; + PurpleBuddy *buddy; + const char *alias; gchar *description; time_t mtime; @@ -327,10 +335,15 @@ /* TODO: if (attn->icon_name) is non-null, use it to lookup an emoticon and display * it next to the attention command. And if it is null, display a generic icon. */ + if ((buddy = purple_find_buddy(purple_connection_get_account(gc), who)) != NULL) + alias = purple_buddy_get_contact_alias(buddy); + else + alias = who; + if (attn && attn->incoming_description) { - description = g_strdup_printf(attn->incoming_description, who); + description = g_strdup_printf(attn->incoming_description, alias); } else { - description = g_strdup(_("%s has requested your attention!")); + description = g_strdup_printf(_("%s has requested your attention!"), alias); } purple_debug_info("server", "serv_got_attention: got '%s' from %s\n",