diff libpurple/protocols/msn/msn.c @ 20502:b5a2938b4549

Fixes #2502, now we show the status name in the tooltip instead of "Status" if the buddy is not available
author Ka-Hing Cheung <khc@hxbc.us>
date Wed, 12 Sep 2007 02:40:56 +0000
parents 64c322c3b1b0
children 723b5a2f91ce
line wrap: on
line diff
--- a/libpurple/protocols/msn/msn.c	Sun Sep 09 01:42:46 2007 +0000
+++ b/libpurple/protocols/msn/msn.c	Wed Sep 12 02:40:56 2007 +0000
@@ -582,13 +582,31 @@
 	
 	if (purple_presence_is_online(presence))
 	{
-		const char *psm, *currentmedia;
+		const char *psm, *currentmedia, *name;
 		char *tmp;
 
 		psm = purple_status_get_attr_string(status, "message");
 		currentmedia = purple_status_get_attr_string(status, "currentmedia");
 
-		if (psm && *psm) {
+		if (!purple_presence_is_available(presence)) {
+			name = purple_status_get_name(status);
+		} else {
+			name = NULL;
+		}
+
+		if (name != NULL && *name) {
+			char *tmp2 = g_markup_escape_text(name, -1);
+
+			if (psm != NULL && *psm) {
+				tmp = g_markup_escape_text(psm, -1);
+				purple_notify_user_info_add_pair(user_info, tmp2, tmp);
+				g_free(tmp);
+			} else {
+				purple_notify_user_info_add_pair(user_info, _("Status"), tmp2);
+			}
+
+			g_free(tmp2);
+		} else {
 			tmp = g_markup_escape_text(psm, -1);
 			purple_notify_user_info_add_pair(user_info, _("Status"), tmp);
 			g_free(tmp);