Kevin McCarthy [Wed, 15 Nov 2017 22:53:19 +0000 (14:53 -0800)]
Fix $smart_wrap to not be disabled by whitespace-prefixed lines. (closes #3857)
changeset:737102af74eb fixed a folded header display issue with $smart_wrap
by disabling $smart_wrap for lines beginning with whitespace.
Unfortunately, this turns off smart wrapping in the body of an email
too, even when the line has other whitespace breaks in it.
An earlier commit, changeset:125076e0fdfa added an infinite loop fix
when MUTT_PAGER_NSKIP is set, by disabling the smart_wrap if the space
backtracking went to the beginning of the line. That is, a line
beginning with 1+ whitespace followed by a single long word.
Extend this second commit by always disabling the smart_wrap in that
case, not just when MUTT_PAGER_NSKIP is set. This also solves the
folded header issue without other side effects.
Kevin McCarthy [Sat, 11 Nov 2017 23:49:15 +0000 (15:49 -0800)]
Add $change_folder_next option to control mailbox suggestion order.
This patch is out of the Gentoo package maintained by Fabian Groffen.
From the link below, it appears the original author was Simon Burge.
I made some minor changes to get it to apply correctly, and cleaned up
the documentation a bit.
Original patch description:
This patch brings back the original behaviour of change-folder, which
some people find more useful. It suggests the next folder in your
mailboxes list that has new mail measured from the current folder,
instead of the first folder from your mailboxes list in any case. This
prevents starvation of folders defined at the back of your list ;)
See discussion: http://thread.gmane.org/gmane.mail.mutt.devel/12457
David Wilson [Wed, 8 Nov 2017 21:40:34 +0000 (13:40 -0800)]
Use fgets_unlocked and fgetc_unlocked if available.
Since mutt does not use threads, there is no reason it should use the
locked variants of the FILE* IO functions. This checks if the unlocked
functions are available, and if so enables them globally via mutt.h.
Cuts load time for a 56k message, 1.8GB /var/mail mailbox from 14
seconds to ~6 seconds, since we avoid acquiring and releasing a mutex
for every character of input read.
Enable $reply_self for group-reply, even with $metoo unset.
For a (r)eply, the $metoo variable does not have any effect because
there is a single recipient.
However with (g)roup reply, the To was initially set to the sender,
but subsequently removed my $nometoo. The empty To line is then
replaced with the Cc line, resulting in a (logically correct but)
surprising outcome.
Change the behavior such that $nometoo will not strip a single To
recipient when $reply_self is set.
Kevin McCarthy [Wed, 27 Sep 2017 20:45:36 +0000 (13:45 -0700)]
Make cmd_parse_fetch() more precise about setting reopen/check flags.
Previously any FETCH with FLAGS would result in either
idata->reopen |= IMAP_EXPUNGE_PENDING;
-or-
idata->check_status = IMAP_FLAGS_PENDING;
being set.
This is unnecessary in the case of responses to FLAGS.SILENT updates
sent by mutt (which seem to commonly happen now-a-days).
Change imap_set_flags() to compare the old server flags against the
new ones, and report when _those_ updates would/did result in a local
header flag change. Only set one of the reopen/check_status flags in
the event of an actual change (or potential change if a local change
has been made to the header.)
Kevin McCarthy [Wed, 27 Sep 2017 02:44:11 +0000 (19:44 -0700)]
Fix uses of context->changed as a counter.
The first was in mx_update_tables(), but only when "not committing".
This is used by mh/maildir during an "occult" update, and in imap when
expunging the mailbox. It meant to simply turn on changed when a
single changed header is seen.
The second use was in imap_sync_message_for_copy(). Previously this
was used for a server side copy/save, but is now also used for
fast-trash copying. Remove the code that was trying to decrement the
counter: this function is not capable of properly setting a status
bit.
Kevin McCarthy [Tue, 26 Sep 2017 01:40:32 +0000 (18:40 -0700)]
Change maildir and mh check_mailbox to use dynamic sized hash. (closes #3973)
The original patch is by Matt Fleming, originally posted at
http://www.codeblueprint.co.uk/2017/01/15/a-kernel-devs-approach-to-improving2
The comments there indicate Matt tried to submit to trac and mutt-dev,
but ran into registration problems. Thank you for the patch, and
sorry for those problems, Matt.
I modified the patch by making the same change to the
mh_check_mailbox() code too.
Kevin McCarthy [Fri, 22 Sep 2017 18:12:25 +0000 (11:12 -0700)]
Close the imap socket for the selected mailbox on error.
The new $imap_poll_timeout calls the cmd_handle_fatal() error handler
on timeout, which is supposed to close and cleanup.
However, for the currently selected mailbox, the error handler was not
closing the socket after closing up the mailbox. This left extra
SSL/GnuTLS data around and was causing errors on an attempt to
reconnect.
Kevin McCarthy [Fri, 22 Sep 2017 18:07:27 +0000 (11:07 -0700)]
Fix imap sync segfault due to inactive headers during an expunge. (closes #3971)
Mutt has several places where it turns off h->active as a hack. For
example to avoid FLAG updates, or to exclude from imap_exec_msgset.
Unfortunately, when a reopen is allowed and the IMAP_EXPUNGE_PENDING
flag becomes set (e.g. a flag update to a modified header),
imap_expunge_mailbox() will be called by imap_cmd_finish().
The mx_update_tables() would free and remove these "inactive" headers,
despite that an EXPUNGE was not received for them. This would result
in memory leaks and segfaults due to dangling pointers in the
msn_index and uid_hash.
There should probably be a more elegant solution, removing the initial
hacks. However, this is causing a segfault, and the best solution
right now is to turn active back on for non-expunged messages in
imap_expunge_mailbox().
Extra thanks to chdiza, who bravely runs tip and found this issue
quickly.
Kevin McCarthy [Wed, 13 Sep 2017 22:48:16 +0000 (15:48 -0700)]
Change imap copy/save and trash to sync flags, excluding deleted. (closes #3966) (closes #3860)
imap_copy_messages() uses a helper to sync the flags before performing
a server-side copy. However, it had a bug that the "deleted" flag on
a local message, if set, will be propagated to the copy too.
Change the copy sync helper to ignore the deleted flag. Then, change
the imap trash function to use the same helper.
Thanks to Anton Lindqvist for his excellent bug report, suggested
fixes, and help testing.
Kevin McCarthy [Wed, 13 Sep 2017 22:48:13 +0000 (15:48 -0700)]
Remove \Seen flag setting for imap trash. (see #3966) (see #3860)
Commit 323e3d6e5e4c has a side effect where spurious FETCH flag
updates after setting the \Seen flag can cause a sync to abort.
Remove manually setting \Seen for all trashed message before copying.
The next commit will change the imap trash function to use the same
code as the imap copy/save function for syncing the message before
server-side copying.
Kevin McCarthy [Mon, 4 Sep 2017 20:26:55 +0000 (13:26 -0700)]
Add warning about using inline pgp with format=flowed. (closes #3963)
The reporter noted that when trying to use inline signing with
format=flowed, the flowed was turned off.
After some research, this appears to be deliberate, probably because
of strange interactions between inline PGP and format=flowed. In fact
the RFC strongly discourages their combined use:
https://tools.ietf.org/html/rfc3676#section-4.6
Add a warning and prompt to use PGP/MIME in mutt_protect().
Kevin McCarthy [Sat, 2 Sep 2017 16:36:52 +0000 (09:36 -0700)]
Fix the new certificate prompt translations.
The Esperanto, Dutch, and Czech po files weren't updated in time for
1.9. Fix the certificate prompt translations by adding a "(s)kip"
choice. Otherwise the prompts would not be functional.
Kevin McCarthy [Fri, 11 Aug 2017 16:04:48 +0000 (09:04 -0700)]
Fix parent_hdr usage in mutt_attach_reply(). (see #3728)
If the selected attachments are not messages and no (common) parent is
found, parent_hdr is set to the passed in hdr. In that case, parent
will still be NULL, but parent_hdr and parent_fp will be set.
Change the test to parent_hdr being NULL, not parent, to check for
this case.
Kevin McCarthy [Fri, 11 Aug 2017 01:18:28 +0000 (18:18 -0700)]
Add edit-content-type helper and warning for decrypted attachments. (closes #3728)
Regenerating the actx index will overwrite any changes made to a
decrypted attachment. Change the mutt_edit_content_type() function to
return 1 when a structural change is made. Add a warning message when
that is the case and a decrypted message was edited, so the user is
not surprised.
Note: mutt_edit_content_type() appeared to regenerate multipart
subparts every time, leading to a memory leak. I believe this was an
oversite, and it should have regenerated only when there were no
subparts, so have "fixed" this.
Kevin McCarthy [Fri, 11 Aug 2017 01:18:25 +0000 (18:18 -0700)]
Fix shared attachment functions. (see #3728)
With nested decryption, the correct FP is associated with the
ATTACHPTR entry. Also, the BODY entries are not continguous, so the
functions need to iterate over the actx index, not the BODY structure.
Kevin McCarthy [Fri, 11 Aug 2017 01:18:20 +0000 (18:18 -0700)]
Add helpers to add and remove actx entries. (see #3728)
Use the helper in compose update_idx(), to consolidate the resize
logic and simplify the code.
Separate out the actx "free" routine from a routine to empty out the
idx. The index regeneration routines should flush and rebuild the
index without having to renerate the actx structure.
Kevin McCarthy [Fri, 11 Aug 2017 01:18:18 +0000 (18:18 -0700)]
Create ATTACH_CONTEXT to hold attachment index. (see #3728)
Move the idx and idxlen into ATTACH_CONTEXT. In subsequence patches,
this structure will hold more useful items, such as the virtual index.
The swap out is straightforward, except for:
* update_idx() in compose.c, which post-increments the idxlen in the
call and again in the function.
* mutt_gen_attach_list() which doesn't need to returns the new values.
Kevin McCarthy [Sun, 23 Jul 2017 02:48:50 +0000 (19:48 -0700)]
Add $imap_poll_timeout to allow mailbox polling to time out.
Enable the polling flag for the NOOP in imap_check_mailbox(), the
STATUS command in imap_buffy_check(), and the LOGOUT command.
This is not intended to handle all blocking-IO related issues.
However, the periodic NOOP and STATUS are the most frequent places for
mutt to freeze up, especially after a laptop is sleep/woken.
Since these are quick operations with little data, this is a good place
to check if the connection is still working before hanging on a read.
Kevin McCarthy [Fri, 21 Jul 2017 00:30:05 +0000 (17:30 -0700)]
When guessing an attachment type, don't allow text/plain if there is a null character. (see #2933)
Type text/plain should not contain any null characters. Slightly
improve the type guesser by forcing an attachment with any null
characters to be application/octet-stream.
Note the type guesser could use much more improvement, but this is an
easy and obvious fix.
Kevin McCarthy [Wed, 19 Jul 2017 21:04:39 +0000 (14:04 -0700)]
Change imap_cmd_start() to return OK when the cmd_queue is finished. (closes #3956)
Some response handlers can end up recursively calling
imap_cmd_start(), processing all the command completions. If the
outer call was an imap_exec(), this would result in the loop never
being terminated (or just blocking reading a server that has already
finished all the commands).
Change the callers that are simply using it to read a response,
without having called cmd_start(), to check for IMAP_CMD_OK instead.
Currently this is just the open connection function.
When using alloca(), the built-in regexp library limited the failure
stack to 20,000 entries. This value is too large, and causes alloca()
to segfault in the example provided in the ticket.
Decrease the limit to 8000.
Thanks to Thorsten Wißmann for the excellent bug report, which made
debugging this much easier.
Kevin McCarthy [Wed, 12 Jul 2017 19:38:22 +0000 (12:38 -0700)]
Fix crash when $postponed is on another server.
imap_mxcmp() translates NULL to "INBOX". When $postponed points to a
URL with an empty or "INBOX" path, this will end up matching against a
NULL idata->mailbox in imap_status(). This resulted in a crash
because idata->ctx is also NULL.
Thanks to Olaf Hering for the detailed bug report and suggested fix.
Kevin McCarthy [Wed, 14 Jun 2017 22:12:45 +0000 (15:12 -0700)]
Enable all header fields in the compose menu to be translated.
While it is suggested they need not be, for some locales it might be
preferable to be able to localize the fields.
For instance, fr_FR may want to change the punctuation to have a space
in front of the colon. ja_JP may be more comfortable with a native
character set description of the field when using it every day.
Kevin McCarthy [Tue, 13 Jun 2017 01:29:48 +0000 (18:29 -0700)]
Force hard redraw after $sendmail instead of calling mutt_endwin. (closes #3952) (see #3948)
Adding a mutt_endwin() seemed like a clean solution to allowing
ncurses pinentry for $sendmail, but it leaves other users watching a
blank screen. This change is extremely likely to generate a large
number of complaints and bug reports. So instead, force a hard
refresh afterwards.