]> mj.ucw.cz Git - checkmail.git/blobdiff - cm.c
Better rules for coloring of flagged messages.
[checkmail.git] / cm.c
diff --git a/cm.c b/cm.c
index 963fe049541f4b031d53c3fc5e20f70bc3e97600..a3bba1853305c46e21b595475157a6ec37ff5b0a 100644 (file)
--- a/cm.c
+++ b/cm.c
@@ -37,6 +37,8 @@ struct options {
   int beep;
   int snippets;
   int show_flagged;
+  int sender_personal;
+  int sender_mbox;
 };
 
 struct option_node {
@@ -52,7 +54,9 @@ struct pattern_node {
 };
 
 static clist options, patterns;
-static struct options global_options;
+static struct options global_options = {
+  .sender_personal = 1
+};
 
 struct mbox {
   cnode n;
@@ -115,6 +119,8 @@ init_options(struct options *o)
   o->highlight = -1;
   o->snippets = -1;
   o->show_flagged = -1;
+  o->sender_personal = -1;
+  o->sender_mbox = -1;
 }
 
 static void
@@ -133,6 +139,8 @@ setup_options(struct mbox *b)
        MERGE(beep);
        MERGE(snippets);
        MERGE(show_flagged);
+       MERGE(sender_personal);
+       MERGE(sender_mbox);
       }
 }
 
@@ -214,13 +222,13 @@ prepare_snippet(struct mbox *b, char *sender, char *subject)
 
   char *pos = b->snippet;
   char *term = b->snippet + sizeof(b->snippet) - 1;
-  if (sender[0])
+  if (sender[0] && (b->o.sender_mbox || b->o.sender_personal))
     {
-      add_snippet(&pos, term, sender);
+      add_addr_snippet(&pos, term, sender, b->o.sender_mbox, b->o.sender_personal);
       add_snippet(&pos, term, ": ");
     }
   if (subject[0])
-    add_snippet(&pos, term, subject);
+    add_subject_snippet(&pos, term, subject);
   else
     add_snippet(&pos, term, "No subject");
 }
@@ -589,6 +597,7 @@ redraw_line(int i)
              printw("%6d  ", b->flagged);
              attrset(attrs[cc][hi][M_IDLE]);
              printw("        ");
+             attrset(attrs[cc][0][M_FLAG]);    /* We avoid the highlight intentionally */
              snip = b->o.show_flagged;
            }
          if (snip && b->o.snippets && b->snippet[0])
@@ -795,6 +804,8 @@ b\t\t\tBeep when a message arrives\n\
 e\t\t\tHide from display if empty\n\
 f\t\t\tShow flagged messages if there are no new ones\n\
 h\t\t\tHide from display\n\
+m\t\t\tShow mailbox name of the sender\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\
 \n\
@@ -843,6 +854,12 @@ parse_options(char *c)
          case 'h':
            o->hide = value;
            break;
+         case 'm':
+           o->sender_mbox = value;
+           break;
+         case 'p':
+           o->sender_personal = value;
+           break;
          case 's':
            o->snippets = value;
            break;