]> mj.ucw.cz Git - checkmail.git/commitdiff
Added an option to treat old, but still unread messages as new
authorMartin Mares <mj@ucw.cz>
Tue, 22 Jul 2014 15:21:05 +0000 (17:21 +0200)
committerMartin Mares <mj@ucw.cz>
Tue, 22 Jul 2014 15:21:05 +0000 (17:21 +0200)
cm.c

diff --git a/cm.c b/cm.c
index 9a38a1d7a0252e2444009d7a3152676ac5a62663..641b5530841bc787651554d73d67ce8f6b275e10 100644 (file)
--- a/cm.c
+++ b/cm.c
@@ -52,6 +52,7 @@ struct options {
   int hotkey;
   int led;
   int osd;
   int hotkey;
   int led;
   int osd;
+  int unread_is_new;
 };
 
 struct option_node {
 };
 
 struct option_node {
@@ -147,6 +148,7 @@ init_options(struct options *o)
   o->hotkey = -1;
   o->led = -1;
   o->osd = -1;
   o->hotkey = -1;
   o->led = -1;
   o->osd = -1;
+  o->unread_is_new = -1;
 }
 
 static void
 }
 
 static void
@@ -170,6 +172,7 @@ setup_options(struct mbox *b)
        MERGE(hotkey);
        MERGE(led);
        MERGE(osd);
        MERGE(hotkey);
        MERGE(led);
        MERGE(osd);
+       MERGE(unread_is_new);
       }
 }
 
       }
 }
 
@@ -514,7 +517,10 @@ scan_mbox(struct mbox *b, struct stat *st)
          if (!buf[0])
            break;
          if (!strncasecmp(buf, "Status:", 7))
          if (!buf[0])
            break;
          if (!strncasecmp(buf, "Status:", 7))
-           new = 0;
+           {
+             if (!b->o.unread_is_new || strchr(buf + 7, 'R'))
+               new = 0;
+           }
          else if (!strncasecmp(buf, "X-Status:", 9) && strchr(buf+9, 'F'))
            flagged = 1;
          else if (!strncasecmp(buf, "From:", 5))
          else if (!strncasecmp(buf, "X-Status:", 9) && strchr(buf+9, 'F'))
            flagged = 1;
          else if (!strncasecmp(buf, "From:", 5))
@@ -1340,6 +1346,7 @@ f\t\t\tShow flagged messages if there are no new ones\n\
 h\t\t\tHide from display\n\
 l<led>\t\t\tLight a keyboard led (1-9) if running on X display\n\
 m\t\t\tShow mailbox name of the sender\n\
 h\t\t\tHide from display\n\
 l<led>\t\t\tLight a keyboard led (1-9) if running on X display\n\
 m\t\t\tShow mailbox name of the sender\n\
+o\t\t\tCount old, but unread messages as new\n\
 p\t\t\tShow personal info (full name) of the sender\n\
 s\t\t\tShow message snippets\n\
 t\t\t\tHighlight the entry\n\
 p\t\t\tShow personal info (full name) of the sender\n\
 s\t\t\tShow message snippets\n\
 t\t\t\tHighlight the entry\n\
@@ -1400,6 +1407,9 @@ parse_options(char *c)
          case 'm':
            o->sender_mbox = value;
            break;
          case 'm':
            o->sender_mbox = value;
            break;
+         case 'o':
+           o->unread_is_new = value;
+           break;
          case 'p':
            o->sender_personal = value;
            break;
          case 'p':
            o->sender_personal = value;
            break;