<<< Date Index >>>     <<< Thread Index >>>

[PATCH] imap_check_unseen



Hi,

I like the way new mails stay new even if you exit mailbox if you unset
'mark_old'. I was missing this feature for imap, especially because I'm
reading the imap by other programs, and mutt does not display new
messages if other program allready opened that mailbox.

After reading imap rfc and mutt source, I found that it's quite simple
to create switch so that user can set how imap should behave. I created
the patch by following the SubmittingPatches, the only thing I skipped
was indenting, since it changes quite lot every file.

The patch is tested on solaris 10 and linux.

Giving the simplicity of the patch, I hope that you will consider
including this into devel branch ;)

Thanks for your work

--
        Vladimir
diff -urN mutt-1.5.9/doc/manual.sgml mutt-1.5.9-patched/doc/manual.sgml
--- mutt-1.5.9/doc/manual.sgml  2005-03-13 17:37:11.000000000 +0100
+++ mutt-1.5.9-patched/doc/manual.sgml  2005-06-17 14:54:37.000000000 +0200
@@ -2440,6 +2440,10 @@
 </verb></tscreen>
 with relatively good results over my slow modem line.
 
+Mutt uses RECENT flag for polling for new mail, but if you find this
+inconviniet ( if you want message to stay 'new' untill you read it ), you can
+enable <tt/imap_check_unseen/ flag.
+
 Note that if you are using mbox as the mail store on UW servers prior to
 v12.250, the server has been reported to disconnect a client if another client
 selects the same folder.
diff -urN mutt-1.5.9/imap/imap.c mutt-1.5.9-patched/imap/imap.c
--- mutt-1.5.9/imap/imap.c      2005-02-19 14:49:49.000000000 +0100
+++ mutt-1.5.9-patched/imap/imap.c      2005-06-17 14:55:08.000000000 +0200
@@ -1232,7 +1232,7 @@
           mutt_bit_isset(idata->capabilities,STATUS))
   {                            
     snprintf (buf, sizeof (buf), "STATUS %s (%s)", mbox,
-      new ? "RECENT" : "MESSAGES");
+      new ? (option (OPTIMAPCHECKUNSEEN) ? "UNSEEN" : "RECENT") : "MESSAGES");
   }
   else
     /* Server does not support STATUS, and this is not the current mailbox.
diff -urN mutt-1.5.9/init.h mutt-1.5.9-patched/init.h
--- mutt-1.5.9/init.h   2005-03-01 16:56:02.000000000 +0100
+++ mutt-1.5.9-patched/init.h   2005-06-17 14:55:08.000000000 +0200
@@ -779,6 +779,15 @@
   { "imap_authenticators", DT_STR, R_NONE, UL &ImapAuthenticators, UL 0 },
   /*
   ** .pp
+  ** This option changes default behaviour of scanning imap for new messages.
+  ** By default mutt is using RECENT IMAP flag, and you can tell mutt to use
+  ** UNSEEN flag. This practically means that new mail in IMAP box stays new
+  ** untill you really read the mail, even if you quit and enter the mailbox.
+  ** It's somehow similar to 'mark_old' option for regular mailbox.
+  */
+  { "imap_check_unseen", DT_BOOL, R_NONE, OPTIMAPCHECKUNSEEN, 0 },
+  /*
+  ** .pp
   ** This is a colon-delimited list of authentication methods mutt may
   ** attempt to use to log in to an IMAP server, in the order mutt should
   ** try them.  Authentication methods are either 'login' or the right
@@ -1056,7 +1065,8 @@
   ** messages as \fIold\fP if you exit a mailbox without reading them.
   ** With this option set, the next time you start mutt, the messages
   ** will show up with an "O" next to them in the index menu,
-  ** indicating that they are old.
+  ** indicating that they are old. If you want something similar for IMAP
+  ** mailbox, try to use 'imap_check_unseen'.
   */
   { "markers",         DT_BOOL, R_PAGER, OPTMARKERS, 1 },
   /*
diff -urN mutt-1.5.9/mutt.h mutt-1.5.9-patched/mutt.h
--- mutt-1.5.9/mutt.h   2005-02-28 16:13:57.000000000 +0100
+++ mutt-1.5.9-patched/mutt.h   2005-06-17 14:55:08.000000000 +0200
@@ -366,6 +366,7 @@
   OPTIMAPPASSIVE,
   OPTIMAPPEEK,
   OPTIMAPSERVERNOISE,
+  OPTIMAPCHECKUNSEEN,
 # if defined(USE_SSL) || defined(USE_GNUTLS)
   OPTIMAPFORCESSL,
 # endif
diff -urN mutt-1.5.9/PATCHES mutt-1.5.9-patched/PATCHES
--- mutt-1.5.9/PATCHES  2005-03-13 17:33:06.000000000 +0100
+++ mutt-1.5.9-patched/PATCHES  2005-06-17 15:24:24.000000000 +0200
@@ -0,0 +1 @@
+patch-1.5.9.vm.imap_unseen.1

Attachment: pgpuwFd3roDxW.pgp
Description: PGP signature