changeset 10057:5d2a08d82e7a

[gaim-migrate @ 11022] (20:52:20) nosnilmot: I also have a patch that makes MSN status stuff better (21:00:20) LSchiere: and the other? (21:00:57) nosnilmot: "bleh, I made it compile and work earlier, this might work a bit better and mean something now that I can test it" committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 21 Sep 2004 01:00:19 +0000
parents b566449d45f8
children 514768e1db90
files src/protocols/msn/msn.c src/protocols/msn/notification.c
diffstat 2 files changed, 39 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/msn.c	Tue Sep 21 00:58:41 2004 +0000
+++ b/src/protocols/msn/msn.c	Tue Sep 21 01:00:19 2004 +0000
@@ -404,7 +404,8 @@
 	else if (gaim_presence_is_status_active(presence, "busy") ||
 			 gaim_presence_is_status_active(presence, "phone"))
 		emblems[i++] = "occupied";
-	else if (gaim_presence_is_status_active(presence, "away"))
+	else if (gaim_presence_is_status_active(presence, "away") ||
+			 gaim_presence_is_idle(presence))
 		emblems[i++] = "away";
 
 	if (user == NULL)
@@ -423,20 +424,36 @@
 static char *
 msn_status_text(GaimBuddy *buddy)
 {
-	GString *s;
 	GaimPresence *presence;
 	GaimStatus *status;
-	MsnUser *user;
 
-	s = g_string_new("");
-	user = buddy->proto_data;
 	presence = gaim_buddy_get_presence(buddy);
 	status = gaim_presence_get_active_status(presence);
 
-	if (!gaim_status_is_available(status))
+	if (!gaim_presence_is_available(presence) && !gaim_presence_is_idle(presence))
+	{
+		return g_strdup(gaim_status_get_name(status));
+	}
+
+	return NULL;
+}
+
+static char *
+msn_tooltip_text(GaimBuddy *buddy)
+{
+	MsnUser *user;
+	GaimPresence *presence = gaim_buddy_get_presence(buddy);
+	GaimStatus *status = gaim_presence_get_active_status(presence);
+	GString *s;
+
+	user = buddy->proto_data;
+
+	s = g_string_new("");
+	if (gaim_presence_is_online(presence))
 	{
 		g_string_append_printf(s, _("\n<b>%s:</b> %s"), _("Status"),
-							   gaim_status_get_name(status));
+							   gaim_presence_is_idle(presence) ?
+							   _("Idle") : gaim_status_get_name(status));
 	}
 
 	g_string_append_printf(s, _("\n<b>%s:</b> %s"), _("Has you"),
@@ -446,43 +463,22 @@
 	return g_string_free(s, FALSE);
 }
 
-static char *
-msn_tooltip_text(GaimBuddy *buddy)
-{
-	GaimPresence *presence = gaim_buddy_get_presence(buddy);
-	GaimStatus *status = gaim_presence_get_active_status(presence);
-	char *text = NULL;
-
-	if (gaim_presence_is_online(presence))
-	{
-		text = g_strdup_printf(_("\n<b>%s:</b> %s"), _("Status"),
-				gaim_status_get_name(status));
-	}
-
-	return text;
-}
-
 static GList *
 msn_status_types(GaimAccount *account)
 {
 	GaimStatusType *status;
 	GList *types = NULL;
 
-	status = gaim_status_type_new(GAIM_STATUS_OFFLINE,
-			"offline", _("Offline"), FALSE);
+	status = gaim_status_type_new_full(GAIM_STATUS_OFFLINE,
+			"offline", _("Offline"), FALSE, FALSE, FALSE);
 	types = g_list_append(types, status);
 
-	status = gaim_status_type_new(GAIM_STATUS_ONLINE,
-			"online", _("Online"), FALSE);
+	status = gaim_status_type_new_full(GAIM_STATUS_ONLINE,
+			"online", _("Online"), FALSE, FALSE, FALSE);
 	types = g_list_append(types, status);
 
 	status = gaim_status_type_new_full(GAIM_STATUS_AVAILABLE,
-			"available", _("Available"), FALSE, FALSE, FALSE);
-	types = g_list_append(types, status);
-
-	status = gaim_status_type_new_full(GAIM_STATUS_UNAVAILABLE,
-			"unavailable", _("Unavailable"),
-			FALSE, FALSE, FALSE);
+			"available", _("Available"), FALSE, TRUE, FALSE);
 	types = g_list_append(types, status);
 
 	status = gaim_status_type_new_full(GAIM_STATUS_AWAY, "away",
--- a/src/protocols/msn/notification.c	Tue Sep 21 00:58:41 2004 +0000
+++ b/src/protocols/msn/notification.c	Tue Sep 21 01:00:19 2004 +0000
@@ -495,11 +495,6 @@
 
 	if (!g_ascii_strcasecmp(state, "BSY"))
 		status = "busy";
-	else if (!g_ascii_strcasecmp(state, "IDL"))
-	{
-		/* XXX - Do something about idle time? */
-		status = "idle";
-	}
 	else if (!g_ascii_strcasecmp(state, "BRB"))
 		status = "brb";
 	else if (!g_ascii_strcasecmp(state, "AWY"))
@@ -512,6 +507,11 @@
 		status = "available";
 
 	gaim_prpl_got_user_status(account, passport, status, NULL);
+
+	if (!g_ascii_strcasecmp(state, "IDL"))
+		gaim_prpl_got_user_idle(account, passport, TRUE, -1);
+	else
+		gaim_prpl_got_user_idle(account, passport, FALSE, 0);
 }
 
 static void
@@ -573,11 +573,6 @@
 
 	if (!g_ascii_strcasecmp(state, "BSY"))
 		status = "busy";
-	else if (!g_ascii_strcasecmp(state, "IDL"))
-	{
-		/* XXX - Do something about idle time? */
-		status = "idle";
-	}
 	else if (!g_ascii_strcasecmp(state, "BRB"))
 		status = "brb";
 	else if (!g_ascii_strcasecmp(state, "AWY"))
@@ -590,6 +585,11 @@
 		status = "available";
 
 	gaim_prpl_got_user_status(account, passport, status, NULL);
+
+	if (!g_ascii_strcasecmp(state, "IDL"))
+		gaim_prpl_got_user_idle(account, passport, TRUE, -1);
+	else
+		gaim_prpl_got_user_idle(account, passport, FALSE, 0);
 }
 
 static void