[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mutt-dev
Subject:    bugs in maildir timestamp handling
From:       Olaf Hering <olh () suse ! de>
Date:       2003-04-28 16:27:30
[Download RAW message or body]

Hi,

the mailbox browser uses the mutt-dev/ directory instead of the
mutt-dev/new/ directory when creating the directory list. The result is
that sorting by date does not work at all, because the creation time of
the maildir is used, not the time from last mail arrival.



diff -purN -X mutt_excludes mutt-1.5.4.orig/browser.c mutt-1.5.4/browser.c
--- mutt-1.5.4.orig/browser.c	2003-01-21 13:25:21.000000000 +0100
+++ mutt-1.5.4/browser.c	2003-04-28 18:21:19.000000000 +0200
@@ -353,6 +353,8 @@ static int examine_directory (MUTTMENU *
   DIR *dp;
   struct dirent *de;
   char buffer[_POSIX_PATH_MAX + SHORT_STRING];
+  void *md_path;
+  char *tmp_path;
   BUFFY *tmp;
 
   while (stat (d, &s) == -1)
@@ -388,6 +390,8 @@ static int examine_directory (MUTTMENU *
 
   init_state (state, menu);
 
+  md_path = malloc(_POSIX_PATH_MAX);
+
   while ((de = readdir (dp)) != NULL)
   {
     if (mutt_strcmp (de->d_name, ".") == 0)
@@ -399,7 +403,14 @@ static int examine_directory (MUTTMENU *
       continue;
 
     mutt_concat_path (buffer, d, de->d_name, sizeof (buffer));
-    if (lstat (buffer, &s) == -1)
+    if (md_path && mx_is_maildir (buffer)) {
+	    tmp_path = md_path;
+	    *tmp_path = '\0';
+	    snprintf (tmp_path, _POSIX_PATH_MAX, "%s/new", buffer);
+    }
+    else
+	    tmp_path = buffer;
+    if (lstat (tmp_path, &s) == -1)
       continue;
     
     if ((! S_ISREG (s.st_mode)) && (! S_ISDIR (s.st_mode)) &&
@@ -411,7 +422,9 @@ static int examine_directory (MUTTMENU *
       tmp = tmp->next;
     add_folder (menu, state, de->d_name, &s, (tmp) ? tmp->new : 0);
   }
-  closedir (dp);  
+  closedir (dp);
+  if (md_path)
+	  free (md_path);
   browser_sort (state);
   return 0;
 }
@@ -420,6 +433,8 @@ static int examine_mailboxes (MUTTMENU *
 {
   struct stat s;
   char buffer[LONG_STRING];
+  void *md_path;
+  char *tmp_path;
   BUFFY *tmp = Incoming;
 
   if (!Incoming)
@@ -428,6 +443,8 @@ static int examine_mailboxes (MUTTMENU *
 
   init_state (state, menu);
 
+  md_path = malloc(_POSIX_PATH_MAX);
+
   do
   {
 #ifdef USE_IMAP
@@ -444,7 +461,16 @@ static int examine_mailboxes (MUTTMENU *
       continue;
     }
 #endif
-    if (lstat (tmp->path, &s) == -1)
+    if (md_path && mx_is_maildir (tmp->path)) {
+	    tmp_path = md_path;
+	    *tmp_path = '\0';
+	    snprintf (tmp_path, _POSIX_PATH_MAX, "%s/new", tmp->path);
+    }
+    else
+	    tmp_path = tmp->path;
+
+
+    if (lstat (tmp_path, &s) == -1)
       continue;
 
     if ((! S_ISREG (s.st_mode)) && (! S_ISDIR (s.st_mode)) &&
@@ -457,6 +483,10 @@ static int examine_mailboxes (MUTTMENU *
     add_folder (menu, state, buffer, &s, tmp->new);
   }
   while ((tmp = tmp->next));
+
+  if (md_path)
+	  free(md_path);
+
   browser_sort (state);
   return 0;
 }
diff -purN -X mutt_excludes mutt-1.5.4.orig/configure.in mutt-1.5.4/configure.in
--- mutt-1.5.4.orig/configure.in	2003-03-19 23:30:38.000000000 +0100
+++ mutt-1.5.4/configure.in	2003-04-26 12:26:48.000000000 +0200
@@ -339,8 +339,7 @@ SNPRINTFOBJS=""
 AC_CHECK_FUNCS(snprintf, , [mutt_cv_snprintf=yes])
 AC_CHECK_FUNCS(vsnprintf, , [mutt_cv_snprintf=yes])
 if test $mutt_cv_snprintf = yes; then
-#        AC_LIBOBJ(snprintf)
-        LIBOBJS="$LIBOBJS snprintf.o"
+        AC_LIBOBJ(snprintf)
 fi
 
 dnl SCO uses chsize() instead of ftruncate()
@@ -372,8 +371,7 @@ fi
 
 if test $mutt_cv_regex = yes; then
         AC_DEFINE(USE_GNU_REGEX,1,[ Define if you want to use the included regex.c. ])
-###     AC_LIBOBJ(regex)
-        LIBOBJS="$LIBOBJS regex.o"
+        AC_LIBOBJ(regex)
 fi
 
 
diff -purN -X mutt_excludes mutt-1.5.4.orig/mutt_sasl.c mutt-1.5.4/mutt_sasl.c
--- mutt-1.5.4.orig/mutt_sasl.c	2003-03-19 22:19:45.000000000 +0100
+++ mutt-1.5.4/mutt_sasl.c	2003-04-26 12:11:13.000000000 +0200
@@ -68,7 +68,11 @@ static int iptostring(const struct socka
     if(!addr || !out) return SASL_BADPARAM;
 
     getnameinfo(addr, addrlen, hbuf, sizeof(hbuf), pbuf, sizeof(pbuf),
+#ifdef NI_WITHSCOPEID
                 NI_NUMERICHOST | NI_WITHSCOPEID | NI_NUMERICSERV);
+#else
+                NI_NUMERICHOST | NI_NUMERICSERV);
+#endif
 
     if(outlen < strlen(hbuf) + strlen(pbuf) + 2)
         return SASL_BUFOVER;
diff -purN -X mutt_excludes mutt-1.5.4.orig/mx.c mutt-1.5.4/mx.c
--- mutt-1.5.4.orig/mx.c	2003-02-25 22:39:14.000000000 +0100
+++ mutt-1.5.4/mx.c	2003-04-26 14:04:12.000000000 +0200
@@ -454,6 +454,13 @@ int mx_get_magic (const char *path)
 }
 
 /*
+ *
+ */
+int mx_is_maildir (const char *s)
+{
+	return !!(mx_get_magic(s) == M_MAILDIR);
+}
+/*
  * set DefaultMagic to the given value
  */
 int mx_set_magic (const char *s)

-- 
USB is for mice, FireWire is for men!
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic