[143459] trunk/dports/mail/mutt-devel
cal at macports.org
cal at macports.org
Sat Dec 12 11:31:45 PST 2015
Revision: 143459
https://trac.macports.org/changeset/143459
Author: cal at macports.org
Date: 2015-12-12 11:31:44 -0800 (Sat, 12 Dec 2015)
Log Message:
-----------
mutt-devel: Fix +sidebar regression and +trash
Fix a regression in the +sidebar patch that would cause folders with dots in
their name to be displayed in unexpected fashion. Additionally, support longer
folder names in the sidebar.
Additionally, port the +trash variant (that is actually the trash folder
& purge message patch merged) to 1.5.24.
Modified Paths:
--------------
trunk/dports/mail/mutt-devel/Portfile
Added Paths:
-----------
trunk/dports/mail/mutt-devel/files/1-Make_hierarchy_separator_for_folder_indentation_configurable.patch
trunk/dports/mail/mutt-devel/files/2-Support_long_er__folder_names_in_sidebar.patch
trunk/dports/mail/mutt-devel/files/patch-1.5.24-trash_folder-purge_message.diff
Removed Paths:
-------------
trunk/dports/mail/mutt-devel/files/patch-1.5.20.bk.trash_folder-purge_message.1
Modified: trunk/dports/mail/mutt-devel/Portfile
===================================================================
--- trunk/dports/mail/mutt-devel/Portfile 2015-12-12 19:16:08 UTC (rev 143458)
+++ trunk/dports/mail/mutt-devel/Portfile 2015-12-12 19:31:44 UTC (rev 143459)
@@ -6,6 +6,7 @@
name mutt-devel
conflicts mutt
version 1.5.24
+revision 1
categories mail
platforms darwin
license GPL-2
@@ -180,7 +181,9 @@
variant sidebar conflicts nntp trash description {Add a sidebar with a list of folders} {
# http://www.lunar-linux.org/mutt-sidebar/
patch_sites-append http://lunar-linux.org/~tchan/mutt:sidebar-patch
- patchfiles-append patch-1.5.24.sidebar.20151111.txt:sidebar-patch
+ patchfiles-append patch-1.5.24.sidebar.20151111.txt:sidebar-patch \
+ 1-Make_hierarchy_separator_for_folder_indentation_configurable.patch \
+ 2-Support_long_er__folder_names_in_sidebar.patch
checksums-append patch-1.5.24.sidebar.20151111.txt \
rmd160 521938ab47440e93f73bc5ae358e867ab3d3212c \
sha256 66441edf056032119f854fc5ee86c73eece8b95dc998c0cfae5ed05b0b035070
@@ -188,7 +191,7 @@
# Trash patch from https://trac.macports.org/ticket/20412 conflicts with sidebar patch on global.h
variant trash conflicts sidebar description {Add a Trash folder} {
- patchfiles-append patch-1.5.20.bk.trash_folder-purge_message.1
+ patchfiles-append patch-1.5.24-trash_folder-purge_message.diff
}
variant gpgme description {Enable GPGME crypto support} {
Added: trunk/dports/mail/mutt-devel/files/1-Make_hierarchy_separator_for_folder_indentation_configurable.patch
===================================================================
--- trunk/dports/mail/mutt-devel/files/1-Make_hierarchy_separator_for_folder_indentation_configurable.patch (rev 0)
+++ trunk/dports/mail/mutt-devel/files/1-Make_hierarchy_separator_for_folder_indentation_configurable.patch 2015-12-12 19:31:44 UTC (rev 143459)
@@ -0,0 +1,84 @@
+# HG changeset patch
+# User Clemens Lang <cal at macports.org>
+# Date 1449516441 -3600
+# Mon Dec 07 20:27:21 2015 +0100
+# Node ID 30679b45eeadb1ece557963cbd5915ab933fa747
+# Parent 7b9454058beba85a1878f6fd835fe1edf8b48279
+Make hierarchy separator for folder indentation configurable
+
+The sidebar-dotted patch from
+ https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=523774
+supports folders from IMAP servers that use dots as hierarchy separator.
+However, in its implementation, it breaks the sidebar for users that use
+a slash as hierarchy separators and have dots in their folder names.
+
+Support both use cases by adding a new option sidebar_folder_delim_chars
+to configure the characters that separate hierarchies, similar to what
+imap_delim_chars does. Using imap_delim_chars directly is not a good
+idea because there might be users who do not use IMAP support in mutt.
+
+Signed-off-by: Clemens Lang <cal at macports.org>
+License: GPL-2.0+
+Upstream-Status: Submitted [private email 2015-12-07]
+
+diff --git a/globals.h b/globals.h
+--- a/globals.h
++++ b/globals.h
+@@ -119,6 +119,7 @@
+ WHERE char *Sendmail;
+ WHERE char *Shell;
+ WHERE char *SidebarDelim;
++WHERE char *SidebarFolderDelimChars;
+ WHERE char *SidebarFormat;
+ WHERE char *SidebarIndentStr;
+ WHERE char *Signature;
+diff --git a/init.h b/init.h
+--- a/init.h
++++ b/init.h
+@@ -2066,6 +2066,12 @@
+ ** .pp
+ ** Should the sidebar shorten the path showed.
+ */
++ { "sidebar_folder_delim_chars", DT_STR, R_BOTH, UL &SidebarFolderDelimChars, UL "/." },
++ /*
++ ** .pp
++ ** This contains the list of characters which you would like to treat
++ ** as folder separators for displaying folders hierarchically in the sidebar.
++ */
+ {"sidebar_format", DT_STR, R_NONE, UL &SidebarFormat, UL "%B%?F? [%F]?%* %?N?%N/?%4S"},
+ /*
+ ** .pp
+diff --git a/sidebar.c b/sidebar.c
+--- a/sidebar.c
++++ b/sidebar.c
+@@ -318,21 +318,20 @@
+ sidebar_folder_name = option(OPTSIDEBARSHORTPATH) ? mutt_basename(tmp->path) : tmp->path + maildir_is_prefix*(strlen(Maildir) + 1);
+ if ( maildir_is_prefix && option(OPTSIDEBARFOLDERINDENT) ) {
+ char *tmp_folder_name;
++ char *last_folder_name_part;
+ int i;
+ tmp_folder_name = tmp->path + strlen(Maildir) + 1;
+- for (i = 0; i < strlen(tmp->path) - strlen(Maildir); i++) {
+- if (tmp_folder_name[i] == '/' || tmp_folder_name[i] == '.') sidebar_folder_depth++;
+- }
++ last_folder_name_part = tmp_folder_name;
++ for (i = 0; i < strlen(tmp_folder_name); i++) {
++ if (strchr(NONULL(SidebarFolderDelimChars), tmp_folder_name[i])) {
++ last_folder_name_part = tmp_folder_name + (i + 1);
++ sidebar_folder_depth++;
++ }
++ }
+ if (sidebar_folder_depth > 0) {
+ if (option(OPTSIDEBARSHORTPATH)) {
+- tmp_folder_name = strrchr(tmp->path, '.');
+- if (tmp_folder_name == NULL)
+- tmp_folder_name = mutt_basename(tmp->path);
+- else
+- tmp_folder_name++;
++ tmp_folder_name = last_folder_name_part;
+ }
+- else
+- tmp_folder_name = tmp->path + strlen(Maildir) + 1;
+ sidebar_folder_name = malloc(strlen(tmp_folder_name) + sidebar_folder_depth*strlen(NONULL(SidebarIndentStr)) + 1);
+ sidebar_folder_name[0]=0;
+ for (i=0; i < sidebar_folder_depth; i++)
Added: trunk/dports/mail/mutt-devel/files/2-Support_long_er__folder_names_in_sidebar.patch
===================================================================
--- trunk/dports/mail/mutt-devel/files/2-Support_long_er__folder_names_in_sidebar.patch (rev 0)
+++ trunk/dports/mail/mutt-devel/files/2-Support_long_er__folder_names_in_sidebar.patch 2015-12-12 19:31:44 UTC (rev 143459)
@@ -0,0 +1,29 @@
+# HG changeset patch
+# User Clemens Lang <cal at macports.org>
+# Date 1449516538 -3600
+# Mon Dec 07 20:28:58 2015 +0100
+# Node ID c5694b7d4b8f5acd857ad4681a29ca79c76d1e59
+# Parent 30679b45eeadb1ece557963cbd5915ab933fa747
+Support long(er) folder names in sidebar
+
+Folder names longer than 31 characters were previously cut off in the
+sidebar, even though the field provided space for 128 in the current
+implementation. Change to a generic sizeof() expression that will grow
+with the size of the declaration.
+
+Signed-off-by: Clemens Lang <cal at macports.org>
+License: GPL-2.0+
+Upstream-Status: Submitted [private email 2015-12-07]
+
+diff --git a/sidebar.c b/sidebar.c
+--- a/sidebar.c
++++ b/sidebar.c
+@@ -157,7 +157,7 @@
+ sbe.new = new;
+ sbe.flagged = flagged;
+ sbe.size = size;
+- strncpy(sbe.box, box, 31);
++ strncpy(sbe.box, box, sizeof(sbe.box) - 1);
+
+ safe_realloc(&entry, SBvisual + 2);
+ entry[SBvisual + 1] = '\0';
Deleted: trunk/dports/mail/mutt-devel/files/patch-1.5.20.bk.trash_folder-purge_message.1
===================================================================
--- trunk/dports/mail/mutt-devel/files/patch-1.5.20.bk.trash_folder-purge_message.1 2015-12-12 19:16:08 UTC (rev 143458)
+++ trunk/dports/mail/mutt-devel/files/patch-1.5.20.bk.trash_folder-purge_message.1 2015-12-12 19:31:44 UTC (rev 143459)
@@ -1,403 +0,0 @@
-diff -pruN -x'*.orig' mutt-1.5.20/OPS mutt-1.5.20-trash/OPS
---- mutt-1.5.20/OPS 2009-05-13 01:01:13.000000000 -0400
-+++ mutt-1.5.20-trash/OPS 2009-07-23 09:44:40.000000000 -0400
-@@ -141,6 +141,7 @@ OP_PREV_ENTRY "move to the previous entr
- 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 -pruN -x'*.orig' mutt-1.5.20/PATCHES mutt-1.5.20-trash/PATCHES
---- mutt-1.5.20/PATCHES 2008-11-11 14:55:46.000000000 -0500
-+++ mutt-1.5.20-trash/PATCHES 2009-07-23 09:53:20.000000000 -0400
-@@ -0,0 +1 @@
-+patch-1.5.20.bk.trash_folder-purge_message.1
-diff -pruN -x'*.orig' mutt-1.5.20/commands.c mutt-1.5.20-trash/commands.c
---- mutt-1.5.20/commands.c 2009-06-12 19:38:52.000000000 -0400
-+++ mutt-1.5.20-trash/commands.c 2009-07-23 09:44:40.000000000 -0400
-@@ -716,6 +716,7 @@ int _mutt_save_message (HEADER *h, CONTE
- if (option (OPTDELETEUNTAG))
- mutt_set_flag (Context, h, M_TAG, 0);
- }
-+ mutt_set_flag (Context, h, M_APPENDED, 1);
-
- return 0;
- }
-diff -pruN -x'*.orig' mutt-1.5.20/curs_main.c mutt-1.5.20-trash/curs_main.c
---- mutt-1.5.20/curs_main.c 2009-06-13 22:48:36.000000000 -0400
-+++ mutt-1.5.20-trash/curs_main.c 2009-07-23 09:44:40.000000000 -0400
-@@ -1803,6 +1803,7 @@ int mutt_index_menu (void)
- MAYBE_REDRAW (menu->redraw);
- break;
-
-+ case OP_PURGE_MESSAGE:
- case OP_DELETE:
-
- CHECK_MSGCOUNT;
-@@ -1813,6 +1814,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;
-@@ -1820,6 +1822,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))
-@@ -2116,11 +2120,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++;
-@@ -2141,9 +2147,11 @@ int mutt_index_menu (void)
- 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)
-+ + mutt_thread_set_flag (CURHDR, M_PURGED, 0,
-+ op == OP_UNDELETE_THREAD ? 0 : 1);
-
-- if (rc != -1)
-+ if (rc > -1)
- {
- if (option (OPTRESOLVE))
- {
-diff -pruN -x'*.orig' mutt-1.5.20/flags.c mutt-1.5.20-trash/flags.c
---- mutt-1.5.20/flags.c 2008-12-16 22:50:09.000000000 -0500
-+++ mutt-1.5.20-trash/flags.c 2009-07-23 09:44:40.000000000 -0400
-@@ -65,7 +65,13 @@ void _mutt_set_flag (CONTEXT *ctx, HEADE
- {
- 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,27 @@ void _mutt_set_flag (CONTEXT *ctx, HEADE
- }
- break;
-
-+ case M_APPENDED:
-+ if (bf)
-+ {
-+ if (!h->appended)
-+ {
-+ h->appended = 1;
-+ if (upd_ctx) ctx->appended++;
-+ }
-+ }
-+ 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 -pruN -x'*.orig' mutt-1.5.20/functions.h mutt-1.5.20-trash/functions.h
---- mutt-1.5.20/functions.h 2009-04-30 01:36:17.000000000 -0400
-+++ mutt-1.5.20-trash/functions.h 2009-07-23 09:44:40.000000000 -0400
-@@ -120,6 +120,7 @@ struct binding_t OpMain[] = { /* map: in
- { "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" },
-@@ -209,6 +210,7 @@ struct binding_t OpPager[] = { /* map: p
- { "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 -pruN -x'*.orig' mutt-1.5.20/globals.h mutt-1.5.20-trash/globals.h
---- mutt-1.5.20/globals.h 2009-06-03 16:48:31.000000000 -0400
-+++ mutt-1.5.20-trash/globals.h 2009-07-23 09:44:40.000000000 -0400
-@@ -139,6 +139,7 @@ WHERE char *StChars;
- WHERE char *Status;
- WHERE char *Tempdir;
- WHERE char *Tochars;
-+WHERE char *TrashPath;
- WHERE char *Username;
- WHERE char *Visual;
-
-diff -pruN -x'*.orig' mutt-1.5.20/imap/message.c mutt-1.5.20-trash/imap/message.c
---- mutt-1.5.20/imap/message.c 2009-06-07 13:52:57.000000000 -0400
-+++ mutt-1.5.20-trash/imap/message.c 2009-07-23 09:44:40.000000000 -0400
-@@ -867,6 +867,7 @@ int imap_copy_messages (CONTEXT* ctx, HE
- 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);
- }
-@@ -874,6 +875,7 @@ int imap_copy_messages (CONTEXT* ctx, HE
- 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 -pruN -x'*.orig' mutt-1.5.20/init.h mutt-1.5.20-trash/init.h
---- mutt-1.5.20/init.h 2009-06-13 17:35:21.000000000 -0400
-+++ mutt-1.5.20-trash/init.h 2009-07-23 09:44:40.000000000 -0400
-@@ -3180,6 +3180,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.
-+ */
- #ifdef USE_SOCKET
- { "tunnel", DT_STR, R_NONE, UL &Tunnel, UL 0 },
- /*
-diff -pruN -x'*.orig' mutt-1.5.20/mutt.h mutt-1.5.20-trash/mutt.h
---- mutt-1.5.20/mutt.h 2009-06-12 18:15:42.000000000 -0400
-+++ mutt-1.5.20-trash/mutt.h 2009-07-23 09:44:40.000000000 -0400
-@@ -187,6 +187,8 @@ enum
- M_DELETE,
- M_UNDELETE,
- M_DELETED,
-+ M_APPENDED,
-+ M_PURGED,
- M_FLAG,
- M_TAG,
- M_UNTAG,
-@@ -701,6 +703,8 @@ 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 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 */
-@@ -873,6 +877,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 -pruN -x'*.orig' mutt-1.5.20/muttlib.c mutt-1.5.20-trash/muttlib.c
---- mutt-1.5.20/muttlib.c 2009-05-18 20:11:35.000000000 -0400
-+++ mutt-1.5.20-trash/muttlib.c 2009-07-23 09:44:40.000000000 -0400
-@@ -1460,7 +1460,9 @@ int mutt_save_confirm (const char *s, 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 -pruN -x'*.orig' mutt-1.5.20/mx.c mutt-1.5.20-trash/mx.c
---- mutt-1.5.20/mx.c 2009-06-11 00:29:41.000000000 -0400
-+++ mutt-1.5.20-trash/mx.c 2009-07-23 09:44:40.000000000 -0400
-@@ -773,6 +773,54 @@ static int sync_mailbox (CONTEXT *ctx, i
- 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
-+ && !ctx->hdrs[i]->purged
-+ && 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)
- {
-@@ -909,6 +957,7 @@ int mx_close_mailbox (CONTEXT *ctx, int
- 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
- {
-@@ -931,6 +980,14 @@ int mx_close_mailbox (CONTEXT *ctx, int
- return 0;
- }
-
-+ /* copy mails to the trash before expunging */
-+ if (purge && ctx->deleted)
-+ 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)
-@@ -1130,6 +1187,12 @@ int mx_sync_mailbox (CONTEXT *ctx, int *
- msgcount = ctx->msgcount;
- deleted = ctx->deleted;
-
-+ if (purge && ctx->deleted)
-+ {
-+ if (trash_append (ctx) == -1)
-+ return -1;
-+ }
-+
- #ifdef USE_IMAP
- if (ctx->magic == M_IMAP)
- rc = imap_sync_mailbox (ctx, purge, index_hint);
-diff -pruN -x'*.orig' mutt-1.5.20/pager.c mutt-1.5.20-trash/pager.c
---- mutt-1.5.20/pager.c 2009-06-03 16:48:31.000000000 -0400
-+++ mutt-1.5.20-trash/pager.c 2009-07-23 09:44:40.000000000 -0400
-@@ -2309,12 +2309,15 @@ search_next:
- MAYBE_REDRAW (redraw);
- break;
-
-+ case OP_PURGE_MESSAGE:
- case OP_DELETE:
- 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,
-+ ch != OP_PURGE_MESSAGE ? 0 : 1);
- if (option (OPTDELETEUNTAG))
- mutt_set_flag (Context, extra->hdr, M_TAG, 0);
- redraw = REDRAW_STATUS | REDRAW_INDEX;
-@@ -2641,6 +2644,7 @@ search_next:
- 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;
- if (option (OPTRESOLVE))
- {
-@@ -2656,9 +2660,11 @@ search_next:
- 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,
- ch == OP_UNDELETE_THREAD ? 0 : 1);
-
-- if (r != -1)
-+ if (r > -1)
- {
- if (option (OPTRESOLVE))
- {
-diff -pruN -x'*.orig' mutt-1.5.20/pattern.c mutt-1.5.20-trash/pattern.c
---- mutt-1.5.20/pattern.c 2009-06-03 16:48:31.000000000 -0400
-+++ mutt-1.5.20-trash/pattern.c 2009-07-23 09:44:40.000000000 -0400
-@@ -1347,8 +1347,10 @@ int mutt_pattern_func (int op, char *pro
- {
- 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 -pruN -x'*.orig' mutt-1.5.20/postpone.c mutt-1.5.20-trash/postpone.c
---- mutt-1.5.20/postpone.c 2009-06-13 17:28:37.000000000 -0400
-+++ mutt-1.5.20-trash/postpone.c 2009-07-23 09:44:40.000000000 -0400
-@@ -276,6 +276,9 @@ int mutt_get_postponed (CONTEXT *ctx, HE
- /* 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;
-
Added: trunk/dports/mail/mutt-devel/files/patch-1.5.24-trash_folder-purge_message.diff
===================================================================
--- trunk/dports/mail/mutt-devel/files/patch-1.5.24-trash_folder-purge_message.diff (rev 0)
+++ trunk/dports/mail/mutt-devel/files/patch-1.5.24-trash_folder-purge_message.diff 2015-12-12 19:31:44 UTC (rev 143459)
@@ -0,0 +1,412 @@
+# HG changeset patch
+# User Clemens Lang <cal at macports.org>
+# Date 1449948138 -3600
+# Sat Dec 12 20:22:18 2015 +0100
+# Node ID 462bed648335a13643a39b7e5ee09bc396593a4a
+# Parent 72fbf15cd9a166881500dbcb43cb5747213077e9
+Update trash folder & purge patch for mutt 1.5.24
+
+diff --git a/OPS b/OPS
+--- 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"
+ OP_QUERY_APPEND "append new query results to current results"
+ OP_QUIT "save changes to mailbox and quit"
+diff --git a/PATCHES b/PATCHES
+--- a/PATCHES
++++ b/PATCHES
+@@ -0,0 +1,1 @@
++patch-1.5.24.trash_folder-purge_message
+diff --git a/commands.c b/commands.c
+--- a/commands.c
++++ b/commands.c
+@@ -720,6 +720,7 @@
+ if (option (OPTDELETEUNTAG))
+ mutt_set_flag (Context, h, M_TAG, 0);
+ }
++ mutt_set_flag (Context, h, M_APPENDED, 1);
+
+ return 0;
+ }
+diff --git a/curs_main.c b/curs_main.c
+--- a/curs_main.c
++++ b/curs_main.c
+@@ -1919,6 +1919,7 @@
+ MAYBE_REDRAW (menu->redraw);
+ break;
+
++ case OP_PURGE_MESSAGE:
+ case OP_DELETE:
+
+ CHECK_MSGCOUNT;
+@@ -1930,6 +1931,7 @@
+ 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;
+@@ -1937,6 +1939,8 @@
+ 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))
+@@ -2242,11 +2246,13 @@
+ 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++;
+@@ -2268,9 +2274,11 @@
+ 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
+--- 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,27 @@
+ }
+ break;
+
++ case M_APPENDED:
++ if (bf)
++ {
++ if (!h->appended)
++ {
++ h->appended = 1;
++ if (upd_ctx) ctx->appended++;
++ }
++ }
++ 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
+--- 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" },
+ { "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" },
+ { "exit", OP_EXIT, "q" },
+ { "reply", OP_REPLY, "r" },
+diff --git a/globals.h b/globals.h
+--- a/globals.h
++++ b/globals.h
+@@ -141,6 +141,7 @@
+ 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
+--- a/imap/message.c
++++ b/imap/message.c
+@@ -886,6 +886,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);
+ }
+@@ -893,6 +894,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);
+ }
+diff --git a/init.h b/init.h
+--- a/init.h
++++ b/init.h
+@@ -3367,6 +3367,16 @@
+ ** provided that ``$$ts_enabled'' has been set. This string is identical in
+ ** formatting to the one used by ``$$status_format''.
+ */
++ { "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.
++ */
+ #ifdef USE_SOCKET
+ { "tunnel", DT_STR, R_NONE, UL &Tunnel, UL 0 },
+ /*
+diff --git a/mutt.h b/mutt.h
+--- a/mutt.h
++++ b/mutt.h
+@@ -182,6 +182,8 @@
+ M_DELETE,
+ M_UNDELETE,
+ M_DELETED,
++ M_APPENDED,
++ M_PURGED,
+ M_FLAG,
+ M_TAG,
+ M_UNTAG,
+@@ -711,6 +713,8 @@
+ 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 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 */
+@@ -883,6 +887,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 */
+
+diff --git a/muttlib.c b/muttlib.c
+--- a/muttlib.c
++++ b/muttlib.c
+@@ -1511,7 +1511,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)
+diff --git a/mx.c b/mx.c
+--- a/mx.c
++++ b/mx.c
+@@ -776,6 +776,54 @@
+ 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
++ && !ctx->hdrs[i]->purged
++ && 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 +960,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 +985,14 @@
+ return 0;
+ }
+
++ /* copy mails to the trash before expunging */
++ if (purge && ctx->deleted)
++ 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 +1197,12 @@
+ msgcount = ctx->msgcount;
+ deleted = ctx->deleted;
+
++ if (purge && ctx->deleted)
++ {
++ 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/pager.c b/pager.c
+--- a/pager.c
++++ b/pager.c
+@@ -2351,6 +2351,7 @@
+ MAYBE_REDRAW (redraw);
+ break;
+
++ case OP_PURGE_MESSAGE:
+ case OP_DELETE:
+ CHECK_MODE(IsHeader (extra));
+ CHECK_READONLY;
+@@ -2358,6 +2359,8 @@
+ 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 @@
+ 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 @@
+ 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
+--- a/pattern.c
++++ b/pattern.c
+@@ -1367,8 +1367,10 @@
+ {
+ switch (op)
+ {
++ case M_UNDELETE:
++ mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_PURGED,
++ 0);
+ case M_DELETE:
+- case M_UNDELETE:
+ mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_DELETE,
+ (op == M_DELETE));
+ break;
+diff --git a/postpone.c b/postpone.c
+--- 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);
+
++ /* 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;
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20151212/4d5881ed/attachment-0001.html>
More information about the macports-changes
mailing list