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

[PATCH] Make "mark_old" a quad option



Hi,

The attached patch makes the "mark_old" option to be a quad option.
I find this useful because I don't always want to mark mails as old, just
sometimes. And in fact, I only want mutt to ask me about it only on certain
mailboxes. So making it a quad option lets me use mutt this way (this patch + a
folder hook to set that option on some mailboxes)

After writting the patch, of course ;), I found that there was a third party
patch that does this (and more things)[1]. I didn't find any reason why that
patch was not applied, so I thought perhaps it was because of some of the other
things that patch does and this patch could be applied anyways.

This is my first time writing a patch for mutt so, even in a so simple patch, I
can have done something fundamentally wrong or something like that. My apologies
if this is the case :)

Now about the patch itself.
There's one thins that I really doubt: the change to pop.c. I dont know what the
correct thing to do is. I'm not sure if checking for ==M_YES is ok, or checking
for != M_NO, or.. I don't know.

I've tried this with local mail only (so I didn't try the change to pop.c I 
guess)
and have checked the patch with "check_sec.sh".

If the patch looks ok I can send a v2 updating the documentation (I've just
realised I didn't update it :-P) and perhaps changing the text to "Mark new
unread mails as old?" too ?




Thanks a lot,
Rodrigo

[1]: http://www.schrab.com/aaron/mutt/
# HG changeset patch
# User Rodrigo Campos <rodrigo@xxxxxxxxxxx>
# Date 1275436168 10800
# Branch HEAD
# Node ID 805d7d14f306d8a7b44a91715ba988a2724598f8
# Parent  29e37994a536a54e75539c5616fe4110198bfed8
Make "mark_old" a quadoption

diff -r 29e37994a536 -r 805d7d14f306 init.h
--- a/init.h    Tue May 18 08:39:48 2010 -0700
+++ b/init.h    Tue Jun 01 20:49:28 2010 -0300
@@ -1368,7 +1368,7 @@
   ** to maildir-style mailboxes.  Setting it will have no effect on other
   ** mailbox types.
   */
-  { "mark_old",                DT_BOOL, R_BOTH, OPTMARKOLD, 1 },
+  { "mark_old",                DT_QUAD, R_BOTH, OPTMARKOLD, M_YES },
   /*
   ** .pp
   ** Controls whether or not mutt marks \fInew\fP \fBunread\fP
diff -r 29e37994a536 -r 805d7d14f306 mx.c
--- a/mx.c      Tue May 18 08:39:48 2010 -0700
+++ b/mx.c      Tue Jun 01 20:49:28 2010 -0300
@@ -857,7 +857,7 @@
     }
   }
 
-  if (option (OPTMARKOLD))
+  if (query_quadoption (OPTMARKOLD, _("Mark new mails as old?")) == M_YES)
   {
     for (i = 0; i < ctx->msgcount; i++)
     {
diff -r 29e37994a536 -r 805d7d14f306 pop.c
--- a/pop.c     Tue May 18 08:39:48 2010 -0700
+++ b/pop.c     Tue Jun 01 20:49:28 2010 -0300
@@ -349,7 +349,7 @@
       {
         if (bcached)
           ctx->hdrs[i]->read = 1;
-        else if (option (OPTMARKOLD))
+        else if (quadoption (OPTMARKOLD) == M_YES)
           ctx->hdrs[i]->old = 1;
       }
       else