diff mcabber/src/hbuf.c @ 464:e4840b288be0

Add "/buffer date"
author Mikael Berthe <mikael@lilotux.net>
date Thu, 29 Sep 2005 22:31:56 +0200
parents d580e87c11ed
children 3134b4960cdb
line wrap: on
line diff
--- a/mcabber/src/hbuf.c	Thu Sep 29 22:03:22 2005 +0200
+++ b/mcabber/src/hbuf.c	Thu Sep 29 22:31:56 2005 +0200
@@ -296,6 +296,22 @@
   return hbuf;
 }
 
+//  hbuf_jump_date(hbuf, t)
+// Return a pointer to the first line after date t in the history buffer
+GList *hbuf_jump_date(GList *hbuf, time_t t)
+{
+  hbuf_block *blk;
+
+  hbuf = g_list_first(hbuf);
+
+  for ( ; hbuf && g_list_next(hbuf); hbuf = g_list_next(hbuf)) {
+    blk = (hbuf_block*)(hbuf->data);
+    if (blk->prefix.timestamp >= t) break;
+  }
+
+  return hbuf;
+}
+
 //  hbuf_jump_percent(hbuf, pc)
 // Return a pointer to the line at % pc of the history buffer
 GList *hbuf_jump_percent(GList *hbuf, int pc)