packages: mutt/mutt-cd.purge_message.patch, mutt/mutt-cd.trash_folder.patch...

baggins baggins at pld-linux.org
Wed Mar 9 12:36:14 CET 2011


Author: baggins                      Date: Wed Mar  9 11:36:14 2011 GMT
Module: packages                      Tag: HEAD
---- Log message:
- working patches from debian

---- Files affected:
packages/mutt:
   mutt-cd.purge_message.patch (1.1 -> 1.2) , mutt-cd.trash_folder.patch (1.3 -> 1.4) 

---- Diffs:

================================================================
Index: packages/mutt/mutt-cd.purge_message.patch
diff -u packages/mutt/mutt-cd.purge_message.patch:1.1 packages/mutt/mutt-cd.purge_message.patch:1.2
--- packages/mutt/mutt-cd.purge_message.patch:1.1	Tue Feb 12 21:57:25 2002
+++ packages/mutt/mutt-cd.purge_message.patch	Wed Mar  9 12:36:09 2011
@@ -1,36 +1,85 @@
-diff -pruN1 mutt-1.3.25.trash_folder/OPS mutt-1.3.25.purge_command/OPS
---- mutt-1.3.25.trash_folder/OPS	Tue Sep 11 12:50:50 2001
-+++ mutt-1.3.25.purge_command/OPS	Wed Jan  9 20:40:27 2002
-@@ -136,2 +136,3 @@ OP_PREV_PAGE "move to the previous page"
+# vim:ft=diff:
+This is the purge message patch by Cedric Duval <cedricduval at free.fr>.
+
+(requires trash folder patch)
+
+This patch adds the purge-message function, which, unlike delete-message, will
+bypass the trash folder and really delete the mail.
+
+You can bind this function to <esc>D, for instance, by adding the following
+lines to your muttrc:
+
+bind index \eD purge-message
+bind pager \eD purge-message
+
+Please be very careful with this function, and try to use it as less as
+possible. The risk resides in getting into the habit of always using
+purge-message instead of delete-message, which would really defeat the purpose
+of having a trash folder feature.
+
+* Patch last synced with upstream:
+  - Date: 2007-02-15
+  - File: http://cedricduval.free.fr/mutt/patches/download/patch-1.5.5.1.cd.purge_message.3.4
+
+* Changes made:
+  - Updated to 1.5.13
+  - Fixed indentation of "purged" in mutt.h.
+
+== END PATCH
+--- a/OPS
++++ b/OPS
+@@ -142,6 +142,7 @@
+ OP_PREV_LINE "scroll up one line"
+ OP_PREV_PAGE "move to the previous page"
  OP_PRINT "print the current entry"
 +OP_PURGE_MESSAGE "really delete the current entry, bypassing the trash folder"
  OP_QUERY "query external program for addresses"
-diff -pruN1 mutt-1.3.25.trash_folder/curs_main.c mutt-1.3.25.purge_command/curs_main.c
---- mutt-1.3.25.trash_folder/curs_main.c	Thu Nov  8 09:56:02 2001
-+++ mutt-1.3.25.purge_command/curs_main.c	Wed Jan  9 20:40:27 2002
-@@ -1615,2 +1615,3 @@ int mutt_index_menu (void)
+ OP_QUERY_APPEND "append new query results to current results"
+ OP_QUIT "save changes to mailbox and quit"
+--- a/curs_main.c
++++ b/curs_main.c
+@@ -1843,6 +1843,7 @@
+ 	MAYBE_REDRAW (menu->redraw);
+ 	break;
  
 +      case OP_PURGE_MESSAGE:
        case OP_DELETE:
-@@ -1623,2 +1624,4 @@ int mutt_index_menu (void)
+ 
+ 	CHECK_MSGCOUNT;
+@@ -1853,6 +1854,7 @@
+ 	if (tag)
+ 	{
  	  mutt_tag_set_flag (M_DELETE, 1);
-+	  if (op == OP_PURGE_MESSAGE)
-+	    mutt_tag_set_flag (M_PURGED, 1);
++	  mutt_tag_set_flag (M_PURGED, (op != OP_PURGE_MESSAGE) ? 0 : 1);
  	  if (option (OPTDELETEUNTAG))
-@@ -1630,2 +1633,4 @@ int mutt_index_menu (void)
+ 	    mutt_tag_set_flag (M_TAG, 0);
+ 	  menu->redraw = REDRAW_INDEX;
+@@ -1860,6 +1862,8 @@
+ 	else
+ 	{
  	  mutt_set_flag (Context, CURHDR, M_DELETE, 1);
-+	  if (op == OP_PURGE_MESSAGE)
-+	    mutt_set_flag (Context, CURHDR, M_PURGED, 1);
++	  mutt_set_flag (Context, CURHDR, M_PURGED,
++			 (op != OP_PURGE_MESSAGE) ? 0 : 1);
  	  if (option (OPTDELETEUNTAG))
-@@ -1908,2 +1913,3 @@ int mutt_index_menu (void)
+ 	    mutt_set_flag (Context, CURHDR, M_TAG, 0);
+ 	  if (option (OPTRESOLVE))
+@@ -2161,11 +2165,13 @@
+ 	if (tag)
+ 	{
  	  mutt_tag_set_flag (M_DELETE, 0);
 +	  mutt_tag_set_flag (M_PURGED, 0);
  	  menu->redraw = REDRAW_INDEX;
-@@ -1913,2 +1919,3 @@ int mutt_index_menu (void)
+ 	}
+ 	else
+ 	{
  	  mutt_set_flag (Context, CURHDR, M_DELETE, 0);
 +	  mutt_set_flag (Context, CURHDR, M_PURGED, 0);
  	  if (option (OPTRESOLVE) && menu->current < Context->vcount - 1)
-@@ -1932,5 +1939,7 @@ int mutt_index_menu (void)
+ 	  {
+ 	    menu->current++;
+@@ -2186,9 +2192,11 @@
+ 	CHECK_ACL(M_ACL_DELETE, _("undelete message(s)"));
+ 
  	rc = mutt_thread_set_flag (CURHDR, M_DELETE, 0,
 -				   op == OP_UNDELETE_THREAD ? 0 : 1);
 +				   op == OP_UNDELETE_THREAD ? 0 : 1)
@@ -40,10 +89,13 @@
 -	if (rc != -1)
 +	if (rc > -1)
  	{
-diff -pruN1 mutt-1.3.25.trash_folder/flags.c mutt-1.3.25.purge_command/flags.c
---- mutt-1.3.25.trash_folder/flags.c	Wed Jan  9 20:39:31 2002
-+++ mutt-1.3.25.purge_command/flags.c	Wed Jan  9 20:40:27 2002
-@@ -100,2 +100,12 @@ void _mutt_set_flag (CONTEXT *ctx, HEADE
+ 	  if (option (OPTRESOLVE))
+ 	  {
+--- a/flags.c
++++ b/flags.c
+@@ -104,6 +104,16 @@
+       }
+       break;
  
 +    case M_PURGED:
 +      if (bf)
@@ -56,51 +108,83 @@
 +      break;
 +
      case M_NEW:
-diff -pruN1 mutt-1.3.25.trash_folder/functions.h mutt-1.3.25.purge_command/functions.h
---- mutt-1.3.25.trash_folder/functions.h	Tue Sep 11 12:51:39 2001
-+++ mutt-1.3.25.purge_command/functions.h	Wed Jan  9 20:40:27 2002
-@@ -100,2 +100,3 @@ struct binding_t OpMain[] = {
+ 
+       if (!mutt_bit_isset(ctx->rights,M_ACL_SEEN))
+--- a/functions.h
++++ b/functions.h
+@@ -121,6 +121,7 @@
+   { "toggle-write",		OP_TOGGLE_WRITE,		"%" },
+   { "next-thread",		OP_MAIN_NEXT_THREAD,		"\016" },
    { "next-subthread",		OP_MAIN_NEXT_SUBTHREAD,		"\033n" },
 +  { "purge-message",		OP_PURGE_MESSAGE,		NULL },
    { "query",			OP_QUERY,			"Q" },
-@@ -184,2 +185,3 @@ struct binding_t OpPager[] = {
+   { "quit",			OP_QUIT,			"q" },
+   { "reply",			OP_REPLY,			"r" },
+@@ -213,6 +214,7 @@
+   { "print-message",	OP_PRINT,			"p" },
+   { "previous-thread",	OP_MAIN_PREV_THREAD,		"\020" },
    { "previous-subthread",OP_MAIN_PREV_SUBTHREAD,	"\033p" },
 +  { "purge-message",	OP_PURGE_MESSAGE,		NULL },
    { "quit",		OP_QUIT,			"Q" },
-diff -pruN1 mutt-1.3.25.trash_folder/mutt.h mutt-1.3.25.purge_command/mutt.h
---- mutt-1.3.25.trash_folder/mutt.h	Wed Jan  9 20:39:31 2002
-+++ mutt-1.3.25.purge_command/mutt.h	Wed Jan  9 20:40:27 2002
-@@ -187,2 +187,3 @@ enum
+   { "exit",		OP_EXIT,			"q" },
+   { "reply",		OP_REPLY,			"r" },
+--- a/mutt.h
++++ b/mutt.h
+@@ -188,6 +188,7 @@
+   M_UNDELETE,
+   M_DELETED,
    M_APPENDED,
 +  M_PURGED,
    M_FLAG,
-@@ -620,2 +621,3 @@ typedef struct header
-   unsigned int appended : 1; /* has been saved */
-+  unsigned int purged : 1;   /* bypassing the trash folder */
+   M_TAG,
+   M_UNTAG,
+@@ -709,6 +710,7 @@
+   unsigned int flagged : 1; 		/* marked important? */
+   unsigned int tagged : 1;
+   unsigned int appended : 1;		/* has been saved */
++  unsigned int purged : 1;		/* bypassing the trash folder */
    unsigned int deleted : 1;
-diff -pruN1 mutt-1.3.25.trash_folder/mx.c mutt-1.3.25.purge_command/mx.c
---- mutt-1.3.25.trash_folder/mx.c	Wed Jan  9 20:39:31 2002
-+++ mutt-1.3.25.purge_command/mx.c	Wed Jan  9 20:40:27 2002
-@@ -841,2 +841,3 @@ static int trash_append (CONTEXT *ctx)
+   unsigned int changed : 1;
+   unsigned int attach_del : 1; 		/* has an attachment marked for deletion */
+--- a/mx.c
++++ b/mx.c
+@@ -806,6 +806,7 @@
+     {
+       for (i = 0 ; i < ctx->msgcount ; i++)
  	if (ctx->hdrs[i]->deleted && !ctx->hdrs[i]->appended
 +	    && !ctx->hdrs[i]->purged
  	    && mutt_append_message (ctx_trash, ctx, ctx->hdrs[i], 0, 0) == -1)
-diff -pruN1 mutt-1.3.25.trash_folder/pager.c mutt-1.3.25.purge_command/pager.c
---- mutt-1.3.25.trash_folder/pager.c	Fri Dec 21 01:21:03 2001
-+++ mutt-1.3.25.purge_command/pager.c	Wed Jan  9 20:40:27 2002
-@@ -2148,2 +2148,3 @@ mutt_pager (const char *banner, const ch
+ 	  {
+ 	    mx_close_mailbox (ctx_trash, NULL);
+--- a/pager.c
++++ b/pager.c
+@@ -2343,12 +2343,15 @@
+ 	MAYBE_REDRAW (redraw);
+ 	break;
  
 +      case OP_PURGE_MESSAGE:
        case OP_DELETE:
-@@ -2152,2 +2153,3 @@ mutt_pager (const char *banner, const ch
+ 	CHECK_MODE(IsHeader (extra));
+ 	CHECK_READONLY;
+ 	CHECK_ACL(M_ACL_DELETE, _("delete message"));
+ 
  	mutt_set_flag (Context, extra->hdr, M_DELETE, 1);
-+	mutt_set_flag (Context, extra->hdr, M_PURGED, 1);
++	mutt_set_flag (Context, extra->hdr, M_PURGED,
++		       ch != OP_PURGE_MESSAGE ? 0 : 1);
          if (option (OPTDELETEUNTAG))
-@@ -2461,2 +2463,3 @@ mutt_pager (const char *banner, const ch
+ 	  mutt_set_flag (Context, extra->hdr, M_TAG, 0);
+ 	redraw = REDRAW_STATUS | REDRAW_INDEX;
+@@ -2675,6 +2678,7 @@
+ 	CHECK_ACL(M_ACL_DELETE, _("undelete message"));
+ 
  	mutt_set_flag (Context, extra->hdr, M_DELETE, 0);
 +	mutt_set_flag (Context, extra->hdr, M_PURGED, 0);
  	redraw = REDRAW_STATUS | REDRAW_INDEX;
-@@ -2475,5 +2478,7 @@ mutt_pager (const char *banner, const ch
+ 	if (option (OPTRESOLVE))
+ 	{
+@@ -2690,9 +2694,11 @@
+ 	CHECK_ACL(M_ACL_DELETE, _("undelete message(s)"));
+ 
  	r = mutt_thread_set_flag (extra->hdr, M_DELETE, 0,
 +				  ch == OP_UNDELETE_THREAD ? 0 : 1)
 +	  + mutt_thread_set_flag (extra->hdr, M_PURGED, 0,
@@ -109,10 +193,13 @@
 -	if (r != -1)
 +	if (r > -1)
  	{
-diff -pruN1 mutt-1.3.25.trash_folder/pattern.c mutt-1.3.25.purge_command/pattern.c
---- mutt-1.3.25.trash_folder/pattern.c	Mon Dec  3 11:17:57 2001
-+++ mutt-1.3.25.purge_command/pattern.c	Wed Jan  9 20:40:27 2002
-@@ -1172,4 +1172,6 @@ int mutt_pattern_func (int op, char *pro
+ 	  if (option (OPTRESOLVE))
+ 	  {
+--- a/pattern.c
++++ b/pattern.c
+@@ -1357,8 +1357,10 @@
+       {
+ 	switch (op)
  	{
 -	  case M_DELETE:
  	  case M_UNDELETE:
@@ -120,8 +207,5 @@
 +			   0);
 +	  case M_DELETE:
  	    mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_DELETE, 
-diff -pruN mutt-1.3.25.orig/PATCHES mutt-1.3.25/PATCHES
---- mutt-1.3.25.orig/PATCHES    Mon Nov 26 20:16:52 2001
-+++ mutt-1.3.25/PATCHES Thu Dec  6 16:27:55 2001
-@@ -1,0 +1 @@
-+patch-1.3.25.cd.purge_command.2
+ 			  (op == M_DELETE));
+ 	    break;

================================================================
Index: packages/mutt/mutt-cd.trash_folder.patch
diff -u packages/mutt/mutt-cd.trash_folder.patch:1.3 packages/mutt/mutt-cd.trash_folder.patch:1.4
--- packages/mutt/mutt-cd.trash_folder.patch:1.3	Sun Apr 11 20:03:23 2010
+++ packages/mutt/mutt-cd.trash_folder.patch	Wed Mar  9 12:36:09 2011
@@ -1,14 +1,54 @@
-diff -dur -x '*~' -x '*.orig' mutt-1.5.10.orig/PATCHES mutt-1.5.10/PATCHES
---- mutt-1.5.10.orig/PATCHES	2005-10-07 09:29:54.000000000 +0200
-+++ mutt-1.5.10/PATCHES	2005-10-07 09:30:06.000000000 +0200
-@@ -1,2 +1,3 @@
- vvv.quote
-+patch-1.3.27.cd.trash_folder.1
- rr.compressed
-diff -dur -x '*~' -x '*.orig' mutt-1.5.10.orig/commands.c mutt-1.5.10/commands.c
---- mutt-1.5.10.orig/commands.c	2005-08-02 09:08:00.000000000 +0200
-+++ mutt-1.5.10/commands.c	2005-10-07 09:32:06.000000000 +0200
-@@ -690,6 +690,7 @@
+# vim:ft=diff:
+This is the trash folder patch by Cedric Duval <cedricduval at free.fr>.
+
+With this patch, if the trash variable is set to a path (unset by default), the
+deleted mails will be moved to a trash folder instead of being irremediably
+purged when syncing the mailbox.
+
+For instance, set trash="~/Mail/trash" will cause every deleted mail to go to
+this folder.
+
+Note that the append to the trash folder doesn't occur until the resync is
+done. This allows you to change your mind and undo deletes, and thus the moves
+to the trash folder are unnecessary.
+
+Notes
+
+    * You might also want to have a look at the purge message feature below
+      which is related to this patch.
+    * IMAP is now supported. To retain the previous behavior, add this to your
+      muttrc:
+      folder-hook ^imap:// 'unset trash'
+
+FAQ
+
+Every once in a while, someone asks what are the advantages of this patch over
+a macro based solution. Here's an attempt to answer this question:
+
+    * The folder history doesn't clutter up with unwanted trash entries.
+    * Delayed move to the trash allows to change one's mind.
+    * No need to treat the case of "normal folders" and trash folders
+      separately with folder-hooks, and to create two sets of macros (one for
+      the index, one for the pager).
+    * Works not only with delete-message, but also with every deletion
+      functions like delete-pattern, delete-thread or delete-subthread.
+
+To sum up, it's more integrated and transparent to the user.
+
+* Patch last synced with upstream:
+  - Date: 2007-02-15
+  - File: http://cedricduval.free.fr/mutt/patches/download/patch-1.5.5.1.cd.trash_folder.3.4
+
+* Changes made:
+  - Updated to 1.5.13:
+    - structure of _mutt_save_message changed (commands.c)
+    - context of option (OPTCONFIRMAPPEND) changed (muttlib.c)
+  - Fixed indentation of "appended" in mutt.h.
+
+== END PATCH
+--- a/commands.c
++++ b/commands.c
+@@ -717,6 +717,7 @@
      if (option (OPTDELETEUNTAG))
        mutt_set_flag (Context, h, M_TAG, 0);
    }
@@ -16,19 +56,24 @@
    
    return 0;
  }
-Only in mutt-1.5.10/doc: manual-1.html
-Only in mutt-1.5.10/doc: manual-2.html
-Only in mutt-1.5.10/doc: manual-3.html
-Only in mutt-1.5.10/doc: manual-4.html
-Only in mutt-1.5.10/doc: manual-5.html
-Only in mutt-1.5.10/doc: manual-6.html
-Only in mutt-1.5.10/doc: manual-7.html
-Only in mutt-1.5.10/doc: manual.html
-Only in mutt-1.5.10/doc: manual.txt
-diff -dur -x '*~' -x '*.orig' mutt-1.5.10.orig/flags.c mutt-1.5.10/flags.c
---- mutt-1.5.10.orig/flags.c	2005-02-03 19:47:52.000000000 +0100
-+++ mutt-1.5.10/flags.c	2005-10-07 09:30:06.000000000 +0200
-@@ -91,6 +91,17 @@
+--- a/flags.c
++++ b/flags.c
+@@ -65,7 +65,13 @@
+       {
+ 	h->deleted = 0;
+         update = 1;
+-	if (upd_ctx) ctx->deleted--;
++	if (upd_ctx)
++	{
++	  ctx->deleted--;
++	  if (h->appended)
++	    ctx->appended--;
++	}
++	h->appended = 0; /* when undeleting, also reset the appended flag */
+ #ifdef USE_IMAP
+         /* see my comment above */
+ 	if (ctx->magic == M_IMAP) 
+@@ -87,6 +93,17 @@
        }
        break;
  
@@ -45,24 +90,40 @@
 +
      case M_NEW:
  
- #ifdef USE_IMAP
-diff -dur -x '*~' -x '*.orig' mutt-1.5.10.orig/globals.h mutt-1.5.10/globals.h
---- mutt-1.5.10.orig/globals.h	2005-10-07 09:29:54.000000000 +0200
-+++ mutt-1.5.10/globals.h	2005-10-07 09:30:06.000000000 +0200
-@@ -130,6 +130,7 @@
+       if (!mutt_bit_isset(ctx->rights,M_ACL_SEEN))
+--- a/globals.h
++++ b/globals.h
+@@ -139,6 +139,7 @@
  WHERE char *Status;
  WHERE char *Tempdir;
  WHERE char *Tochars;
 +WHERE char *TrashPath;
  WHERE char *Username;
  WHERE char *Visual;
- 
-diff -dur -x '*~' -x '*.orig' mutt-1.5.10.orig/init.h mutt-1.5.10/init.h
---- mutt-1.5.10.orig/init.h	2005-10-07 09:29:54.000000000 +0200
-+++ mutt-1.5.10/init.h	2005-10-07 09:30:06.000000000 +0200
-@@ -2774,6 +2774,13 @@
+ WHERE char *XtermTitle;
+--- a/imap/message.c
++++ b/imap/message.c
+@@ -876,6 +876,7 @@
+         if (ctx->hdrs[n]->tagged)
+         {
+           mutt_set_flag (ctx, ctx->hdrs[n], M_DELETE, 1);
++	  mutt_set_flag (ctx, ctx->hdrs[n], M_APPENDED, 1);
+           if (option (OPTDELETEUNTAG))
+             mutt_set_flag (ctx, ctx->hdrs[n], M_TAG, 0);
+         }
+@@ -883,6 +884,7 @@
+     else
+     {
+       mutt_set_flag (ctx, h, M_DELETE, 1);
++      mutt_set_flag (ctx, h, M_APPENDED, 1);
+       if (option (OPTDELETEUNTAG))
+         mutt_set_flag (ctx, h, M_TAG, 0);
+     }
+--- a/init.h
++++ b/init.h
+@@ -3195,6 +3195,16 @@
    ** by \fIyou\fP.  The sixth character is used to indicate when a mail
-   ** was sent to a mailing-list you subscribe to (default: L).
+   ** was sent to a mailing-list you subscribe to.
    */
 +  { "trash",		DT_PATH, R_NONE, UL &TrashPath, 0 },
 +  /*
@@ -70,14 +131,16 @@
 +  ** If set, this variable specifies the path of the trash folder where the
 +  ** mails marked for deletion will be moved, instead of being irremediably
 +  ** purged.
++  ** .pp
++  ** NOTE: When you delete a message in the trash folder, it is really
++  ** deleted, so that you have a way to clean the trash.
 +  */
  #ifdef USE_SOCKET
    { "tunnel",            DT_STR, R_NONE, UL &Tunnel, UL 0 },
    /*
-diff -dur -x '*~' -x '*.orig' mutt-1.5.10.orig/mutt.h mutt-1.5.10/mutt.h
---- mutt-1.5.10.orig/mutt.h	2005-10-07 09:29:54.000000000 +0200
-+++ mutt-1.5.10/mutt.h	2005-10-07 09:30:06.000000000 +0200
-@@ -207,6 +207,7 @@
+--- a/mutt.h
++++ b/mutt.h
+@@ -187,6 +187,7 @@
    M_DELETE,
    M_UNDELETE,
    M_DELETED,
@@ -85,26 +148,38 @@
    M_FLAG,
    M_TAG,
    M_UNTAG,
-@@ -702,6 +703,7 @@
-   unsigned int mime : 1;    		/* has a Mime-Version header? */
+@@ -707,6 +708,7 @@
+   unsigned int mime : 1;    		/* has a MIME-Version header? */
    unsigned int flagged : 1; 		/* marked important? */
    unsigned int tagged : 1;
-+  unsigned int appended : 1; /* has been saved */
++  unsigned int appended : 1;		/* has been saved */
    unsigned int deleted : 1;
    unsigned int changed : 1;
    unsigned int attach_del : 1; 		/* has an attachment marked for deletion */
-@@ -830,6 +832,7 @@
+@@ -879,6 +881,7 @@
    int new;			/* how many new messages? */
    int unread;			/* how many unread messages? */
    int deleted;			/* how many deleted messages */
 +  int appended;                 /* how many saved messages? */
    int flagged;			/* how many flagged messages */
    int msgnotreadyet;		/* which msg "new" in pager, -1 if none */
- #if defined USE_POP || defined USE_IMAP
-diff -dur -x '*~' -x '*.orig' mutt-1.5.10.orig/mx.c mutt-1.5.10/mx.c
---- mutt-1.5.10.orig/mx.c	2005-10-07 09:29:54.000000000 +0200
-+++ mutt-1.5.10/mx.c	2005-10-07 09:30:06.000000000 +0200
-@@ -850,6 +850,47 @@
+ 
+--- a/muttlib.c
++++ b/muttlib.c
+@@ -1515,7 +1515,9 @@
+ 
+   if (magic > 0 && !mx_access (s, W_OK))
+   {
+-    if (option (OPTCONFIRMAPPEND))
++    if (option (OPTCONFIRMAPPEND) &&
++	(!TrashPath || (mutt_strcmp (s, TrashPath) != 0)))
++      /* if we're appending to the trash, there's no point in asking */
+     {
+       snprintf (tmp, sizeof (tmp), _("Append messages to %s?"), s);
+       if ((rc = mutt_yesorno (tmp, M_YES)) == M_NO)
+--- a/mx.c
++++ b/mx.c
+@@ -776,6 +776,53 @@
    return rc;
  }
  
@@ -112,13 +187,19 @@
 +static int trash_append (CONTEXT *ctx)
 +{
 +    CONTEXT *ctx_trash;
-+    int i;
++    int i = 0;
 +    struct stat st, stc;
 +
-+    if (!TrashPath || !ctx->deleted)
++    if (!TrashPath || !ctx->deleted ||
++	(ctx->magic == M_MAILDIR && option (OPTMAILDIRTRASH)))
 +      return 0;
 +
-+    if (!mutt_save_confirm (TrashPath, &st))
++    for (;i < ctx->msgcount && (!ctx->hdrs[i]->deleted ||
++				ctx->hdrs[i]->appended); i++);
++    if (i == ctx->msgcount)
++      return 0; /* nothing to be done */
++
++    if (mutt_save_confirm (TrashPath, &st) != 0)
 +    {
 +      mutt_error _("message(s) not deleted");
 +      return -1;
@@ -152,45 +233,45 @@
  /* save changes and close mailbox */
  int mx_close_mailbox (CONTEXT *ctx, int *index_hint)
  {
-@@ -1032,11 +1073,19 @@
- 
-     if (ctx->changed || ctx->deleted)
-     {
--      if ((check = sync_mailbox (ctx, index_hint)) != 0)
-+      int trsh = 0;
-+
-+      if ((!ctx->deleted || (trsh = trash_append (ctx)) == 0)
-+	&& (check = sync_mailbox (ctx, index_hint)) != 0)
-       {
- 	ctx->closing = 0;
- 	return check;
-       }
-+      if (trsh != 0)
-+      {
-+	ctx->closing = 0;
-+	return -1;
-+      }
-     }
+@@ -912,6 +959,7 @@
+ 	  if (mutt_append_message (&f, ctx, ctx->hdrs[i], 0, CH_UPDATE_LEN) == 0)
+ 	  {
+ 	    mutt_set_flag (ctx, ctx->hdrs[i], M_DELETE, 1);
++	    mutt_set_flag (ctx, ctx->hdrs[i], M_APPENDED, 1);
+ 	  }
+ 	  else
+ 	  {
+@@ -936,6 +984,14 @@
+     return 0;
    }
- 
-@@ -1214,8 +1263,12 @@
+   
++  /* copy mails to the trash before expunging */
++  if (purge && ctx->deleted && mutt_strcmp(ctx->path, TrashPath))
++    if (trash_append (ctx) != 0)
++    {
++      ctx->closing = 0;
++      return -1;
++    }
++
+ #ifdef USE_IMAP
+   /* allow IMAP to preserve the deleted flag across sessions */
    if (ctx->magic == M_IMAP)
-     rc = imap_sync_mailbox (ctx, purge, index_hint);
-   else
--#endif
-+#endif /* enter this block unconditionally if IMAP is not used */
+@@ -1133,6 +1189,12 @@
+   msgcount = ctx->msgcount;
+   deleted = ctx->deleted;
+ 
++  if (purge && ctx->deleted && mutt_strcmp(ctx->path, TrashPath))
 +  {
 +    if (trash_append (ctx) == -1)
 +      return -1;
-     rc = sync_mailbox (ctx, index_hint);
 +  }
-   if (rc == 0)
-   {
++
  #ifdef USE_IMAP
-diff -dur -x '*~' -x '*.orig' mutt-1.5.10.orig/postpone.c mutt-1.5.10/postpone.c
---- mutt-1.5.10.orig/postpone.c	2005-02-03 19:47:53.000000000 +0100
-+++ mutt-1.5.10/postpone.c	2005-10-07 09:30:06.000000000 +0200
-@@ -279,6 +279,9 @@
+   if (ctx->magic == M_IMAP)
+     rc = imap_sync_mailbox (ctx, purge, index_hint);
+--- a/postpone.c
++++ b/postpone.c
+@@ -277,6 +277,9 @@
    /* finished with this message, so delete it. */
    mutt_set_flag (PostContext, h, M_DELETE, 1);
  
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/mutt/mutt-cd.purge_message.patch?r1=1.1&r2=1.2&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/mutt/mutt-cd.trash_folder.patch?r1=1.3&r2=1.4&f=u



More information about the pld-cvs-commit mailing list