summaryrefslogtreecommitdiffstats
path: root/mutt.h
AgeCommit message (Collapse)Author
2020-12-22Merge branch 'stable'Kevin McCarthy
2020-12-22Fix offset to use LOFF_T in a couple places.Kevin McCarthy
The BODY->hdr_offset was incorrectly of type long, which could result in corrupted >2gb mbox files in some circumstances. The uses in mh_rewrite_message() are not as serious, but they should still be of type LOFF_T. I found both of these fixes in a patch file, bug-676388-largefile.patch, in the openSUSE mutt src rpm. It looks like Harald Koenig was the original author of a larger patch in that openSUSE ticket, which was reduced over time as fixes were made to Mutt. Note that patch file also incorrectly adjusted old_hdr_lines in mh.c. I've removed that part, as HEADER->lines is type int. Unfortunately, the BODY->hdr_offset type change will result in a header cache change (i.e. invalidation). I'm not enthused about doing that during a stable release, but the change is important enough to merit it.
2020-12-12Add "headers" parameter to mx_open_message().Kevin McCarthy
This will allow some operations to retrieve only headers, such as ~h pattern matching or the new list menu. Modify the IMAP and POP3 implementation to retrieve only headers when the parameter is set. Headers-only will use the message cache if one exists, but will not populate the message cache (since the body of the message is not downloaded.)
2020-12-09Parse headers on demand for the list menu.Kevin McCarthy
This will be a bit slower over IMAP from the index, but it removes storing all the new headers in the header cache. Since those are not used for anything except the list menu, and the list menu is infrequently used, it's a bit wasteful to store them in the header cache.
2020-12-06abstract some List-* header processingdgc
List-Post parsing is inline in the List-Post header handler. This moves it to some separate functions so that we can use it for other purposes.
2020-11-22Add <view-pager> function to attachment menu.Kevin McCarthy
This uses a copiousoutput mailcap entry, or falls back to raw text. The existing functions do not provide a way to use copiousoutput mailcap entries exclusively. The default <view-attach> will use one for internally supported types if auto_view is configured, but there is no way to do so for other mime types (such as application/pdf).
2020-07-20Add $cursor_overlay, default unset, to control overlaying.Kevin McCarthy
Although I think the new behavior is desirable, experience has shown that changes need to be controlled by an option and usually defaulting the same as before.
2020-07-19Add first version of MuttLisp.Kevin McCarthy
This is somewhat simple enhancement to muttrc processing, not a full-blown embedded scripting language. There are no variables, functions, types, or abilities that compete with macros. MuttLisp can be invoked using the "run" command. If $muttlisp_inline_eval is set, it can also be invoked with a bare parenthesis expression as a command argument. $muttlisp_inline_eval defaults unset, to avoid breaking existing configurations, which might have bare parenthesis arguments for regexps.
2020-07-01Create $copy_decode_weed, $pipe_decode_weed, $print_decode_weed.Kevin McCarthy
$weed covers a bit too much functionality. It makes sense for it to control the display of messages in the pager, along with forwarding and replying. But (in my opinion) piping and copy/save-decode are something users might like to set differently without affecting the rest of Mutt's behavior. $copy_decode_weed affects the <decode-copy> and <decode-save> functions. I've defaulted this *unset*, despite that it breaks backward compatibility, because I believe the header weeding is surprising to users and loses important information when copy/saving a message. $pipe_decode_weed affects <pipe-message> when $pipe_decode is set. I've default this *set* for backward compatibility. $print_decode_weed affects <print-message> when $print_decode is set. I've default this *set* for backward compatibility.
2020-06-26Escape config vars when expanding hook "command" argument.Kevin McCarthy
The "command" parameter of folder, send, send2, account, reply, and message hooks is run through mutt_extract_token() twice. Once when parsing the hook command initially, and once via mutt_parse_rc_line() when the actual hook fires. In theory, Mutt users should be aware of this, and should place all their command strings with configuration variables in single-quotes, to delay expansion until execution. But in reality Mutt has been escaping configuration variables as part of mutt_extract_token() for many years. The previous commit turned the escaping off, because it damages "backup" assignments to a $my_ variable, and I believe is confusing behavior. But for hooks, users now expect the escaping behavior (for double-quoted or unquoted command strings). Note that mutt_parse_hook() also passed the MUTT_TOKEN_SPACE flag, but neglected to do so for message-hook. Since all other "command" argument hooks were included, and were added to the list over the years, I believe this was an accidental oversight.
2020-06-23Add $tunnel_is_secure config, defaulting set.Kevin McCarthy
The config variable is to resolve an ambiguity in Mutt about whether using $tunnel is secure. On the one hand, the examples in the manual show using ssh or a direct pipe to a program. Many users do this to connect to an IMAP server with PREAUTH configured, relying on the tunnel to be secured by ssh or by the fact that it's a local pipe. On the other hand, the Mutt connection code still respects $ssl_starttls and $ssl_force_tls, as if the $tunnel connection were not already secured. After some discussion on mutt-dev, it seemed the best idea to assume the connection is secure by default, in order to not break IMAP PREAUTH connections, but to provide a configuration variable in case there are situations where it is not. Thanks to Aaron Schrab for the original idea of setting conn->ssf for $tunnel in his patch to ticket 250.
2020-05-31Try to automatically reconnect to an open IMAP mailbox on error.Kevin McCarthy
For the Context, change cmd_handle_fatal() to flag idata->status on the error, but not close the mailbox and disconnect. Then have imap_check_mailbox() reconnect when IMAP_REOPEN_ALLOW is set (so the index is prepared to rebuild with all new headers). Try to merge flag, envelope, and attach_del changes back in. Replace the existing Context pointer with the new values, and swap out the idata passed in on success, so we don't continue to work with the wrong idata. The imap_check_mailbox() changes are purposely coded loosely to try and catch all sorts of errors - not just polling and imap_idle errors. Create a new check_mailbox() return code to indicate a reconnect. Display a more appropriate message in the index, but otherwise treat it the same as a REOPEN.
2020-05-11Separate mailbox vs buffy-incoming for the "enter_fname" functions.Kevin McCarthy
Create mutt_buffer_enter_mailbox(), which turns on the MUTT_MAILBOX flag (renamed from MUTT_EFILE). This uses the mailbox history file category, and turns on MUTT_SEL_FOLDER in the select_file browser. Add a do_incoming paramter and a new separate flag MUTT_INCOMING, so that buffy-completion can be enabled optionally for mailboxes. It only makes sense for the change-folder operation, so disable it in other contexts (such as saving/copying a message, prompting for an Fcc mailbox, or an autocrypt scan mailbox). Change saving/copying a message to use the mailbox function, so that it shares the history file with other mailbox operations. It would previously use the "file" history category. Create mutt_buffer_enter_filenames() to replace the enter_fname() prompt for files. Since nothing directly uses the _mutt_buffer_enter_fname() function anymore, rename and make it static.
2020-04-24Adjust comment on header.num_hidden field.Kevin McCarthy
Changeset 83be183b modified _mutt_traverse_thread() to update num_hidden in the entire thread, so that ~v will work properly when switching to a non-threaded view.
2020-04-03Add "root" part logic for multipart/alternative countingKevin McCarthy
Distinguish between the inline parts of a root multipart/alternative, which should also be considered as "root" parts, and those of a non-root multipart/alternative, which should be counted as "inline" parts.
2020-02-29Confirm exiting if background edit processes exist.Kevin McCarthy
This prompt is in addition to the $quit prompt. A bit annoying, but I believe necessary to combat muscle memory and avoid losing compose sessions.
2020-02-29Enable backgrounding a single <mail> function.Kevin McCarthy
Backgrounding exits to the index menu. Re-invoking <mail> will resume the backgrounded session, if one exists, otherwise start a new session. This is just to get basic support going. Multiple background edits, a landing page, a background compose menu list will be added next.
2020-02-29Add send_ctx to compose menu and get_postponed().Kevin McCarthy
This will be used to store and use sctx for sign_as values.
2020-02-29Rename ci_send_message() to mutt_send_message().Kevin McCarthy
This fits the current naming conventions. There are a few other "ci_" prefixed functions, but there's no need to tackle all those changes right now.
2020-02-10Merge branch 'stable'Kevin McCarthy
2020-02-10Speed up thread sort when many long threads exist.Kevin McCarthy
Merge request !75 reported a massive slowdown opening a mailbox with many long threads: on the order of an hour. This is because mutt_set_virtual() was iterating through the whole thread for each message. After taking a closer look at current Mutt behavior, it seems the num_hidden count is only needed in the root thread. Quoting my comment in the merge request: The index-format expando %M only applies to root level headers, so there are no issues there. The only concern is the pattern ~v. Limiting always resets collapsed and num_hidden, so there also can't be any issues there. Tagging and other pattern operators only work on visible messages. So tagging while threads are sorted will only tag the root messages of collapsed threads. However, if you sort by thread, collapse a thread, and then sort by date, the collapsed and num_hidden fields are not reset for each header. In theory this would allow us to tag ~v with date ordering. However, in master the num_hidden is only set (by mutt_set_virtual()) for visible messages with a virtual number. So even in master, switching to date-order and tagging ~v will only tag the root messages of each collapsed thread. This commit removes the num_hidden setting in mutt_set_virtual(), instead directly assigning that value in the roothdr during a collapse operation. A subsequent commit will fix the behavior of ~v, when switching sorting from threaded to something else, by putting num_hidden in every header in the thread. This is technically a change in behavior, so I will make that commit in the master branch. Thanks to Score_Under for the pull request and for testing my alternate solutions.
2020-01-20Allow ~b ~B ~h patterns in send2-hook.Kevin McCarthy
This allows searching the message body or headers for making configuration settings. Right now, this only searches the primary message content. I don't think it would be useful to search attachments, but if I'm wrong we can add iteration later.
2020-01-14Add $crypt_opportunistic_encrypt_strong_keys config var.Kevin McCarthy
When set, this modifies $crypt_opportunistic_encrypt to only search for "strong" keys (fully valid keys according to the web of trust). S/MIME behavior depends on the backend.
2019-12-22Merge branch 'stable'Kevin McCarthy
2019-12-21Turn off auto-clear outside of autocrypt initialization.Kevin McCarthy
The auto-clearing code was added in commit 01bc088c, for autocrypt initial prompting. It removed having to keep track of every place a browser or other menu might be displayed and having to remember to clear it out. However, clearing when mutt exits is a change of behavior for those who have turned off alternative screens.
2019-12-12Merge branch 'stable'Kevin McCarthy
2019-12-07Create $sidebar_relative_shortpath_indent, default unset.Kevin McCarthy
When unset this option provides the pre-1.13.0 sidebar indentation and shortpath behavior. Setting the option will enable the new (relative to previous entries) indentation and shortening behavior. Note the mailbox shortcuts are controlled by $sidebar_use_mb_shortcuts, which defaults set.
2019-12-03Merge branch 'stable'Kevin McCarthy
2019-12-03Add $sidebar_use_mb_shortcuts to turn off shortcuts.Kevin McCarthy
If unset, Mutt will revert to pre-1.13 display behavior, matching and removing a literal $folder prefix, without using mailbox shortcuts.
2019-11-30Fixes and cleanup for imap deflate patch.Kevin McCarthy
Rework mutt_zstrm_read(): - Pass along the error if conn_read() returns < 0. - Separate out conn_eof and stream_eof flags so they can be dealt with differently. - Don't use Z_FINISH on conn_eof, because the passed in buf might not be big enough to hold the decompressed output. Instead continue looping until either Z_STREAM_END or Z_BUF_ERROR. - Remove recursive calls to retry, instead goto 'retry' target. - Remove op statements in malloc/free. - Bail on other rcs. Mutt doesn't check errno on a read error, so lump all other error codes into a -1 return value. Use default so we handle other weird stuff such as Z_NEED_DICT or Z_STREAM_ERROR too. Convert $imap_deflate to boolean, default unset. Configure.ac fixes: - Fix indentation - Remove unneeded AM_CONDITIONAL. - Don't restore LDFLAGS and CPPFLAGS. Save and restore LIBS instead. imap_conn_find() fixes: - Don't queue CAPABILITY command. (This mistake has been in there since UTF-8 and QRESYNC were added.). - Check imap_exec() returns 0 before wrapping. Even with FAIL_OK set, the imap_exec() can still return -1 on some errors.
2019-11-30imap: add support for COMPRESS=DEFLATE, RFC 4978Fabian Groffen
- added mutt_zstrm which allows wrapping an existing connection with deflate/inflate (zlib compression) - call mutt_zstrm_wrap_conn when setting up an IMAP connection if the server supports COMPRESSION=DEFLATE and imap_deflate evaluates to yes - add config quad-option imap_deflate enable/disable use of (de)compression for IMAP connections, defaulting to yes - add configure check for zlib, --with-zlib to detect if mutt_zstrm can (or should) be built Tested against a Dovecot IMAP server, observed easily 7x compression rates on received data, and 5x on sent data for a normal session. Rates can be observed when the connection is closed on debug level 4 and higher. Bug: https://gitlab.com/muttmua/mutt/issues/92
2019-11-10Add $count_alternatives to count attachments inside alternatives.Kevin McCarthy
Some mail clients (*cough* Apple Mail) have started to put email attachments in one of the multipart/alternative branches. The config changes the searching to recurse inside alternatives when performing attachment counting.
2019-11-07Change $write_bcc to default off.Kevin McCarthy
Change Fcc'ing to always write a Bcc header regardless of the setting. Update the variable documentation to note the difference when Fcc'ing.
2019-11-01Add ability to generate multipart/alternative using a filter script.Kevin McCarthy
Create config variables $send_multipart_alternative (a quadoption) and $send_multipart_alternative_filter. The filter script expects output to be the mime type, a blank line, then the content. Add ability to preview alternative from compose menu. <view-alt-text> forces viewing as text. <view-alt-mailcap> forces using the mailcap. Bind them to 'v' and 'V', respectively. Improve <resend-message> so a multipart/alternative is stripped out, which would just confuse the compose menu. Currently this preserves the first alternative. Allow alternative generation in batch mode, as long as the quadoption is set to 'yes'.
2019-09-09Add $browser_sticky_cursor default set.Kevin McCarthy
This option attempts to keep the browser cursor on the same mailbox. It does this by keeping track of the current selected mailbox and comparing that when regenerating the menu. Modify imap_mailbox_create() and imap_mailbox_rename() to return the new mailbox name so it can be automatically selected.
2019-08-17Add $ssl_use_tlsv1_3 config variable, default set.Kevin McCarthy
2019-08-17Add size display configuration variables.Kevin McCarthy
Although it would be nice to "open this up" more, performance and security/stability issues would arise. Based on the thread in mutt-dev, I hope these vars will satisfy most customization needs: $size_show_bytes $size_show_mb $size_show_fractions $size_units_on_left
2019-08-07Add $autocrypt_reply.Kevin McCarthy
This allows turning off the force-autocrypt mode when replying to an autocrypt email.
2019-08-03Handle autocrypt message decryption.Kevin McCarthy
Try autocrypt first for crypt_pgp_decrypt_mime() and pgp_gpgme_encrypted_handler(). Propagate the autocrypt bit if successful. This is used when replying to an autocrypt message, to force a reply using autocrypt.
2019-08-03Autocrypt outgoing emails.Kevin McCarthy
Change crypt_get_keys() to query autocrypt. When oppenc_mode is set, we still query the original keyring regardless, because the compose menu can still run oppenc even if autocrypt is on. Since mutt_autocrypt_ui_recommendation() checks each key as part of making the recommendation, add a keylist parameter and use that function. Add gpgme changes to use the autocrypt context for encryption. Postpone work: * Change mutt_protect() to have a postpone parameter. Remove the manual toggling of the SIGN bit outside the call when postponing. * Since autocrypt doesn't set the SIGN bit, this allows us to turn off signing inside mutt_protect() for both normal and autocrypt mode. * Set the autocrypt postpone key in AutocryptDefaultKey. Write autocrypt and gossip headers in outgoing emails.
2019-08-03Add autocrypt line to the compose menu.Kevin McCarthy
Remove the hardcoded HDR_ATTACH offset calcuation, and add an explicit enum for the "-- Attachments" line to make loops and padding array sizes easier. Add security and recommendataion fields on the line. Add mutt_autocrypt_ui_recommendation, following the autocrypt spec guidelines.
2019-08-03Add another HEADER security bit for autocrypt.Kevin McCarthy
2019-08-03Add gossip header processing.Kevin McCarthy
2019-08-03Process autocrypt headers.Kevin McCarthy
Create/update peer database accounts and gpg keys based on the headers.
2019-08-03Add autocrypt header parsing to mutt_parse_rfc822_line().Kevin McCarthy
Convert parse_parameters() for autocrypt header usage: * change to use a BUFFER to accomodate large autocrypt keydata attribute values. * Autocrypt header parameters are not rfc2231 compliant. Rather than rolling another very similar function, just change the existing one to allow space separation.
2019-08-03Add autocrypt config vars.Kevin McCarthy
2019-07-21Added * option to unattachments commandAndrew Marks
The * option clears all previous attachments settings. A list_free_generic method is added to muttlib to enable generic freeing of specific LIST structures. free_attachments_data is used with list_free_generic to clear four LISTs which manage allowed and excluded inline and attached "attachments" refs #1
2019-06-26Convert Commands to use the union pointer_long_t too.Kevin McCarthy
As with MuttVars, Commands was using an unsigned long to hold pointers as well as enums. Convert to use the same union type of MuttVars. Adjust command functions data parameter type to the union. Since these are used outside init.c, relocate the union definition to mutt.h. Although the number of functions affected was long, most of them did not need much adjustment. Many of them made no use of the parameter. Those that did were easily cast into an added "data" variable at the top.
2019-06-13Add $fcc_before_send, defaulting unset.Kevin McCarthy
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.
2019-04-27Add $forward_attachments quadoption for inline-forward mode.Kevin McCarthy
When set or answered yes, non text-decodable parts will be attached to the new message. The default value is "ask-yes", because I believe this is something people will want to use, and should be made aware of the new possible behavior. The option presents a nice middle ground between previous inline-forwarding behavior (where all the non-text parts were dropped), and $mime_forward where the entire email was included as an attachment. This was previously difficult to achieve, but after the recv-attachment refactoring: (a19e5266^..faabd621) it became possible to use the ATTACH_CONTEXT and the recvattach.c helper mutt_generate_recvattach_list() to properly deal with nesting and multiple file-handles.