From dab40de233cfe3e9833c08faaeefec28ac7c75c8 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Tue, 22 Jul 2014 17:21:05 +0200 Subject: [PATCH] Added an option to treat old, but still unread messages as new --- cm.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cm.c b/cm.c index 9a38a1d..641b553 100644 --- a/cm.c +++ b/cm.c @@ -52,6 +52,7 @@ struct options { int hotkey; int led; int osd; + int unread_is_new; }; struct option_node { @@ -147,6 +148,7 @@ init_options(struct options *o) o->hotkey = -1; o->led = -1; o->osd = -1; + o->unread_is_new = -1; } static void @@ -170,6 +172,7 @@ setup_options(struct mbox *b) 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)) - 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)) @@ -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\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\ @@ -1400,6 +1407,9 @@ parse_options(char *c) case 'm': o->sender_mbox = value; break; + case 'o': + o->unread_is_new = value; + break; case 'p': o->sender_personal = value; break; -- 2.39.5