Patch to CVS
Here is a patch to add a rcconfig variable "save_dflag" which effects
mbox mailboxes. It allows users to save delete flags if the decide
not to purge on exit. Let me know what you think.
Index: PATCHES
===================================================================
RCS file: /home/roessler/cvs/mutt/PATCHES,v
retrieving revision 3.6
diff -u -r3.6 PATCHES
--- PATCHES 9 Dec 2002 17:44:54 -0000 3.6
+++ PATCHES 14 Mar 2006 16:10:15 -0000
@@ -0,0 +1 @@
+patch-cvs.nl.save_dflag.1
\ No newline at end of file
Index: copy.c
===================================================================
RCS file: /home/roessler/cvs/mutt/copy.c,v
retrieving revision 3.27
diff -u -r3.27 copy.c
--- copy.c 21 Oct 2005 04:35:37 -0000 3.27
+++ copy.c 14 Mar 2006 16:10:15 -0000
@@ -444,7 +444,7 @@
return (-1);
}
- if (h->flagged || h->replied)
+ if (h->flagged || h->replied || h->deleted)
{
if (fputs ("X-Status: ", out) == EOF)
return (-1);
@@ -460,6 +460,12 @@
if (fputc ('F', out) == EOF)
return (-1);
}
+
+ if (h->deleted && option (OPTSAVEDFLAG))
+ {
+ if (fputc ('D', out) == EOF)
+ return (-1);
+ }
if (fputc ('\n', out) == EOF)
return (-1);
Index: init.h
===================================================================
RCS file: /home/roessler/cvs/mutt/init.h,v
retrieving revision 3.95
diff -u -r3.95 init.h
--- init.h 9 Jan 2006 19:43:58 -0000 3.95
+++ init.h 14 Mar 2006 16:10:15 -0000
@@ -2921,6 +2921,14 @@
** messages to be sent. Exim users may wish to unset this.
*/
/*--*/
+ { "save_dflag", DT_BOOL, R_NONE, OPTSAVEDFLAG, 0},
+ /*
+ ** .pp
+ ** Controls whether mutt writes out a D in the X-Status when
+ ** synchronizing mbox mailboxes.
+ */
+ /*--*/
+
{ NULL }
};
Index: mbox.c
===================================================================
RCS file: /home/roessler/cvs/mutt/mbox.c,v
retrieving revision 3.11
diff -u -r3.11 mbox.c
--- mbox.c 21 Oct 2005 04:35:37 -0000 3.11
+++ mbox.c 14 Mar 2006 16:10:15 -0000
@@ -667,7 +667,7 @@
* 0 success
* -1 failure
*/
-int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint)
+int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint, int purge)
{
char tempfile[_POSIX_PATH_MAX];
char buf[32];
@@ -785,7 +785,7 @@
oldOffset[i-first].lines = ctx->hdrs[i]->lines;
oldOffset[i-first].length = ctx->hdrs[i]->content->length;
- if (! ctx->hdrs[i]->deleted)
+ if (! (ctx->hdrs[i]->deleted && purge) )
{
j++;
if (!ctx->quiet && WriteInc && ((i % WriteInc) == 0 || j == 1))
Index: mutt.h
===================================================================
RCS file: /home/roessler/cvs/mutt/mutt.h,v
retrieving revision 3.63
diff -u -r3.63 mutt.h
--- mutt.h 9 Jan 2006 19:43:59 -0000 3.63
+++ mutt.h 14 Mar 2006 16:10:15 -0000
@@ -508,7 +508,8 @@
OPTDONTHANDLEPGPKEYS, /* (pseudo) used to extract PGP keys */
OPTUNBUFFEREDINPUT, /* (pseudo) don't use key buffer */
- OPTMAX
+ OPTMAX,
+ OPTSAVEDFLAG
};
#define mutt_bit_alloc(n) calloc ((n + 7) / 8, sizeof (char))
Index: mx.c
===================================================================
RCS file: /home/roessler/cvs/mutt/mx.c,v
retrieving revision 3.25
diff -u -r3.25 mx.c
--- mx.c 19 Dec 2005 17:22:46 -0000 3.25
+++ mx.c 14 Mar 2006 16:10:16 -0000
@@ -768,7 +768,7 @@
}
/* save changes to disk */
-static int sync_mailbox (CONTEXT *ctx, int *index_hint)
+static int sync_mailbox (CONTEXT *ctx, int *index_hint, int purge)
{
#ifdef BUFFY_SIZE
BUFFY *tmp = NULL;
@@ -782,7 +782,7 @@
{
case M_MBOX:
case M_MMDF:
- rc = mbox_sync_mailbox (ctx, index_hint);
+ rc = mbox_sync_mailbox (ctx, index_hint, purge);
#ifdef BUFFY_SIZE
tmp = mutt_find_mailbox (ctx->path);
#endif
@@ -988,7 +988,7 @@
else
#endif
{
- if (!purge)
+ if (!purge && !option (OPTSAVEDFLAG))
{
for (i = 0; i < ctx->msgcount; i++)
ctx->hdrs[i]->deleted = 0;
@@ -997,7 +997,7 @@
if (ctx->changed || ctx->deleted)
{
- if ((check = sync_mailbox (ctx, index_hint)) != 0)
+ if ((check = sync_mailbox (ctx, index_hint, purge)) != 0)
{
ctx->closing = 0;
return check;
@@ -1006,12 +1006,19 @@
}
if (move_messages)
- mutt_message (_("%d kept, %d moved, %d deleted."),
- ctx->msgcount - ctx->deleted, read_msgs, ctx->deleted);
+ if (purge)
+ mutt_message (_("%d kept, %d moved, %d deleted."),
+ ctx->msgcount - ctx->deleted, read_msgs, ctx->deleted);
+ else
+ mutt_message (_("%d kept, %d moved, %d deleted."),
+ ctx->msgcount, read_msgs, 0);
else
- mutt_message (_("%d kept, %d deleted."),
- ctx->msgcount - ctx->deleted, ctx->deleted);
-
+ if (purge)
+ mutt_message (_("%d kept, %d deleted."),
+ ctx->msgcount - ctx->deleted, ctx->deleted);
+ else
+ mutt_message (_("%d kept, %d deleted."),
+ ctx->msgcount, 0);
if (ctx->msgcount == ctx->deleted &&
(ctx->magic == M_MMDF || ctx->magic == M_MBOX) &&
!mutt_is_spool(ctx->path) && !option (OPTSAVEEMPTY))
@@ -1175,7 +1182,7 @@
rc = imap_sync_mailbox (ctx, purge, index_hint);
else
#endif
- rc = sync_mailbox (ctx, index_hint);
+ rc = sync_mailbox (ctx, index_hint, purge);
if (rc == 0)
{
#ifdef USE_IMAP
Index: mx.h
===================================================================
RCS file: /home/roessler/cvs/mutt/mx.h,v
retrieving revision 3.7
diff -u -r3.7 mx.h
--- mx.h 17 Sep 2005 20:46:10 -0000 3.7
+++ mx.h 14 Mar 2006 16:10:16 -0000
@@ -47,7 +47,7 @@
#define MMDF_SEP "\001\001\001\001\n"
#define MAXLOCKATTEMPT 5
-int mbox_sync_mailbox (CONTEXT *, int *);
+int mbox_sync_mailbox (CONTEXT *, int *, int);
int mbox_open_mailbox (CONTEXT *);
int mbox_check_mailbox (CONTEXT *, int *);
int mbox_close_mailbox (CONTEXT *);