# HG changeset patch # User mikael # Date 1115323539 0 # Node ID e8e447a0764141fe35eec04f5db6b344b7af78c3 # Parent b5aa2b9c425a2f97ef242a7381c334d73b19e67e [/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) diff -r b5aa2b9c425a -r e8e447a07641 mcabber/src/screen.c --- 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); } } diff -r b5aa2b9c425a -r e8e447a07641 mcabber/src/screen.h --- 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