]> mj.ucw.cz Git - checkmail.git/commitdiff
Mail age gets updated properly, even if the mailbox does not change
authorMartin Mares <mj@ucw.cz>
Sat, 29 Mar 2014 22:22:42 +0000 (23:22 +0100)
committerMartin Mares <mj@ucw.cz>
Sat, 29 Mar 2014 22:22:42 +0000 (23:22 +0100)
cm.c

diff --git a/cm.c b/cm.c
index 8b2b03fa64c62f0ef55d364cb7604af2f439b288..49d0f6508e40b50ac7f0dfb51de2789fcb04b7e5 100644 (file)
--- 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();