[34543] trunk/dports/mail/mutt-devel
jmr at macports.org
jmr at macports.org
Wed Feb 27 14:41:07 PST 2008
Revision: 34543
http://trac.macosforge.org/projects/macports/changeset/34543
Author: jmr at macports.org
Date: 2008-02-27 14:41:07 -0800 (Wed, 27 Feb 2008)
Log Message:
-----------
mutt-devel: restore 'trash' variant - from #13363.
Modified Paths:
--------------
trunk/dports/mail/mutt-devel/Portfile
Added Paths:
-----------
trunk/dports/mail/mutt-devel/files/patch-1.5.17.cd.purge_message.bk.1.diff
trunk/dports/mail/mutt-devel/files/patch-trash-1.5.16.diff
Modified: trunk/dports/mail/mutt-devel/Portfile
===================================================================
--- trunk/dports/mail/mutt-devel/Portfile 2008-02-27 22:18:44 UTC (rev 34542)
+++ trunk/dports/mail/mutt-devel/Portfile 2008-02-27 22:41:07 UTC (rev 34543)
@@ -142,3 +142,8 @@
# Include internal SMTP relay support
configure.args-append --enable-smtp
}
+
+variant trash {
+ patchfiles-append patch-trash-1.5.16.diff \
+ patch-1.5.17.cd.purge_message.bk.1.diff
+}
Added: trunk/dports/mail/mutt-devel/files/patch-1.5.17.cd.purge_message.bk.1.diff
===================================================================
--- trunk/dports/mail/mutt-devel/files/patch-1.5.17.cd.purge_message.bk.1.diff (rev 0)
+++ trunk/dports/mail/mutt-devel/files/patch-1.5.17.cd.purge_message.bk.1.diff 2008-02-27 22:41:07 UTC (rev 34543)
@@ -0,0 +1,197 @@
+diff -pruN mutt-1.5.17/OPS mutt-1.5.17-purge/OPS
+--- mutt-1.5.17/OPS 2007-05-07 14:46:12.000000000 -0400
++++ mutt-1.5.17-purge/OPS 2007-12-21 19:52:37.000000000 -0500
+@@ -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 mutt-1.5.17/PATCHES mutt-1.5.17-purge/PATCHES
+--- mutt-1.5.17/PATCHES 2007-12-21 19:45:26.000000000 -0500
++++ mutt-1.5.17-purge/PATCHES 2007-12-21 19:52:37.000000000 -0500
+@@ -1 +1,2 @@
+ patch-1.5.16hg.cd.trash_folder.vl.1
++patch-1.5.17.cd.purge_message.bk.1
+diff -pruN mutt-1.5.17/curs_main.c mutt-1.5.17-purge/curs_main.c
+--- mutt-1.5.17/curs_main.c 2007-05-28 19:19:50.000000000 -0400
++++ mutt-1.5.17-purge/curs_main.c 2007-12-21 19:52:37.000000000 -0500
+@@ -1799,6 +1799,7 @@ int mutt_index_menu (void)
+ MAYBE_REDRAW (menu->redraw);
+ break;
+
++ case OP_PURGE_MESSAGE:
+ case OP_DELETE:
+
+ CHECK_MSGCOUNT;
+@@ -1809,6 +1810,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;
+@@ -1816,6 +1818,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))
+@@ -2112,11 +2116,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++;
+@@ -2137,9 +2143,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 mutt-1.5.17/flags.c mutt-1.5.17-purge/flags.c
+--- mutt-1.5.17/flags.c 2007-12-21 19:45:26.000000000 -0500
++++ mutt-1.5.17-purge/flags.c 2007-12-21 19:52:37.000000000 -0500
+@@ -108,6 +108,16 @@ void _mutt_set_flag (CONTEXT *ctx, HEADE
+ }
+ 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 mutt-1.5.17/functions.h mutt-1.5.17-purge/functions.h
+--- mutt-1.5.17/functions.h 2007-05-07 14:45:34.000000000 -0400
++++ mutt-1.5.17-purge/functions.h 2007-12-21 19:52:37.000000000 -0500
+@@ -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" },
+@@ -207,6 +208,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 mutt-1.5.17/mutt.h mutt-1.5.17-purge/mutt.h
+--- mutt-1.5.17/mutt.h 2007-12-21 19:45:26.000000000 -0500
++++ mutt-1.5.17-purge/mutt.h 2007-12-21 19:52:37.000000000 -0500
+@@ -202,6 +202,7 @@ enum
+ M_UNDELETE,
+ M_DELETED,
+ M_APPENDED,
++ M_PURGED,
+ M_FLAG,
+ M_TAG,
+ M_UNTAG,
+@@ -713,6 +714,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 -pruN mutt-1.5.17/mx.c mutt-1.5.17-purge/mx.c
+--- mutt-1.5.17/mx.c 2007-12-21 19:45:26.000000000 -0500
++++ mutt-1.5.17-purge/mx.c 2007-12-21 19:53:07.000000000 -0500
+@@ -833,6 +833,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 -pruN mutt-1.5.17/pager.c mutt-1.5.17-purge/pager.c
+--- mutt-1.5.17/pager.c 2007-09-05 14:28:05.000000000 -0400
++++ mutt-1.5.17-purge/pager.c 2007-12-21 19:52:37.000000000 -0500
+@@ -2256,12 +2256,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;
+@@ -2574,6 +2577,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))
+ {
+@@ -2589,9 +2593,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 mutt-1.5.17/pattern.c mutt-1.5.17-purge/pattern.c
+--- mutt-1.5.17/pattern.c 2007-09-05 14:28:05.000000000 -0400
++++ mutt-1.5.17-purge/pattern.c 2007-12-21 19:52:37.000000000 -0500
+@@ -1344,8 +1344,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;
Added: trunk/dports/mail/mutt-devel/files/patch-trash-1.5.16.diff
===================================================================
--- trunk/dports/mail/mutt-devel/files/patch-trash-1.5.16.diff (rev 0)
+++ trunk/dports/mail/mutt-devel/files/patch-trash-1.5.16.diff 2008-02-27 22:41:07 UTC (rev 34543)
@@ -0,0 +1,259 @@
+diff --git a/PATCHES b/PATCHES
+index e69de29..6a47dd7 100644
+--- a/PATCHES
++++ b/PATCHES
+@@ -0,0 +1 @@
++patch-1.5.16hg.cd.trash_folder.vl.1
+diff --git a/commands.c b/commands.c
+index 2fdcb7f..998f2fd 100644
+--- a/commands.c
++++ b/commands.c
+@@ -688,6 +688,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 732eb01..6cda898 100644
+--- a/flags.c
++++ b/flags.c
+@@ -69,7 +69,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)
+@@ -91,6 +97,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 15c0d14..9699a4d 100644
+--- a/globals.h
++++ b/globals.h
+@@ -142,6 +142,7 @@ WHERE char *StChars;
+ WHERE char *Status;
+ WHERE char *Tempdir;
+ WHERE char *Tochars;
++WHERE char *TrashPath;
+ WHERE char *Username;
+ WHERE char *Visual;
+
+diff --git a/imap/message.c b/imap/message.c
+index 77cef6e..aa21819 100644
+--- a/imap/message.c
++++ b/imap/message.c
+@@ -816,6 +816,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);
+ }
+@@ -823,6 +824,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 2674bef..5f8100f 100644
+--- a/init.h
++++ b/init.h
+@@ -2863,6 +2863,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 (default: L).
+ */
++ { "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
+index 5930e14..9c07161 100644
+--- a/mutt.h
++++ b/mutt.h
+@@ -201,6 +201,7 @@ enum
+ M_DELETE,
+ M_UNDELETE,
+ M_DELETED,
++ M_APPENDED,
+ M_FLAG,
+ M_TAG,
+ M_UNTAG,
+@@ -711,6 +712,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 */
+@@ -882,6 +884,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 497b5f8..7860376 100644
+--- a/muttlib.c
++++ b/muttlib.c
+@@ -1384,7 +1384,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 afa6843..fe1fd1d 100644
+--- a/mx.c
++++ b/mx.c
+@@ -808,6 +808,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)
+ {
+@@ -943,6 +990,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
+ {
+@@ -964,6 +1012,14 @@ int mx_close_mailbox (CONTEXT *ctx, int *index_hint)
+ 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)
+@@ -1159,6 +1215,12 @@ int mx_sync_mailbox (CONTEXT *ctx, int *index_hint)
+ 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/postpone.c b/postpone.c
+index bcb8607..c367247 100644
+--- a/postpone.c
++++ b/postpone.c
+@@ -279,6 +279,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;
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20080227/9a34b8e4/attachment-0001.html
More information about the macports-changes
mailing list