aboutsummaryrefslogtreecommitdiff
path: root/mail/mutt/files/extra-patch-maildir-mtime
blob: 722eb952383ac690fc1052f4b7f3a750825cabff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
--- PATCHES.orig	2021-06-13 21:49:47 UTC
+++ PATCHES
@@ -0,0 +1 @@
+patch-1.5.7.ust.maildir-mtime.2
--- browser.c.orig	2021-05-23 18:20:50 UTC
+++ browser.c
@@ -32,6 +32,7 @@
 #ifdef USE_IMAP
 #include "imap.h"
 #endif
+#include "mx.h"
 
 #include <stdlib.h>
 #include <dirent.h>
@@ -531,6 +532,21 @@ static void init_state (struct browser_state *state, M
     menu->data = state->entry;
 }
 
+static void check_maildir_times (BUFFY *buf, struct stat *st)
+{
+  char buffer[_POSIX_PATH_MAX + SHORT_STRING];
+  struct stat s;
+
+  if(!buf || buf->magic != MUTT_MAILDIR)
+    return;
+
+  snprintf (buffer, sizeof (buffer), "%s/tmp", mutt_b2s(buf->pathbuf));
+  if (lstat (buffer, &s) != 0)
+    return;
+
+  st->st_mtime = s.st_mtime;
+}
+
 static int examine_directory (MUTTMENU *menu, struct browser_state *state,
 			      const char *d, const char *prefix)
 {
@@ -597,6 +613,7 @@ static int examine_directory (MUTTMENU *menu, struct b
     tmp = Incoming;
     while (tmp && mutt_strcmp (mutt_b2s (full_path), mutt_b2s (tmp->pathbuf)))
       tmp = tmp->next;
+    check_maildir_times (tmp, &s);
     if (tmp && Context && !tmp->nopoll &&
         !mutt_strcmp (tmp->realpath, Context->realpath))
     {
@@ -680,6 +697,7 @@ static int examine_mailboxes (MUTTMENU *menu, struct b
 	s.st_mtime = st2.st_mtime;
     }
 
+    check_maildir_times (tmp, &s);
     add_folder (menu, state, mutt_b2s (mailbox), mutt_b2s (tmp->pathbuf), &s, tmp);
   }
   while ((tmp = tmp->next));