From: Martin Mares Date: Sat, 29 Mar 2014 22:22:42 +0000 (+0100) Subject: Mail age gets updated properly, even if the mailbox does not change X-Git-Tag: v1.7~2 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=ca1f2ef2005693f47e38a857cc23dfecfc341b31;p=checkmail.git Mail age gets updated properly, even if the mailbox does not change --- diff --git a/cm.c b/cm.c index 8b2b03f..49d0f65 100644 --- a/cm.c +++ b/cm.c @@ -80,6 +80,7 @@ struct mbox { int scanning; int seen; time_t last_time; + time_t display_valid_until; int last_size, last_pos; int total, new, flagged; int last_total, last_new, last_flagged; @@ -608,6 +609,11 @@ scan(int notify) redraw_line(b->index); refresh(); } + else if (b->display_valid_until <= last_scan_time) + { + debug("not changed, but needs redraw\n"); + redraw_line(b->index); + } else debug("not changed\n"); b->force_refresh = 0; @@ -905,6 +911,7 @@ redraw_line(int i) int hi = b->o.highlight; unsigned namepos = 0; unsigned namelen = strlen(b->name); + int valid = 3600; attrset(attrs[cc][hi][M_IDLE]); if (b->o.hotkey) @@ -955,7 +962,10 @@ redraw_line(int i) if (age < 0) age = 0; if (age < 3600) - printw("%2d min ", age/60); + { + printw("%2d min ", age/60); + valid = 60; + } else if (age < 86400) printw("%2d hr%c ", age/3600, (age >= 7200 ? 's' : ' ')); else @@ -994,6 +1004,7 @@ redraw_line(int i) } } } + b->display_valid_until = last_scan_time + valid; } attrset(attrs[0][0][M_IDLE]); clrtoeol();