From ee95edb6a42df4b45c82080c32f852781f289a02 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Sun, 13 Oct 2013 02:08:28 -0600 Subject: * Fixes in Pico so that it will crash in big files, instead of looping forever. Todo: see how this can be improved. * Add support for UID EXPUNGE in selected folders. --- pith/mailcmd.c | 9 ++++---- pith/mailcmd.h | 2 +- pith/msgno.c | 3 ++- pith/msgno.h | 2 +- pith/pine.hlp | 68 +++++++++++++++++++++++++++++++++++++--------------------- 5 files changed, 53 insertions(+), 31 deletions(-) (limited to 'pith') diff --git a/pith/mailcmd.c b/pith/mailcmd.c index 78ba98ad..23ea51ba 100644 --- a/pith/mailcmd.c +++ b/pith/mailcmd.c @@ -281,7 +281,7 @@ cmd_undelete(struct pine *state, MSGNO_S *msgmap, int copts) int -cmd_expunge_work(MAILSTREAM *stream, MSGNO_S *msgmap) +cmd_expunge_work(MAILSTREAM *stream, MSGNO_S *msgmap, char *seq) { long old_max_msgno; int rv = 0; @@ -289,7 +289,7 @@ cmd_expunge_work(MAILSTREAM *stream, MSGNO_S *msgmap) old_max_msgno = mn_get_total(msgmap); delete_filtered_msgs(stream); ps_global->expunge_in_progress = 1; - mail_expunge(stream); + mail_expunge_full(stream, seq, 0); ps_global->expunge_in_progress = 0; dprint((2,"expunge complete cur:%ld max:%ld\n", @@ -861,7 +861,8 @@ do_broach_folder(char *newfolder, CONTEXT_S *new_context, MAILSTREAM **streamp, if(IS_NEWS(ps_global->mail_stream) && ps_global->mail_stream->rdonly) msgno_exclude_deleted(ps_global->mail_stream, - sp_msgmap(ps_global->mail_stream)); + sp_msgmap(ps_global->mail_stream), + NULL); if(mn_get_total(ps_global->msgmap) > 0) mn_set_cur(ps_global->msgmap, @@ -996,7 +997,7 @@ do_broach_folder(char *newfolder, CONTEXT_S *new_context, MAILSTREAM **streamp, * hidden from view... */ if(IS_NEWS(ps_global->mail_stream) && ps_global->mail_stream->rdonly) - msgno_exclude_deleted(ps_global->mail_stream, ps_global->msgmap); + msgno_exclude_deleted(ps_global->mail_stream, ps_global->msgmap, NULL); if(we_cancel && F_OFF(F_QUELL_FILTER_MSGS, ps_global)) cancel_busy_cue(0); diff --git a/pith/mailcmd.h b/pith/mailcmd.h index 9e99c6f3..84b7e213 100644 --- a/pith/mailcmd.h +++ b/pith/mailcmd.h @@ -57,7 +57,7 @@ void cmd_cancelled(char *); void cmd_quota(struct pine *); int cmd_delete(struct pine *, MSGNO_S *, int, char *(*)(struct pine *, MSGNO_S *)); int cmd_undelete(struct pine *, MSGNO_S *, int); -int cmd_expunge_work(MAILSTREAM *, MSGNO_S *); +int cmd_expunge_work(MAILSTREAM *, MSGNO_S *, char *); CONTEXT_S *broach_get_folder(CONTEXT_S *, int *, char **); int do_broach_folder(char *, CONTEXT_S *, MAILSTREAM **, unsigned long); void expunge_and_close(MAILSTREAM *, char **, unsigned long); diff --git a/pith/msgno.c b/pith/msgno.c index 465a42e0..75669225 100644 --- a/pith/msgno.c +++ b/pith/msgno.c @@ -252,7 +252,7 @@ msgno_dec(MAILSTREAM *stream, MSGNO_S *msgs, int flags) f -- flags to use a purge criteria ----*/ void -msgno_exclude_deleted(MAILSTREAM *stream, MSGNO_S *msgs) +msgno_exclude_deleted(MAILSTREAM *stream, MSGNO_S *msgs, char *sequence) { long i, rawno; MESSAGECACHE *mc; @@ -281,6 +281,7 @@ msgno_exclude_deleted(MAILSTREAM *stream, MSGNO_S *msgs) for(i = msgs->max_msgno; i >= 1L; i--) if((rawno = mn_m2raw(msgs, i)) > 0L && stream && rawno <= stream->nmsgs && (mc = mail_elt(stream, rawno)) + && (sequence ? mc->sequence : 1) && ((mc->valid && mc->deleted) || (!mc->valid && mc->searched))){ msgno_exclude(stream, msgs, i, 0); need_isort_reset++; diff --git a/pith/msgno.h b/pith/msgno.h index 00b669c1..873ed7bb 100644 --- a/pith/msgno.h +++ b/pith/msgno.h @@ -186,7 +186,7 @@ void msgno_reset_isort(MSGNO_S *); void msgno_give(MSGNO_S **); void msgno_inc(MAILSTREAM *, MSGNO_S *, int); void msgno_dec(MAILSTREAM *, MSGNO_S *, int); -void msgno_exclude_deleted(MAILSTREAM *, MSGNO_S *); +void msgno_exclude_deleted(MAILSTREAM *, MSGNO_S *, char *); void msgno_exclude(MAILSTREAM *, MSGNO_S *, long, int); int msgno_include(MAILSTREAM *, MSGNO_S *, int); void msgno_add_raw(MSGNO_S *, long); diff --git a/pith/pine.hlp b/pith/pine.hlp index 8e0feacb..ea85d75c 100644 --- a/pith/pine.hlp +++ b/pith/pine.hlp @@ -140,7 +140,7 @@ with help text for the config screen and the composer that didn't have any reasonable place to be called from. Dummy change to get revision in pine.hlp ============= h_revision ================= -Alpine Commit 33 2013-10-05 22:46:52 +Alpine Commit 34 2013-10-13 00:44:53 ============= h_news ================= @@ -179,31 +179,36 @@ Additions include:

@@ -3182,7 +3187,6 @@ There are also additional details on <End of help on this topic> - ====== h_help_index ====== @@ -5735,6 +5739,22 @@ the text from the current folder. With newsgroups or shared mailboxes, you don't have permission to actually remove the message, so it is an exclude -- Alpine removes the message from your view of the folder even though it is not technically gone. + +

A selective expunge command is available in IMAP folders that support +the UID EXPUNGE extension in RFC 4315 as well as for all +other folders (local folders in all formats, POP3 inbox, and newsgroups) +as a subcommand of the apply command. If some selected messages are marked +deleted, then the apply command will offer the eXpunge command, which when +executed will only expunge those messages that are selected and deleted. + +

+Observe that the expunge command (when not used from the apply command) +will expunge/exclude all deleted messages from the folder, and so all +messages marked deleted will be expunged, regardless of if they are +selected or not. In other words, there is no protection against +potentially expunging more messages than only those that have been +selected and deleted.

The configuration features -- cgit v1.2.3-54-g00ecf