Richard Russon [Sun, 16 Jun 2019 00:32:52 +0000 (01:32 +0100)]
merge: upstream fixes
* Improve imap_append_message() error message handling
* Mention sources for ~p and ~P patterns
* Allow imap_cmd_finish() to both expunge and fetch new mail
* Improve $reverse_realname documentation
* Add $fcc_before_send, defaulting unset
Kevin McCarthy [Tue, 11 Jun 2019 20:15:22 +0000 (13:15 -0700)]
Add $fcc_before_send, defaulting unset
When set, the message will be Fcc'ed the same as sent. $fcc_clear and
$fcc_attach will be ignored. This is because of the difficulty of
unwinding changes, notably Protected Headers, without potentially
breaking signatures.
Kevin McCarthy [Mon, 10 Jun 2019 21:51:50 +0000 (14:51 -0700)]
Allow imap_cmd_finish() to both expunge and fetch new mail
Since commit dd327606 changed check_status setting to use bit
operators, and imap_check_mailbox() can call imap_cmd_finish() twice,
there is no reason to delay the processing of new mail until a second
call.
imap_read_headers() deals with msn_end < msg_begin, so remove
the (count > idata->max_msn) check. This will allow the reopen flag
to be reset if somehow it's not the case.
If the rc is IMAP_CMD_BAD, then either idata->buf is stale or an error
message has already been printed (in cmd_handle_untagged()).
Use imap_next_word() to skip over the next two words instead of
directly skipping over SEQLEN, in case the buffer is in a different
format. We don't want to jump over the end of string.
Skip the mutt_error() if there is nothing to print.
Richard Russon [Sun, 9 Jun 2019 15:23:55 +0000 (16:23 +0100)]
add slist type
Add a string list type. This manages strings delimited by space, comma
or colon. The NeoMutt code doesn't need to parse the string any more,
it's simply presented with a STAILQ (list) of strings.
Richard Russon [Sun, 9 Jun 2019 10:26:23 +0000 (11:26 +0100)]
drop dt_command
The DT_COMMAND type is unnecessary; it behaves exactly the same as DT_STRING.
Only the NeoMutt code needs to make the distinction, so use a subclass
of DT_STRING instead of a separate type.
Richard Russon [Sun, 9 Jun 2019 10:21:53 +0000 (11:21 +0100)]
drop dt_path
The DT_PATH type is unnecessary; it behaves exactly the same as DT_STRING.
Only the NeoMutt code needs to make the distinction, so use a subclass
of DT_STRING instead of a separate type.
Richard Russon [Sun, 9 Jun 2019 01:07:00 +0000 (02:07 +0100)]
move redraw flags
Move the redraw flags from a general flags field to the type field.
These GUI flags don't belong in the config definition, but once the
notification system is complete, the flags will be obsolete.
Richard Russon [Fri, 7 Jun 2019 11:20:03 +0000 (12:20 +0100)]
merge: trivial fixes
* fix folder use in mx_path_canon()
* doxy: fix typos
* rename local variable for clarity
* test: tidy code
* refactor #ifdef'd conditional
* check includes with iwyu
Richard Russon [Fri, 7 Jun 2019 00:21:45 +0000 (01:21 +0100)]
merge: upstream fixes
* Turn on $ssl_force_tls by default
* Change mutt_addr_is_user() to no for a NULL address
* Minor documentation correction
* Fix dropped new mail notifications when an EXPUNGE_PENDING is set
* Improve robustness of imap_append_message()
* Enable the idata->check_status using bit operations
Kevin McCarthy [Thu, 6 Jun 2019 23:03:42 +0000 (16:03 -0700)]
Enable the idata->check_status using bit operations
Commit e3f66d7e fixed dropped new mail notications, removing the
unsetting of idata->reopen IMAP_NEWMAIL_PENDING in imap_cmd_finish()
when an EXPUNGE was processed.
However, imap_cmd_finish() can be called twice by
imap_check_mailbox(). First as part of the imap_exec(), and manually
again just below.
Now that the IMAP_NEWMAIL_PENDING still exists, a second call could
overwrite idata->check_status if both reopen flags were set.
This unfortunately affects update_index(), which behaves differently
for MUTT_REOPENED.
I need to change the return value of mx_check_mailbox() in master to
preserve all the bits, so the index can both notify of new mail and
update_index() properly.
For stable, the best fix is to use bit operators to enable the
check_status flags in imap_cmd_finish() (and cmd_parse_fetch for
flags), and keep the imap_check_mailbox() priority of setting its
return value (it prioritizes IMAP_EXCHANGE_PENDING).
Kevin McCarthy [Thu, 6 Jun 2019 20:38:03 +0000 (13:38 -0700)]
Improve robustness of imap_append_message()
First, check the imap_cmd_step() return value instead of looking at
idata->buf for "OK". If the connection bombed and imap_cmd_step()
returned IMAP_CMD_BAD, the value of idata->buf is stale.
If the server returned "+ OK" for the command continuation request
response, the call to imap_code(idata->buf) would even end up
returning true, despite that the append failed! (See #110, although
at the time of commit I can only hypothesize this is what is
happening.)
Second, check the status of the writes. flush_buffer() was not
passing the rc from mutt_socket_write_n(), which was further making
the above disaster scenerio possible.
Kevin McCarthy [Wed, 5 Jun 2019 21:04:55 +0000 (14:04 -0700)]
Fix dropped new mail notifications when an EXPUNGE_PENDING is set
Prior to the fetch_headers rework and introduction of
idata->max_msn (starting around e0376c75), cmd_handle_untagged() was
looking directly at ctx->msgcount, which isn't fixed up until
imap_expunge_mailbox(). At that time, more care had to be taken
inbetween handling the EXPUNGE message and the actual expunge of the
mailbox because of the discrepency between server state and mailbox
context state.
idata->max_msn is now decremented during the processing of EXPUNGE and
VANISHED notices from the server, so reflect "current" state. So,
when we receive an EXISTS notice, we no longer need the checks for
expunge state and can always set the NEWMAIL_PENDING flag.
Additionally, fix imap_cmd_finish() to retain the IMAP_NEWMAIL_PENDING
flag after handling an expunge. The expunge does not grab new
messages so dropping the flag would cause mutt to forget the new mail
status until another EXISTS command.
Since this is a stable branch fix, I'm leaving the either/or
processing of expunge versus new mail in imap_cmd_finish(). However,
I don't see why this has to be done in two calls. I may rework that
in master to process an expunge and then the new mail one after the
other.
Kevin McCarthy [Sun, 26 May 2019 21:34:42 +0000 (14:34 -0700)]
Turn on $ssl_force_tls by default
Ticket #135 suggests that these days, it's better to force encryption
over all connections. RFC8314 is recommending MUA's move in that
direction (actually even directing towards implicit TLS over
STARTTLS).
I'm enabling this at the beginning of the 1.13 development cycle to
give others time to chime in with any objections. Personally, I've
had this option set myself for years. The only place it could become
an issue is for a localhost IMAP server with no cert. In that case,
it's easy enough to have an account hook unset if needed, and I think
a better idea that the user be forced to turn it off.
David Harrigan [Thu, 6 Jun 2019 12:09:25 +0000 (13:09 +0100)]
Save attachments without prompting.
If the 'attach_save_without_prompting' variable is set (to true), then on
saving a list of tagged attachments the user will not be prompted each time
for the name of file.
Conflicting filenames during save are also handled.