summary refs log tree commit diff stats
path: root/src/fe-gtk
diff options
context:
space:
mode:
authorTingPing <tngpng@gmail.com>2013-05-08 19:08:37 -0300
committerTingPing <tngpng@gmail.com>2013-05-08 19:08:37 -0300
commitdf7a15e9105ccca0306b674b94b2fc0985f278de (patch)
tree9cc0c7277a89bdab129f5c7a4b8f52aaa7704fbf /src/fe-gtk
parent860ef759f5b5256a5827fa8d0b29d465aba71f11 (diff)
Show hours for last seen in friends list
closes #579
Diffstat (limited to 'src/fe-gtk')
-rw-r--r--src/fe-gtk/notifygui.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/fe-gtk/notifygui.c b/src/fe-gtk/notifygui.c
index 3c3b6a6e..872fb7ed 100644
--- a/src/fe-gtk/notifygui.c
+++ b/src/fe-gtk/notifygui.c
@@ -144,7 +144,7 @@ notify_gui_update (void)
 	GSList *list = notify_list;
 	GSList *slist;
 	gchar *name, *status, *server, *seen;
-	int online, servcount;
+	int online, servcount, lastseenminutes;
 	time_t lastseen;
 	char agobuf[128];
 
@@ -187,7 +187,13 @@ notify_gui_update (void)
 				seen = _("Never");
 			else
 			{
-				snprintf (agobuf, sizeof (agobuf), _("%d minutes ago"), (int)(time (0) - lastseen) / 60);
+				lastseenminutes = (int)(time (0) - lastseen) / 60;
+				if (lastseenminutes < 60) 
+					snprintf (agobuf, sizeof (agobuf), _("%d minutes ago"), lastseenminutes);
+				else if (lastseenminutes < 120)
+					snprintf (agobuf, sizeof (agobuf), _("An hour ago"));
+				else
+					snprintf (agobuf, sizeof (agobuf), _("%d hours ago"), lastseenminutes / 60);
 				seen = agobuf;
 			}
 			if (!valid)	/* create new tree row if required */