changeset: 6472:e40e3e0391ea
user: Martin Sandsmark <[email protected]>
date: Sat Jul 18 18:40:32 2015 +0200
link: http://dev.mutt.org/hg/mutt/rev/e40e3e0391ea
Add support for checking cur/ in Maildir for unread mails in buffy.
Also skip messages with the S flag when checking for unread mails.
diffs (98 lines):
diff -r fdafc56a854f -r e40e3e0391ea UPDATING
--- a/UPDATING Fri Jul 24 13:36:16 2015 -0700
+++ b/UPDATING Sat Jul 18 18:40:32 2015 +0200
@@ -35,6 +35,7 @@
! sime_keys better handles importing certificate chains.
! sime_keys now records certificate purposes (sign/encrypt). Run
"sime_keys refresh" to update smime index files.
+ + $maildir_check_cur to poll maildir "cur" directory for new mail.
1.5.23 (2014-03-11):
diff -r fdafc56a854f -r e40e3e0391ea buffy.c
--- a/buffy.c Fri Jul 24 13:36:16 2015 -0700
+++ b/buffy.c Sat Jul 18 18:40:32 2015 +0200
@@ -285,8 +285,8 @@
return 0;
}
-/* returns 1 if maildir has new mail */
-static int buffy_maildir_hasnew (BUFFY* mailbox)
+/* returns 1 if the specified dir (cur or new) has new mail */
+static int buffy_maildir_dir_hasnew(BUFFY* mailbox, const char *dir_name)
{
char path[_POSIX_PATH_MAX];
DIR *dirp;
@@ -295,7 +295,7 @@
int rc = 0;
struct stat sb;
- snprintf (path, sizeof (path), "%s/new", mailbox->path);
+ snprintf (path, sizeof (path), "%s/%s", mailbox->path, dir_name);
/* when $mail_check_recent is set, if the new/ directory hasn't been
modified since
* the user last exited the mailbox, then we know there is no recent mail.
@@ -317,7 +317,7 @@
if (*de->d_name == '.')
continue;
- if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T'))
+ if (!(p = strstr (de->d_name, ":2,")) || !(strchr (p + 3, 'T') || strchr(p
+ 3, 'S')))
{
if (option(OPTMAILCHECKRECENT))
{
@@ -340,6 +340,23 @@
return rc;
}
+/* returns 1 if maildir has new mail */
+static int buffy_maildir_hasnew (BUFFY* mailbox)
+{
+ if (buffy_maildir_dir_hasnew(mailbox, "new")) {
+ return 1;
+ }
+
+ if (!option(OPTMAILDIRCHECKCUR)) {
+ return 0;
+ }
+
+ if (buffy_maildir_dir_hasnew(mailbox, "cur")) {
+ return 1;
+ }
+
+ return 0;
+}
/* returns 1 if mailbox has new mail */
static int buffy_mbox_hasnew (BUFFY* mailbox, struct stat *sb)
{
diff -r fdafc56a854f -r e40e3e0391ea init.h
--- a/init.h Fri Jul 24 13:36:16 2015 -0700
+++ b/init.h Sat Jul 18 18:40:32 2015 +0200
@@ -1420,6 +1420,16 @@
** to maildir-style mailboxes. Setting it will have no effect on other
** mailbox types.
*/
+ { "maildir_check_cur", DT_BOOL, R_NONE, OPTMAILDIRCHECKCUR, 0 },
+ /*
+ ** .pp
+ ** If \fIset\fP, mutt will poll both the new and cur directories of
+ ** a maildir folder for new messages. This might be useful if other
+ ** programs interacting with the folder (e.g. dovecot) are moving new
+ ** messages to the cur directory. Note that setting this option may
+ ** slow down polling for new messages in large folders, since mutt has
+ ** to scan all cur messages.
+ */
{ "mark_old", DT_BOOL, R_BOTH, OPTMARKOLD, 1 },
/*
** .pp
diff -r fdafc56a854f -r e40e3e0391ea mutt.h
--- a/mutt.h Fri Jul 24 13:36:16 2015 -0700
+++ b/mutt.h Sat Jul 18 18:40:32 2015 +0200
@@ -387,6 +387,7 @@
OPTMAILCAPSANITIZE,
OPTMAILCHECKRECENT,
OPTMAILDIRTRASH,
+ OPTMAILDIRCHECKCUR,
OPTMARKERS,
OPTMARKOLD,
OPTMENUSCROLL, /* scroll menu instead of implicit next-page */