changeset 13537:207f974ca030

[gaim-migrate @ 15914] System logging for status changes: Make the messages more generic. Instead of 'USER has signed off.', 'USER has signed on.', etc., we now have 'USER has changed status from OLD_STATUS to NEW_STATUS.' (and a couple of messages for independent statuses). This was Mark's idea, for better or worse. ;) committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 21 Mar 2006 01:05:34 +0000
parents 977714c5e8a6
children 60de8d24831d
files src/status.c
diffstat 1 files changed, 25 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/src/status.c	Tue Mar 21 01:00:58 2006 +0000
+++ b/src/status.c	Tue Mar 21 01:05:34 2006 +0000
@@ -614,49 +614,39 @@
 	{
 		time_t current_time = time(NULL);
 		const char *buddy_alias = gaim_buddy_get_alias(buddy);
-		char *tmp = NULL;
+		char *tmp;
+		GaimLog *log;
 
-		if ((old_status != NULL) &&
-			!gaim_status_is_online(old_status) &&
-			gaim_status_is_online(new_status))
+		if (old_status != NULL)
 		{
-			tmp = g_strdup_printf(_("%s signed on"), buddy_alias);
+			tmp = g_strdup_printf(_("%s changed status from %s to %s"), buddy_alias,
+			                      gaim_status_get_name(old_status),
+			                      gaim_status_get_name(new_status));
 		}
-		else if ((old_status != NULL) &&
-				 gaim_status_is_online(old_status) &&
-				 !gaim_status_is_online(new_status))
+		else
 		{
-			tmp = g_strdup_printf(_("%s signed off"), buddy_alias);
-		}
-		else if (((old_status == NULL) || !gaim_status_is_available(old_status)) &&
-				 gaim_status_is_available(new_status))
-		{
-			tmp = g_strdup_printf(_("%s came back"), buddy_alias);
-		}
-		else if (((old_status == NULL) || gaim_status_is_available(old_status)) &&
-				 !gaim_status_is_available(new_status))
-		{
-			tmp = g_strdup_printf(_("%s went away"), buddy_alias);
+			/* old_status == NULL when an independent status is toggled. */
+
+			if (gaim_status_is_active(new_status))
+			{
+				tmp = g_strdup_printf(_("%s is now %s"), buddy_alias,
+				                      gaim_status_get_name(new_status));
+			}
+			else
+			{
+				tmp = g_strdup_printf(_("%s is no longer %s"), buddy_alias,
+				                      gaim_status_get_name(new_status));
+			}
 		}
 
-		/* After the string freeze, get rid of the above crap and use this. */
-		/*
-		tmp = g_strdup_printf(_("%s is now %s"), buddy_alias,
-							  gaim_status_get_name(new_status));
-		*/
-
-		if (tmp != NULL)
+		log = gaim_account_get_log(buddy->account, FALSE);
+		if (log != NULL)
 		{
-			GaimLog *log = gaim_account_get_log(buddy->account, FALSE);
+			gaim_log_write(log, GAIM_MESSAGE_SYSTEM, buddy_alias,
+			               current_time, tmp);
+		}
 
-			if (log != NULL)
-			{
-				gaim_log_write(log, GAIM_MESSAGE_SYSTEM, buddy_alias,
-				               current_time, tmp);
-			}
-
-			g_free(tmp);
-		}
+		g_free(tmp);
 	}
 
 	if (ops != NULL && ops->update != NULL)