imap_recent option to use RECENT instead of UNSEEN
Hello.
I have made a patch against a recent 1.5.13 in debian, to use
RECENT instead of UNSEEN when checking for new email over imap.
Imap specification states that UNSEEN is the number of unread messages,
and RECENT is the number of new messages since mailbox was last
selected.
It appears that previous versions of mutt have used RECENT, so I assume
that the current behavior is intentional.
The way I use imap, I have several folders where I have not read all the
messages, and I don't want the folder to be selected unless it has new
messages. Old and unread messages does not warrant my attention, only
new and unread.
To keep the old behavior I have made an option imap_recent that, when
true turns on usage of RECENT, and when false, which is the default,
UNSEEN is used.
I hope you will consider applying this small patch.
Thank you for great work on an efficient text based MUA.
--
Sincerely | Homepage:
Jørgen | http://www.hex.no/jhf
| Public GPG key:
| http://www.hex.no/jhf/key.txt
--- init.h.orig 2007-01-01 19:41:38.000000000 +0100
+++ init.h 2007-01-01 19:46:09.000000000 +0100
@@ -947,6 +947,12 @@
{ "imap_peek", DT_BOOL, R_NONE, OPTIMAPPEEK, 1 },
/*
** .pp
+ ** When \fIset\fP, mutt will use RECENT rather than UNSEEN to check
+ ** for new mail.
+ */
+ { "imap_recent", DT_BOOL, R_NONE, OPTIMAPRECENT, 0 },
+ /*
+ ** .pp
** When \fIset\fP, mutt will avoid implicitly marking your mail as read
whenever
** you fetch a message from the server. This is generally a good thing,
** but can make closing an IMAP folder somewhat slower. This option
--- Muttrc.orig 2007-01-01 19:41:44.000000000 +0100
+++ Muttrc 2007-01-01 19:49:27.000000000 +0100
@@ -1291,6 +1291,17 @@
# exists to appease speed freaks.
#
#
+# set imap_recent=no
+#
+# Name: imap_recent
+# Type: boolean
+# Default: no
+#
+#
+# When set, mutt will use RECENT rather than UNSEEN to check
+# for new mail.
+#
+#
# set imap_servernoise=yes
#
# Name: imap_servernoise
--- mutt.h.orig 2007-01-01 20:31:34.000000000 +0100
+++ mutt.h 2007-01-01 19:45:05.000000000 +0100
@@ -380,6 +380,7 @@
OPTIMAPLSUB,
OPTIMAPPASSIVE,
OPTIMAPPEEK,
+ OPTIMAPRECENT,
OPTIMAPSERVERNOISE,
#endif
#if defined(USE_SSL)
--- imap/command.c.orig 2007-01-01 20:05:26.000000000 +0100
+++ imap/command.c 2007-01-01 19:47:54.000000000 +0100
@@ -886,18 +886,26 @@
if (value && !imap_mxcmp (mailbox, value))
{
- dprint (2, (debugfile, "Found %s in buffy list (OV: %d ON: %d U:
%d)\n",
- mailbox, olduv, oldun, status->unseen));
+ dprint (2, (debugfile, "Found %s in buffy list (OV: %d ON: %d U: %d R:
%d)\n",
+ mailbox, olduv, oldun, status->unseen,status->recent));
if (olduv && olduv == status->uidvalidity)
{
if (oldun < status->uidnext)
{
- inc->new = status->unseen;
+ if option (OPTIMAPRECENT) {
+ inc->new = status->recent;
+ } else {
+ inc->new = status->unseen;
+ }
}
}
else
- inc->new = status->unseen;
+ if option (OPTIMAPRECENT) {
+ inc->new = status->recent;
+ } else {
+ inc->new = status->unseen;
+ }
/* forced back to keep detecting new mail until the mailbox is opened
*/
status->uidnext = oldun;
--- imap/imap.c.orig 2007-01-01 20:05:40.000000000 +0100
+++ imap/imap.c 2007-01-01 18:39:12.000000000 +0100
@@ -1466,7 +1466,7 @@
}
imap_munge_mbox_name (munged, sizeof (munged), name);
- snprintf (command, sizeof (command), "STATUS %s (UIDNEXT UIDVALIDITY
UNSEEN)", munged);
+ snprintf (command, sizeof (command), "STATUS %s (UIDNEXT UIDVALIDITY
RECENT UNSEEN)", munged);
if (imap_cmd_queue (idata, command) < 0)
{