changeset 185:e8e447a07641

[/trunk] Changeset 197 by mikael * Use a constant to store the prefix (timestamp + in/out string) length * Change timestamp display format (add the month & day)
author mikael
date Thu, 05 May 2005 20:05:39 +0000
parents b5aa2b9c425a
children 888ad9f15346
files mcabber/src/screen.c mcabber/src/screen.h
diffstat 2 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/screen.c	Thu May 05 19:38:44 2005 +0000
+++ b/mcabber/src/screen.c	Thu May 05 20:05:39 2005 +0000
@@ -221,7 +221,7 @@
   update_panels();
 
   // Load buddy history from file (if enabled)
-  hlog_read_history(title, &tmp->hbuf, maxX - scr_WindowWidth(rosterWnd) - 14);
+  hlog_read_history(title, &tmp->hbuf, maxX - ROSTER_WIDTH - PREFIX_WIDTH);
 
   list_add_tail(&tmp->list, &window_list);
 
@@ -288,17 +288,19 @@
   for (n = 0; n < CHAT_WIN_HEIGHT; n++) {
     wmove(win_entry->win, n, 0);
     line = *(lines+n);
+    // NOTE: update PREFIX_WIDTH if you change the date format!!
+    // You need to set it to the whole prefix length + 1
     if (line) {
       if (line->timestamp) {
-        strftime(date, 35, "%H:%M", localtime(&line->timestamp));
+        strftime(date, 35, "%m-%d %H:%M", localtime(&line->timestamp));
       } else
-        strcpy(date, "     ");
+        strcpy(date, "           ");
       if (line->flags & HBB_PREFIX_IN)
-        wprintw(win_entry->win, "[%.5s] <== ", date);
+        wprintw(win_entry->win, "%.11s <== ", date);
       else if (line->flags & HBB_PREFIX_OUT)
-        wprintw(win_entry->win, "[%.5s] --> ", date);
+        wprintw(win_entry->win, "%.11s --> ", date);
       else {
-        wprintw(win_entry->win, "            ");
+        wprintw(win_entry->win, "%.11s     ", date);
       }
       wprintw(win_entry->win, "%s", line->text);      // line
       wclrtoeol(win_entry->win);
@@ -383,7 +385,7 @@
   }
 
   hbuf_add_line(&win_entry->hbuf, text, timestamp, prefix_flags,
-                maxX - scr_WindowWidth(rosterWnd) - 14);
+                maxX - ROSTER_WIDTH - PREFIX_WIDTH);
 
   if (win_entry->cleared) {
     win_entry->cleared = 0; // The message must be displayed
@@ -540,7 +542,7 @@
       }
       // Redo line wrapping
       hbuf_rebuild(&search_entry->hbuf,
-              maxX - scr_WindowWidth(rosterWnd) - 14);
+              maxX - ROSTER_WIDTH - PREFIX_WIDTH);
     }
   }
 
--- a/mcabber/src/screen.h	Thu May 05 19:38:44 2005 +0000
+++ b/mcabber/src/screen.h	Thu May 05 20:05:39 2005 +0000
@@ -13,6 +13,7 @@
 
 #define LOG_WIN_HEIGHT  (5+2)
 #define ROSTER_WIDTH    24
+#define PREFIX_WIDTH    17
 #define CHAT_WIN_HEIGHT (maxY-1-LOG_WIN_HEIGHT)
 
 #define INPUTLINE_LENGTH  1024