changeset 14060:81648c6aa918

[gaim-migrate @ 16678] Show timestamps (or not) in conversations. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 09 Aug 2006 06:23:18 +0000
parents 2d1b41e3cf0d
children eb58c6169e6c
files console/gntconv.c console/libgnt/gntutils.c
diffstat 2 files changed, 18 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/console/gntconv.c	Wed Aug 09 03:41:45 2006 +0000
+++ b/console/gntconv.c	Wed Aug 09 06:23:18 2006 +0000
@@ -229,6 +229,9 @@
 
 	g_return_if_fail(ggconv != NULL);
 
+	if (gaim_prefs_get_bool("/gaim/gnt/conversations/timestamps"))
+		gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv),
+					gaim_utf8_strftime("(%H:%M:%S) ", localtime(&mtime)), GNT_TEXT_FLAG_DIM);
 	if (who && *who && (flags & (GAIM_MESSAGE_SEND | GAIM_MESSAGE_RECV)))
 	{
 		char * name = g_strdup_printf("%s: ", who);
--- a/console/libgnt/gntutils.c	Wed Aug 09 03:41:45 2006 +0000
+++ b/console/libgnt/gntutils.c	Wed Aug 09 06:23:18 2006 +0000
@@ -8,23 +8,26 @@
 
 	/* XXX: ew ... everyone look away */
 	last = s;
-	while (*s)
+	if (s)
 	{
-		if (*s == '\n' || *s == '\r')
+		while (*s)
 		{
-			count++;
-			len = g_utf8_pointer_to_offset(last, s);
-			if (max < len)
-				max = len;
-			last = s + 1;
+			if (*s == '\n' || *s == '\r')
+			{
+				count++;
+				len = g_utf8_pointer_to_offset(last, s);
+				if (max < len)
+					max = len;
+				last = s + 1;
+			}
+			s++;
 		}
-		s++;
+
+		len = g_utf8_pointer_to_offset(last, s);
+		if (max < len)
+			max = len;
 	}
 
-	len = g_utf8_pointer_to_offset(last, s);
-	if (max < len)
-		max = len;
-
 	if (height)
 		*height = count;
 	if (width)