[mutt] 04/11: Replace the three trash patches with neomutt's

Faidon Liambotis paravoid at moszumanska.debian.org
Fri May 13 15:33:52 UTC 2016


This is an automated email from the git hooks/post-receive script.

paravoid pushed a commit to branch wip-neomutt
in repository mutt.

commit e8fb743ba70ec483c519472184dd731d4e4d4035
Author: Faidon Liambotis <paravoid at debian.org>
Date:   Thu May 5 20:34:55 2016 +0300

    Replace the three trash patches with neomutt's
    
    - features/imap_fast_trash.patch
    - features/purge-message.patch
    - features/trash-folder.patch
---
 debian/patches/features/imap_fast_trash.patch | 112 ---------
 debian/patches/features/purge-message.patch   | 240 --------------------
 debian/patches/features/trash-folder.patch    | 314 --------------------------
 debian/patches/series                         |   4 +-
 4 files changed, 1 insertion(+), 669 deletions(-)

diff --git a/debian/patches/features/imap_fast_trash.patch b/debian/patches/features/imap_fast_trash.patch
deleted file mode 100644
index e31b733..0000000
--- a/debian/patches/features/imap_fast_trash.patch
+++ /dev/null
@@ -1,112 +0,0 @@
-From: Antonio Radici <antonio at debian.org>
-Date: Thu, 27 Feb 2014 14:29:03 +0100
-Subject: imap_fast_trash
-
-Make "move to trash folder" use IMAP COPY.
-By Paul Miller
----
- imap/imap.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- imap/imap.h |  3 +++
- mx.c        |  5 +++++
- 3 files changed, 65 insertions(+)
-
-diff --git a/imap/imap.c b/imap/imap.c
-index 1b63b3a..a8476a4 100644
---- a/imap/imap.c
-+++ b/imap/imap.c
-@@ -888,6 +888,12 @@ static int imap_make_msg_set (IMAP_DATA* idata, BUFFER* buf, int flag,
-           if (hdrs[n]->deleted != HEADER_DATA(hdrs[n])->deleted)
-             match = invert ^ hdrs[n]->deleted;
- 	  break;
-+        case M_EXPIRED: /* imap_fast_trash version of M_DELETED */
-+	  if (hdrs[n]->purged)
-+	    break;
-+          if (hdrs[n]->deleted != HEADER_DATA(hdrs[n])->deleted)
-+            match = invert ^ (hdrs[n]->deleted && !hdrs[n]->appended);
-+	  break;
-         case M_FLAG:
-           if (hdrs[n]->flagged != HEADER_DATA(hdrs[n])->flagged)
-             match = invert ^ hdrs[n]->flagged;
-@@ -2038,3 +2044,54 @@ int imap_complete(char* dest, size_t dlen, char* path) {
- 
-   return -1;
- }
-+
-+int imap_fast_trash() {
-+
-+    if( Context->magic == M_IMAP && mx_is_imap(TrashPath) ) {
-+        IMAP_MBOX mx;
-+        IMAP_DATA *idata = (IMAP_DATA *) Context->data;
-+        char mbox[LONG_STRING];
-+        char mmbox[LONG_STRING];
-+        int rc;
-+        dprint(1, (debugfile, "[itf] trashcan seems to be on imap.\n"));
-+
-+        if ( imap_parse_path(TrashPath, &mx) == 0 ) {
-+            if( mutt_account_match(&(idata->conn->account), &(mx.account)) ) {
-+                dprint(1, (debugfile, "[itf] trashcan seems to be on the same account.\n"));
-+
-+                imap_fix_path (idata, mx.mbox, mbox, sizeof (mbox));
-+                if (!*mbox)
-+                    strfcpy (mbox, "INBOX", sizeof (mbox));
-+                imap_munge_mbox_name (idata, mmbox, sizeof (mmbox), mbox);
-+
-+                rc = imap_exec_msgset (idata, "UID COPY", mmbox, M_EXPIRED, 0, 0);
-+                if (!rc) {
-+                    dprint (1, (debugfile, "imap_copy_messages: No messages del-tagged\n"));
-+                    rc = -1;
-+                    goto old_way;
-+
-+                } else if (rc < 0) {
-+                    dprint (1, (debugfile, "could not queue copy\n"));
-+                    goto old_way;
-+
-+                } else {
-+                    mutt_message (_("Copying %d messages to %s..."), rc, mbox);
-+                    return 0;
-+                }
-+
-+            } else {
-+                dprint(1, (debugfile, "[itf] trashcan seems to be on a different account.\n"));
-+            }
-+
-+            old_way:
-+            FREE (&mx.mbox); /* we probably only need to free this when the parse works */
-+
-+        } else {
-+            dprint(1, (debugfile, "[itf] failed to parse TrashPath.\n" ));
-+        }
-+
-+        dprint(1, (debugfile, "[itf] giving up and trying old fasioned way.\n" ));
-+    }
-+
-+    return 1;
-+}
-diff --git a/imap/imap.h b/imap/imap.h
-index a914b40..62b9acf 100644
---- a/imap/imap.h
-+++ b/imap/imap.h
-@@ -72,4 +72,7 @@ void imap_keepalive (void);
- 
- int imap_account_match (const ACCOUNT* a1, const ACCOUNT* a2);
- 
-+/* trash */
-+int imap_fast_trash();
-+
- #endif
-diff --git a/mx.c b/mx.c
-index 0a7a188..4d1101f 100644
---- a/mx.c
-+++ b/mx.c
-@@ -802,6 +802,11 @@ static int trash_append (CONTEXT *ctx)
- 	&& stc.st_dev == st.st_dev && stc.st_rdev == st.st_rdev)
-       return 0;  /* we are in the trash folder: simple sync */
- 
-+    #ifdef USE_IMAP
-+    if( !imap_fast_trash() )
-+        return 0;
-+    #endif
-+
-     if ((ctx_trash = mx_open_mailbox (TrashPath, M_APPEND, NULL)) != NULL)
-     {
-       for (i = 0 ; i < ctx->msgcount ; i++)
diff --git a/debian/patches/features/purge-message.patch b/debian/patches/features/purge-message.patch
deleted file mode 100644
index 37e3ad2..0000000
--- a/debian/patches/features/purge-message.patch
+++ /dev/null
@@ -1,240 +0,0 @@
-From: Cedric Duval <cedricduval at free.fr>
-Date: Thu, 27 Feb 2014 14:21:59 +0100
-Subject: purge-message
-
-(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.
-
-Signed-off-by: Matteo F. Vescovi <mfvescovi at gmail.com>
----
- OPS         |  1 +
- curs_main.c | 12 ++++++++++--
- flags.c     | 10 ++++++++++
- functions.h |  2 ++
- mutt.h      |  2 ++
- mx.c        |  1 +
- pager.c     |  8 +++++++-
- pattern.c   |  4 +++-
- 8 files changed, 36 insertions(+), 4 deletions(-)
-
-diff --git a/OPS b/OPS
-index 8414a8b..02cea8e 100644
---- a/OPS
-+++ b/OPS
-@@ -142,6 +142,7 @@ OP_PREV_ENTRY "move to the previous entry"
- 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"
- OP_QUERY_APPEND "append new query results to current results"
- OP_QUIT "save changes to mailbox and quit"
-diff --git a/curs_main.c b/curs_main.c
-index adcca95..74879a5 100644
---- a/curs_main.c
-+++ b/curs_main.c
-@@ -1996,6 +1996,7 @@ int mutt_index_menu (void)
- 	MAYBE_REDRAW (menu->redraw);
- 	break;
- 
-+      case OP_PURGE_MESSAGE:
-       case OP_DELETE:
- 
- 	CHECK_MSGCOUNT;
-@@ -2007,6 +2008,7 @@ int mutt_index_menu (void)
- 	if (tag)
- 	{
- 	  mutt_tag_set_flag (M_DELETE, 1);
-+	  mutt_tag_set_flag (M_PURGED, (op != OP_PURGE_MESSAGE) ? 0 : 1);
- 	  if (option (OPTDELETEUNTAG))
- 	    mutt_tag_set_flag (M_TAG, 0);
- 	  menu->redraw = REDRAW_INDEX;
-@@ -2014,6 +2016,8 @@ int mutt_index_menu (void)
- 	else
- 	{
- 	  mutt_set_flag (Context, CURHDR, M_DELETE, 1);
-+	  mutt_set_flag (Context, CURHDR, M_PURGED,
-+			 (op != OP_PURGE_MESSAGE) ? 0 : 1);
- 	  if (option (OPTDELETEUNTAG))
- 	    mutt_set_flag (Context, CURHDR, M_TAG, 0);
- 	  if (option (OPTRESOLVE))
-@@ -2319,11 +2323,13 @@ int mutt_index_menu (void)
- 	if (tag)
- 	{
- 	  mutt_tag_set_flag (M_DELETE, 0);
-+	  mutt_tag_set_flag (M_PURGED, 0);
- 	  menu->redraw = REDRAW_INDEX;
- 	}
- 	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)
- 	  {
- 	    menu->current++;
-@@ -2345,9 +2351,11 @@ int mutt_index_menu (void)
- 	CHECK_ACL(M_ACL_DELETE, _("Cannot undelete message(s)"));
- 
- 	rc = mutt_thread_set_flag (CURHDR, M_DELETE, 0,
--				   op == OP_UNDELETE_THREAD ? 0 : 1);
-+				   op == OP_UNDELETE_THREAD ? 0 : 1)
-+	  + mutt_thread_set_flag (CURHDR, M_PURGED, 0,
-+				  op == OP_UNDELETE_THREAD ? 0 : 1);
- 
--	if (rc != -1)
-+	if (rc > -1)
- 	{
- 	  if (option (OPTRESOLVE))
- 	  {
-diff --git a/flags.c b/flags.c
-index dfa6a50..5309bb7 100644
---- a/flags.c
-+++ b/flags.c
-@@ -104,6 +104,16 @@ void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx)
-       }
-       break;
- 
-+    case M_PURGED:
-+      if (bf)
-+      {
-+	if (!h->purged)
-+	  h->purged = 1;
-+      }
-+      else if (h->purged)
-+	h->purged = 0;
-+      break;
-+
-     case M_NEW:
- 
-       if (!mutt_bit_isset(ctx->rights,M_ACL_SEEN))
-diff --git a/functions.h b/functions.h
-index 7a1c5a9..a29388c 100644
---- a/functions.h
-+++ b/functions.h
-@@ -121,6 +121,7 @@ const struct binding_t OpMain[] = { /* map: index */
-   { "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" },
-   { "quit",			OP_QUIT,			"q" },
-   { "reply",			OP_REPLY,			"r" },
-@@ -213,6 +214,7 @@ const struct binding_t OpPager[] = { /* map: pager */
-   { "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" },
-   { "exit",		OP_EXIT,			"q" },
-   { "reply",		OP_REPLY,			"r" },
-diff --git a/mutt.h b/mutt.h
-index 98e1b89..dfc834e 100644
---- a/mutt.h
-+++ b/mutt.h
-@@ -183,6 +183,7 @@ enum
-   M_UNDELETE,
-   M_DELETED,
-   M_APPENDED,
-+  M_PURGED,
-   M_FLAG,
-   M_TAG,
-   M_UNTAG,
-@@ -721,6 +722,7 @@ typedef struct header
-   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;
-   unsigned int changed : 1;
-   unsigned int attach_del : 1; 		/* has an attachment marked for deletion */
-diff --git a/mx.c b/mx.c
-index 638c483..0a7a188 100644
---- a/mx.c
-+++ b/mx.c
-@@ -806,6 +806,7 @@ static int trash_append (CONTEXT *ctx)
-     {
-       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)
- 	  {
- 	    mx_close_mailbox (ctx_trash, NULL);
-diff --git a/pager.c b/pager.c
-index 8bfe72c..b9f72c2 100644
---- a/pager.c
-+++ b/pager.c
-@@ -2351,6 +2351,7 @@ search_next:
- 	MAYBE_REDRAW (redraw);
- 	break;
- 
-+      case OP_PURGE_MESSAGE:
-       case OP_DELETE:
- 	CHECK_MODE(IsHeader (extra));
- 	CHECK_READONLY;
-@@ -2358,6 +2359,8 @@ search_next:
- 	CHECK_ACL(M_ACL_DELETE, _("Cannot delete message"));
- 
- 	mutt_set_flag (Context, extra->hdr, M_DELETE, 1);
-+	mutt_set_flag (Context, extra->hdr, M_PURGED,
-+		       ch != OP_PURGE_MESSAGE ? 0 : 1);
-         if (option (OPTDELETEUNTAG))
- 	  mutt_set_flag (Context, extra->hdr, M_TAG, 0);
- 	redraw = REDRAW_STATUS | REDRAW_INDEX;
-@@ -2688,6 +2691,7 @@ search_next:
- 	CHECK_ACL(M_ACL_DELETE, _("Cannot 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;
- 	if (option (OPTRESOLVE))
- 	{
-@@ -2704,9 +2708,11 @@ search_next:
- 	CHECK_ACL(M_ACL_DELETE, _("Cannot 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,
- 				  ch == OP_UNDELETE_THREAD ? 0 : 1);
- 
--	if (r != -1)
-+	if (r > -1)
- 	{
- 	  if (option (OPTRESOLVE))
- 	  {
-diff --git a/pattern.c b/pattern.c
-index d954cdc..aeef591 100644
---- a/pattern.c
-+++ b/pattern.c
-@@ -1367,8 +1367,10 @@ int mutt_pattern_func (int op, char *prompt)
-       {
- 	switch (op)
- 	{
--	  case M_DELETE:
- 	  case M_UNDELETE:
-+	    mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_PURGED,
-+			   0);
-+	  case M_DELETE:
- 	    mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_DELETE, 
- 			  (op == M_DELETE));
- 	    break;
diff --git a/debian/patches/features/trash-folder.patch b/debian/patches/features/trash-folder.patch
deleted file mode 100644
index f76a18d..0000000
--- a/debian/patches/features/trash-folder.patch
+++ /dev/null
@@ -1,314 +0,0 @@
-From: Cedric Duval <cedricduval at free.fr>
-Date: Tue, 15 Sep 2015 22:07:53 +0200
-Subject: trash-folder
-
-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.
-
-Signed-off-by: Matteo F. Vescovi <mfv at debian.org>
----
- commands.c     |  1 +
- flags.c        | 19 +++++++++++++++++-
- globals.h      |  1 +
- imap/message.c |  2 ++
- init.h         | 10 ++++++++++
- mutt.h         |  3 +++
- muttlib.c      |  4 +++-
- mx.c           | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- postpone.c     |  3 +++
- 9 files changed, 103 insertions(+), 2 deletions(-)
-
-diff --git a/commands.c b/commands.c
-index 2a0cdc9..554efb6 100644
---- a/commands.c
-+++ b/commands.c
-@@ -720,6 +720,7 @@ int _mutt_save_message (HEADER *h, CONTEXT *ctx, int delete, int decode, int dec
-     if (option (OPTDELETEUNTAG))
-       mutt_set_flag (Context, h, M_TAG, 0);
-   }
-+  mutt_set_flag (Context, h, M_APPENDED, 1);
-   
-   return 0;
- }
-diff --git a/flags.c b/flags.c
-index f0f3d81..dfa6a50 100644
---- a/flags.c
-+++ b/flags.c
-@@ -65,7 +65,13 @@ void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx)
-       {
- 	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 @@ void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx)
-       }
-       break;
- 
-+    case M_APPENDED:
-+      if (bf)
-+      {
-+	if (!h->appended)
-+	{
-+	  h->appended = 1;
-+	  if (upd_ctx) ctx->appended++;
-+	}
-+      }
-+      break;
-+
-     case M_NEW:
- 
-       if (!mutt_bit_isset(ctx->rights,M_ACL_SEEN))
-diff --git a/globals.h b/globals.h
-index abefade..241758d 100644
---- a/globals.h
-+++ b/globals.h
-@@ -141,6 +141,7 @@ WHERE char *StChars;
- WHERE char *Status;
- WHERE char *Tempdir;
- WHERE char *Tochars;
-+WHERE char *TrashPath;
- WHERE char *TSStatusFormat;
- WHERE char *TSIconFormat;
- WHERE short TSSupported;
-diff --git a/imap/message.c b/imap/message.c
-index 02a726f..9b880fe 100644
---- a/imap/message.c
-+++ b/imap/message.c
-@@ -886,6 +886,7 @@ int imap_copy_messages (CONTEXT* ctx, HEADER* h, char* dest, int delete)
-         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);
-         }
-@@ -893,6 +894,7 @@ int imap_copy_messages (CONTEXT* ctx, HEADER* h, char* dest, int delete)
-     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);
-     }
-diff --git a/init.h b/init.h
-index 7fc40bb..49a35fb 100644
---- a/init.h
-+++ b/init.h
-@@ -3398,6 +3398,16 @@ struct option_t MuttVars[] = {
-   ** by \fIyou\fP.  The sixth character is used to indicate when a mail
-   ** was sent to a mailing-list you subscribe to.
-   */
-+  { "trash",		DT_PATH, R_NONE, UL &TrashPath, 0 },
-+  /*
-+  ** .pp
-+  ** 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.
-+  */
-   {"ts_icon_format",	DT_STR,  R_BOTH, UL &TSIconFormat, UL "M%?n?AIL&ail?"},
-   /*
-   ** .pp
-diff --git a/mutt.h b/mutt.h
-index de26fd8..98e1b89 100644
---- a/mutt.h
-+++ b/mutt.h
-@@ -182,6 +182,7 @@ enum
-   M_DELETE,
-   M_UNDELETE,
-   M_DELETED,
-+  M_APPENDED,
-   M_FLAG,
-   M_TAG,
-   M_UNTAG,
-@@ -719,6 +720,7 @@ typedef struct header
-   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 deleted : 1;
-   unsigned int changed : 1;
-   unsigned int attach_del : 1; 		/* has an attachment marked for deletion */
-@@ -891,6 +893,7 @@ typedef struct _context
-   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 */
- 
-diff --git a/muttlib.c b/muttlib.c
-index a57dbf4..53cb4a3 100644
---- a/muttlib.c
-+++ b/muttlib.c
-@@ -1511,7 +1511,9 @@ int mutt_save_confirm (const char *s, struct stat *st)
- 
-   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)
-diff --git a/mx.c b/mx.c
-index acc81d4..638c483 100644
---- a/mx.c
-+++ b/mx.c
-@@ -776,6 +776,53 @@ static int sync_mailbox (CONTEXT *ctx, int *index_hint)
-   return rc;
- }
- 
-+/* move deleted mails to the trash folder */
-+static int trash_append (CONTEXT *ctx)
-+{
-+    CONTEXT *ctx_trash;
-+    int i = 0;
-+    struct stat st, stc;
-+
-+    if (!TrashPath || !ctx->deleted ||
-+	(ctx->magic == M_MAILDIR && option (OPTMAILDIRTRASH)))
-+      return 0;
-+
-+    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;
-+    }
-+
-+    if (lstat (ctx->path, &stc) == 0 && stc.st_ino == st.st_ino
-+	&& stc.st_dev == st.st_dev && stc.st_rdev == st.st_rdev)
-+      return 0;  /* we are in the trash folder: simple sync */
-+
-+    if ((ctx_trash = mx_open_mailbox (TrashPath, M_APPEND, NULL)) != NULL)
-+    {
-+      for (i = 0 ; i < ctx->msgcount ; i++)
-+	if (ctx->hdrs[i]->deleted && !ctx->hdrs[i]->appended
-+	    && mutt_append_message (ctx_trash, ctx, ctx->hdrs[i], 0, 0) == -1)
-+	  {
-+	    mx_close_mailbox (ctx_trash, NULL);
-+	    return -1;
-+	  }
-+
-+      mx_close_mailbox (ctx_trash, NULL);
-+    }
-+    else
-+    {
-+      mutt_error _("Can't open trash folder");
-+      return -1;
-+    }
-+
-+    return 0;
-+}
-+
- /* save changes and close mailbox */
- int mx_close_mailbox (CONTEXT *ctx, int *index_hint)
- {
-@@ -912,6 +959,7 @@ int mx_close_mailbox (CONTEXT *ctx, int *index_hint)
- 	  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 @@ int mx_close_mailbox (CONTEXT *ctx, int *index_hint)
-     return 0;
-   }
-   
-+  /* 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)
-@@ -1140,6 +1196,12 @@ int mx_sync_mailbox (CONTEXT *ctx, int *index_hint)
-   msgcount = ctx->msgcount;
-   deleted = ctx->deleted;
- 
-+  if (purge && ctx->deleted && mutt_strcmp(ctx->path, TrashPath))
-+  {
-+    if (trash_append (ctx) == -1)
-+      return -1;
-+  }
-+
- #ifdef USE_IMAP
-   if (ctx->magic == M_IMAP)
-     rc = imap_sync_mailbox (ctx, purge, index_hint);
-diff --git a/postpone.c b/postpone.c
-index cec150f..fdeb172 100644
---- a/postpone.c
-+++ b/postpone.c
-@@ -277,6 +277,9 @@ int mutt_get_postponed (CONTEXT *ctx, HEADER *hdr, HEADER **cur, char *fcc, size
-   /* finished with this message, so delete it. */
-   mutt_set_flag (PostContext, h, M_DELETE, 1);
- 
-+  /* and consider it saved, so that it won't be moved to the trash folder */
-+  mutt_set_flag (PostContext, h, M_APPENDED, 1);
-+
-   /* update the count for the status display */
-   PostCount = PostContext->msgcount - PostContext->deleted;
- 
diff --git a/debian/patches/series b/debian/patches/series
index 806dc2c..35d393e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,8 +1,6 @@
 misc/am-maintainer-mode.patch
 neomutt/11-ifdef.patch
-features/trash-folder.patch
-features/purge-message.patch
-features/imap_fast_trash.patch
+neomutt/14-trash.patch
 features/sensible_browser_position.patch
 features/compressed-folders.patch
 features/compressed-folders.debian.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mutt/mutt.git



More information about the pkg-mutt-commits mailing list