[57238] trunk/dports/mail/mutt-devel
macsforever2000 at macports.org
macsforever2000 at macports.org
Mon Sep 7 17:54:43 PDT 2009
Revision: 57238
http://trac.macports.org/changeset/57238
Author: macsforever2000 at macports.org
Date: 2009-09-07 17:54:43 -0700 (Mon, 07 Sep 2009)
Log Message:
-----------
Added trash variant. (#20412)
Modified Paths:
--------------
trunk/dports/mail/mutt-devel/Portfile
Added Paths:
-----------
trunk/dports/mail/mutt-devel/files/patch-1.5.20.cd.purge_message.diff
trunk/dports/mail/mutt-devel/files/patch-1.5.20.cd.trash_folder.diff
Modified: trunk/dports/mail/mutt-devel/Portfile
===================================================================
--- trunk/dports/mail/mutt-devel/Portfile 2009-09-08 00:53:55 UTC (rev 57237)
+++ trunk/dports/mail/mutt-devel/Portfile 2009-09-08 00:54:43 UTC (rev 57238)
@@ -161,12 +161,6 @@
configure.args-append --enable-smtp
}
-# FIXME: doesn't apply
-#variant trash description {Add a Trash folder} {
-# patchfiles-append patch-trash-1.5.16.diff \
-# patch-1.5.17.cd.purge_message.bk.1.diff
-#}
-
variant sidebar conflicts nntp description {Add a sidebar with a list of folders} {
# http://www.lunar-linux.org/index.php/en/component/content/article/44-mutt-sidebar.html
patch_sites-append http://lunar-linux.org/~tchan/mutt/
@@ -175,6 +169,11 @@
5786519489877c92e4fff68cf547e869
}
+variant trash description {Add a Trash folder} {
+ patchfiles-append patch-1.5.20.cd.trash_folder.diff \
+ patch-1.5.20.cd.purge_message.diff
+}
+
variant gpgme description {Enable GPGME crypto support} {
configure.args-append --enable-gpgme --with-gpgme-prefix=${prefix}
depends_lib-append port:gpgme
Added: trunk/dports/mail/mutt-devel/files/patch-1.5.20.cd.purge_message.diff
===================================================================
--- trunk/dports/mail/mutt-devel/files/patch-1.5.20.cd.purge_message.diff (rev 0)
+++ trunk/dports/mail/mutt-devel/files/patch-1.5.20.cd.purge_message.diff 2009-09-08 00:54:43 UTC (rev 57238)
@@ -0,0 +1,197 @@
+diff -u mutt-1.5.20-trashfolder/OPS mutt-1.5.20-trash+purge/OPS
+--- mutt-1.5.20-trashfolder/OPS 2009-05-12 22:01:13.000000000 -0700
++++ mutt-1.5.20-trash+purge/OPS 2009-09-06 06:58:12.000000000 -0700
+@@ -141,6 +141,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"
+Common subdirectories: mutt-1.5.20-trashfolder/contrib and mutt-1.5.20-trash+purge/contrib
+diff -u mutt-1.5.20-trashfolder/curs_main.c mutt-1.5.20-trash+purge/curs_main.c
+--- mutt-1.5.20-trashfolder/curs_main.c 2009-06-13 19:48:36.000000000 -0700
++++ mutt-1.5.20-trash+purge/curs_main.c 2009-09-06 07:09:07.000000000 -0700
+@@ -1803,6 +1803,7 @@
+ MAYBE_REDRAW (menu->redraw);
+ break;
+
++ case OP_PURGE_MESSAGE:
+ case OP_DELETE:
+
+ CHECK_MSGCOUNT;
+@@ -1813,6 +1814,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;
+@@ -1820,6 +1822,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))
+@@ -2116,11 +2120,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++;
+@@ -2141,9 +2147,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)
++ + mutt_thread_set_flag (CURHDR, M_PURGED, 0,
++ op == OP_UNDELETE_THREAD ? 0 : 1);
+
+- if (rc != -1)
++ if (rc > -1)
+ {
+ if (option (OPTRESOLVE))
+ {
+Common subdirectories: mutt-1.5.20-trashfolder/doc and mutt-1.5.20-trash+purge/doc
+diff -u mutt-1.5.20-trashfolder/flags.c mutt-1.5.20-trash+purge/flags.c
+--- mutt-1.5.20-trashfolder/flags.c 2009-09-06 06:54:10.000000000 -0700
++++ mutt-1.5.20-trash+purge/flags.c 2009-09-06 07:11:28.000000000 -0700
+@@ -104,6 +104,16 @@
+ }
+ 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 -u mutt-1.5.20-trashfolder/functions.h mutt-1.5.20-trash+purge/functions.h
+--- mutt-1.5.20-trashfolder/functions.h 2009-04-29 22:36:17.000000000 -0700
++++ mutt-1.5.20-trash+purge/functions.h 2009-09-06 07:13:40.000000000 -0700
+@@ -120,6 +120,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" },
+@@ -209,6 +210,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" },
+Common subdirectories: mutt-1.5.20-trashfolder/imap and mutt-1.5.20-trash+purge/imap
+Common subdirectories: mutt-1.5.20-trashfolder/intl and mutt-1.5.20-trash+purge/intl
+Common subdirectories: mutt-1.5.20-trashfolder/m4 and mutt-1.5.20-trash+purge/m4
+diff -u mutt-1.5.20-trashfolder/mutt.h mutt-1.5.20-trash+purge/mutt.h
+--- mutt-1.5.20-trashfolder/mutt.h 2009-09-06 06:54:10.000000000 -0700
++++ mutt-1.5.20-trash+purge/mutt.h 2009-09-06 07:15:06.000000000 -0700
+@@ -188,6 +188,7 @@
+ M_UNDELETE,
+ M_DELETED,
+ M_APPENDED,
++ M_PURGED,
+ M_FLAG,
+ M_TAG,
+ M_UNTAG,
+@@ -704,6 +705,7 @@
+ unsigned int tagged : 1;
+ unsigned int deleted : 1;
+ unsigned int appended : 1; /* has been saved */
++ unsigned int purged : 1; /* bypassing the trash folder */
+ unsigned int changed : 1;
+ unsigned int attach_del : 1; /* has an attachment marked for deletion */
+ unsigned int old : 1;
+diff -u mutt-1.5.20-trashfolder/mx.c mutt-1.5.20-trash+purge/mx.c
+--- mutt-1.5.20-trashfolder/mx.c 2009-09-06 06:54:10.000000000 -0700
++++ mutt-1.5.20-trash+purge/mx.c 2009-09-06 07:17:46.000000000 -0700
+@@ -803,6 +803,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)
+ {
+ mx_close_mailbox (ctx_trash, NULL);
+diff -u mutt-1.5.20-trashfolder/pager.c mutt-1.5.20-trash+purge/pager.c
+--- mutt-1.5.20-trashfolder/pager.c 2009-06-03 13:48:31.000000000 -0700
++++ mutt-1.5.20-trash+purge/pager.c 2009-09-06 07:23:05.000000000 -0700
+@@ -2309,12 +2309,15 @@
+ 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 @@
+ 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 @@
+ 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 -u mutt-1.5.20-trashfolder/pattern.c mutt-1.5.20-trash+purge/pattern.c
+--- mutt-1.5.20-trashfolder/pattern.c 2009-06-03 13:48:31.000000000 -0700
++++ mutt-1.5.20-trash+purge/pattern.c 2009-09-06 07:25:36.000000000 -0700
+@@ -1347,8 +1347,10 @@
+ {
+ 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;
+Common subdirectories: mutt-1.5.20-trashfolder/po and mutt-1.5.20-trash+purge/po
Added: trunk/dports/mail/mutt-devel/files/patch-1.5.20.cd.trash_folder.diff
===================================================================
--- trunk/dports/mail/mutt-devel/files/patch-1.5.20.cd.trash_folder.diff (rev 0)
+++ trunk/dports/mail/mutt-devel/files/patch-1.5.20.cd.trash_folder.diff 2009-09-08 00:54:43 UTC (rev 57238)
@@ -0,0 +1,244 @@
+diff -Nru mutt-1.5.20/commands.c mutt-1.5.20-trashfolder/commands.c
+--- mutt-1.5.20/commands.c 2009-06-12 16:38:52.000000000 -0700
++++ mutt-1.5.20-trashfolder/commands.c 2009-08-30 04:27:30.000000000 -0700
+@@ -716,6 +716,7 @@
+ if (option (OPTDELETEUNTAG))
+ mutt_set_flag (Context, h, M_TAG, 0);
+ }
++ mutt_set_flag (Context, h, M_APPENDED, 1);
+
+ return 0;
+ }
+diff -Nru mutt-1.5.20/flags.c mutt-1.5.20-trashfolder/flags.c
+--- mutt-1.5.20/flags.c 2008-12-16 19:50:09.000000000 -0800
++++ mutt-1.5.20-trashfolder/flags.c 2009-08-30 04:33:19.000000000 -0700
+@@ -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;
+
++ 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 -Nru mutt-1.5.20/globals.h mutt-1.5.20-trashfolder/globals.h
+--- mutt-1.5.20/globals.h 2009-06-03 13:48:31.000000000 -0700
++++ mutt-1.5.20-trashfolder/globals.h 2009-08-30 04:33:53.000000000 -0700
+@@ -139,6 +139,7 @@
+ WHERE char *Status;
+ WHERE char *Tempdir;
+ WHERE char *Tochars;
++WHERE char *TrashPath;
+ WHERE char *Username;
+ WHERE char *Visual;
+
+diff -Nru mutt-1.5.20/imap/message.c mutt-1.5.20-trashfolder/imap/message.c
+--- mutt-1.5.20/imap/message.c 2009-06-07 10:52:57.000000000 -0700
++++ mutt-1.5.20-trashfolder/imap/message.c 2009-08-30 04:37:33.000000000 -0700
+@@ -867,6 +867,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);
+ }
+@@ -874,6 +875,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 -Nru mutt-1.5.20/init.h mutt-1.5.20-trashfolder/init.h
+--- mutt-1.5.20/init.h 2009-06-13 14:35:21.000000000 -0700
++++ mutt-1.5.20-trashfolder/init.h 2009-08-30 04:41:08.000000000 -0700
+@@ -3180,6 +3180,16 @@
+ ** 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 -Nru mutt-1.5.20/mutt.h mutt-1.5.20-trashfolder/mutt.h
+--- mutt-1.5.20/mutt.h 2009-06-12 15:15:42.000000000 -0700
++++ mutt-1.5.20-trashfolder/mutt.h 2009-08-30 04:45:49.000000000 -0700
+@@ -187,6 +187,7 @@
+ M_DELETE,
+ M_UNDELETE,
+ M_DELETED,
++ M_APPENDED,
+ M_FLAG,
+ M_TAG,
+ M_UNTAG,
+@@ -702,6 +703,7 @@
+ unsigned int flagged : 1; /* marked important? */
+ unsigned int tagged : 1;
+ unsigned int deleted : 1;
++ unsigned int appended : 1; /* has been saved */
+ unsigned int changed : 1;
+ unsigned int attach_del : 1; /* has an attachment marked for deletion */
+ unsigned int old : 1;
+@@ -873,6 +875,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 -Nru mutt-1.5.20/muttlib.c mutt-1.5.20-trashfolder/muttlib.c
+--- mutt-1.5.20/muttlib.c 2009-05-18 17:11:35.000000000 -0700
++++ mutt-1.5.20-trashfolder/muttlib.c 2009-08-30 04:49:02.000000000 -0700
+@@ -1460,7 +1460,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 -Nru mutt-1.5.20/mx.c mutt-1.5.20-trashfolder/mx.c
+--- mutt-1.5.20/mx.c 2009-06-10 21:29:41.000000000 -0700
++++ mutt-1.5.20-trashfolder/mx.c 2009-08-30 04:49:51.000000000 -0700
+@@ -773,6 +773,53 @@
+ 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)
+ {
+@@ -909,6 +956,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
+ {
+@@ -931,6 +979,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)
+@@ -1130,6 +1186,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 -Nru mutt-1.5.20/postpone.c mutt-1.5.20-trashfolder/postpone.c
+--- mutt-1.5.20/postpone.c 2009-06-13 14:28:37.000000000 -0700
++++ mutt-1.5.20-trashfolder/postpone.c 2009-08-30 04:55:51.000000000 -0700
+@@ -276,6 +276,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: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090907/41bc5fa5/attachment.html>
More information about the macports-changes
mailing list