changeset 8864:8ab568b92480

[gaim-migrate @ 9632] " I like the iChat style timestamp, but it's annoying that it constantly adds the timestamp, scrolling old msgs off the screen. This patch will make it only add a timestamp if there have been messages since the last timestamp. Adding a preference checkbox for this is left as an exercise for the reader." --Robert Story as this behavior seems to me more intuitive, i'm going ahead with this patch committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Mon, 03 May 2004 18:00:46 +0000
parents 75849c0650e5
children 12791b1a13ee
files COPYRIGHT ChangeLog plugins/timestamp.c
diffstat 3 files changed, 26 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Mon May 03 17:55:46 2004 +0000
+++ b/COPYRIGHT	Mon May 03 18:00:46 2004 +0000
@@ -122,6 +122,7 @@
 Lex Spoon
 Kevin Stange
 David Stoddard
+Robert Story
 Sun Microsystems
 Mårten (fursten) Svantesson
 Brian Tarricone
--- a/ChangeLog	Mon May 03 17:55:46 2004 +0000
+++ b/ChangeLog	Mon May 03 18:00:46 2004 +0000
@@ -21,6 +21,7 @@
 	  the conversation window is closed, preventing a crash (Kevin Stange)
 	* Gtk2.0 compatibility fixes (Tim Ringenbach)
 	* Updated and standardized blist signals (Gary Kramlich)
+	* The timestamp plugin won't spam the conversation now (Robert Story)
 
 version 0.77 (04/22/2004):
 	New Features:
--- a/plugins/timestamp.c	Mon May 03 17:55:46 2004 +0000
+++ b/plugins/timestamp.c	Mon May 03 18:00:46 2004 +0000
@@ -46,14 +46,34 @@
 	char *buf;
 	char mdate[6];
 	time_t tim = time(NULL);
+        gsize len = 0;
 
 	if (!g_list_find(gaim_get_conversations(), c))
 		return FALSE;
 
-	strftime(mdate, sizeof(mdate), "%H:%M", localtime(&tim));
-	buf = g_strdup_printf("            %s", mdate);
-	gaim_conversation_write(c, NULL, buf, GAIM_MESSAGE_NO_LOG, tim);
-	g_free(buf);
+        len = GPOINTER_TO_INT(
+            gaim_conversation_get_data(c, "timestamp-last-size"));
+        if((NULL != c->history) && (len != c->history->len)) {
+
+            strftime(mdate, sizeof(mdate), "%02H:%02M", localtime(&tim));
+            buf = g_strdup_printf("%s", mdate);
+        }
+#ifndef DEBUG_TIMESTAMP
+        else {
+            return TRUE;
+        }
+#else
+        else {
+            buf = g_strdup_printf("NC");
+        }
+#endif
+
+        gaim_conversation_write(c, NULL, buf, GAIM_MESSAGE_NO_LOG, tim);
+        g_free(buf);
+
+        gaim_conversation_set_data(c, "timestamp-last-size",
+                                   GINT_TO_POINTER(c->history->len));
+
 	return TRUE;
 }