changeset 850:d0781ca2dd08

Use new status buffer window Update scr_LogPrint() to use the new status buffer. Introduce HBB_PREFIX_SPECIAL flag which changes the prefix field in the special buffers.
author Mikael Berthe <mikael@lilotux.net>
date Mon, 08 May 2006 23:46:42 +0200
parents 42c43a88d823
children da03534e46c7
files mcabber/src/hbuf.c mcabber/src/hbuf.h mcabber/src/screen.c
diffstat 3 files changed, 21 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/hbuf.c	Mon May 08 23:46:18 2006 +0200
+++ b/mcabber/src/hbuf.c	Mon May 08 23:46:42 2006 +0200
@@ -38,7 +38,7 @@
   // (for ex. when HBB_FLAG_PERSISTENT is set).
   struct { // hbuf_line_info
     time_t timestamp;
-    guchar flags;
+    guint  flags;
   } prefix;
 } hbuf_block;
 
--- a/mcabber/src/hbuf.h	Mon May 08 23:46:18 2006 +0200
+++ b/mcabber/src/hbuf.h	Mon May 08 23:46:42 2006 +0200
@@ -23,10 +23,11 @@
 #define HBB_PREFIX_NOFLAG     64
 #define HBB_PREFIX_HLIGHT    128
 #define HBB_PREFIX_NONE      256
+#define HBB_PREFIX_SPECIAL   512
 
 typedef struct {
   time_t timestamp;
-  guchar flags;
+  guint flags;
   char *text;
 } hbb_line;
 
--- a/mcabber/src/screen.c	Mon May 08 23:46:18 2006 +0200
+++ b/mcabber/src/screen.c	Mon May 08 23:46:42 2006 +0200
@@ -101,6 +101,9 @@
 GSList *keyseqlist;
 static void add_keyseq(char *seqstr, guint mkeycode, gint value);
 
+void scr_WriteInWindow(const char *winId, const char *text, time_t timestamp,
+                       unsigned int prefix_flags, int force_show);
+
 
 /* Functions */
 
@@ -357,9 +360,18 @@
     else
       buffer_locale = buffer;
     if (Curses) {
+      char *buf_specialwindow;
       wprintw(logWnd, "\n%s", buffer_locale);
       update_panels();
       doupdate();
+      if (flag & LPRINT_NOTUTF8)
+        buf_specialwindow = to_utf8(b2);
+      else
+        buf_specialwindow = b2;
+      scr_WriteInWindow(NULL, buf_specialwindow, timestamp,
+                        HBB_PREFIX_SPECIAL, FALSE);
+      if (buf_specialwindow != b2)
+        g_free(buf_specialwindow);
     } else {
       printf("%s\n", buffer_locale);
     }
@@ -460,7 +472,7 @@
   int width;
   hbb_line **lines, *line;
   GList *hbuf_head;
-  char date[32];
+  char date[64];
 
   width = scr_WindowWidth(win_entry->win);
 
@@ -502,7 +514,7 @@
       if (line->flags & HBB_PREFIX_HLIGHT)
         wattrset(win_entry->win, get_color(COLOR_MSGOUT));
 
-      if (line->timestamp) {
+      if (line->timestamp && !(line->flags & HBB_PREFIX_SPECIAL)) {
         strftime(date, 30, "%m-%d %H:%M", localtime(&line->timestamp));
       } else
         strcpy(date, "           ");
@@ -524,6 +536,9 @@
         wprintw(win_entry->win, "%.11s <== ", date);
       } else if (line->flags & HBB_PREFIX_OUT) {
         wprintw(win_entry->win, "%.11s --> ", date);
+      } else if (line->flags & HBB_PREFIX_SPECIAL) {
+        strftime(date, 30, "%m-%d %H:%M:%S", localtime(&line->timestamp));
+        wprintw(win_entry->win, "%.14s  ", date);
       } else {
         wprintw(win_entry->win, "%.11s     ", date);
       }
@@ -613,7 +628,7 @@
 // Lines are splitted when they are too long to fit in the chat window.
 // If this window doesn't exist, it is created.
 void scr_WriteInWindow(const char *winId, const char *text, time_t timestamp,
-        unsigned int prefix_flags, int force_show)
+                       unsigned int prefix_flags, int force_show)
 {
   winbuf *win_entry;
   char *text_locale;