]> mj.ucw.cz Git - checkmail.git/commitdiff
Avoid repeating the same mail in OSD announcements
authorMartin Mares <mj@ucw.cz>
Sat, 29 Mar 2014 22:34:22 +0000 (23:34 +0100)
committerMartin Mares <mj@ucw.cz>
Sat, 29 Mar 2014 22:34:22 +0000 (23:34 +0100)
cm.c

diff --git a/cm.c b/cm.c
index 49d0f6508e40b50ac7f0dfb51de2789fcb04b7e5..e14c8fa2ba937dbadf6a2d64331c05b9dc4fc27c 100644 (file)
--- a/cm.c
+++ b/cm.c
@@ -637,6 +637,7 @@ static Atom osd_pty;
 static unsigned osd_care;
 #define OSD_MSG_SIZE 1024
 static char osd_last_msg[OSD_MSG_SIZE];
 static unsigned osd_care;
 #define OSD_MSG_SIZE 1024
 static char osd_last_msg[OSD_MSG_SIZE];
+static time_t osd_last_time;
 
 static void
 x11_init(void)
 
 static void
 x11_init(void)
@@ -844,7 +845,7 @@ rethink_osd(int notify)
     if (b->o.osd > 0)
       {
        p.total_new += b->new;
     if (b->o.osd > 0)
       {
        p.total_new += b->new;
-       if (b->new && (!p.mbox || p.mbox->o.priority < b->o.priority))
+       if (b->new && b->last_time > osd_last_time && (!p.mbox || p.mbox->o.priority < b->o.priority))
          p.mbox = b;
       }
 
          p.mbox = b;
       }
 
@@ -862,6 +863,7 @@ rethink_osd(int notify)
        }
       else
        debug("OSD: No changes\n");
        }
       else
        debug("OSD: No changes\n");
+      osd_last_time = time(NULL);
     }
 }
 
     }
 }