# vim:ft=diff: This is the purge message patch by Cedric Duval . (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 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 Index: trash/OPS =================================================================== --- trash.orig/OPS 2006-12-12 14:15:02.000000000 +0100 +++ trash/OPS 2007-02-15 19:39:57.479112576 +0100 @@ -140,6 +140,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" Index: trash/curs_main.c =================================================================== --- trash.orig/curs_main.c 2006-12-12 14:15:02.000000000 +0100 +++ trash/curs_main.c 2007-02-15 19:39:57.480112424 +0100 @@ -1778,6 +1778,7 @@ int mutt_index_menu (void) MAYBE_REDRAW (menu->redraw); break; + case OP_PURGE_MESSAGE: case OP_DELETE: CHECK_MSGCOUNT; @@ -1788,6 +1789,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; @@ -1795,6 +1797,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)) @@ -2088,11 +2092,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++; @@ -2113,9 +2119,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)) { Index: trash/flags.c =================================================================== --- trash.orig/flags.c 2007-02-15 19:38:00.433906152 +0100 +++ trash/flags.c 2007-02-15 19:39:57.480112424 +0100 @@ -105,6 +105,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)) Index: trash/functions.h =================================================================== --- trash.orig/functions.h 2005-09-18 13:16:40.000000000 +0200 +++ trash/functions.h 2007-02-15 19:39:57.481112272 +0100 @@ -103,6 +103,7 @@ struct binding_t OpMain[] = { { "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" }, @@ -189,6 +190,7 @@ struct binding_t OpPager[] = { { "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" }, Index: trash/mutt.h =================================================================== --- trash.orig/mutt.h 2007-02-15 19:38:00.435905848 +0100 +++ trash/mutt.h 2007-02-15 19:40:38.768835584 +0100 @@ -201,6 +201,7 @@ enum M_UNDELETE, M_DELETED, M_APPENDED, + M_PURGED, M_FLAG, M_TAG, M_UNTAG, @@ -705,6 +706,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 */ Index: trash/mx.c =================================================================== --- trash.orig/mx.c 2007-02-15 19:38:00.436905696 +0100 +++ trash/mx.c 2007-02-15 19:39:57.482112120 +0100 @@ -852,6 +852,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); Index: trash/pager.c =================================================================== --- trash.orig/pager.c 2006-12-12 14:15:03.000000000 +0100 +++ trash/pager.c 2007-02-15 19:39:57.482112120 +0100 @@ -2254,12 +2254,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; @@ -2572,6 +2575,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)) { @@ -2587,9 +2591,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)) { Index: trash/pattern.c =================================================================== --- trash.orig/pattern.c 2007-01-25 21:44:41.000000000 +0100 +++ trash/pattern.c 2007-02-15 19:39:57.483111968 +0100 @@ -1338,8 +1338,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; Index: trash/PATCHES =================================================================== --- trash.orig/PATCHES 2007-02-15 19:38:00.437905544 +0100 +++ trash/PATCHES 2007-02-15 19:41:01.724345816 +0100 @@ -1 +1,2 @@ patch-1.5.13.cd.trash_folder.3.4 +patch-1.5.13.cd.purge_message.3.4