summaryrefslogtreecommitdiffstats
path: root/commands.c
AgeCommit message (Collapse)Author
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-03Add a mutt_error() when copy/save messages fails.Kevin McCarthy
Avoid using "part" translations for the tag/untagged copy/save combinations, even though that makes the code longer.
2020-08-29Remove relative path expansion for some cases.Kevin McCarthy
Some paths, such as the folder browser, or certain hook values, should be expanded for shortcuts, but not for relative paths. Configuration variables that hold commands that search by PATH should also not be expanded. Create a separate call, and a separate data type for config vars.
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-05-17Clean up Editor Menu interface inside Mutt.Kevin McCarthy
enter_filename() api: * Rename enter_fname() to _enter_fname() * Rename mutt_buffer_enter_mailbox() to mutt_enter_mailbox() * Rename mutt_buffer_enter_filenames() to mutt_enter_filenames() * Remove 'multiple' and 'fname buffer' parameters from mutt_enter_filenames(). Create a temp buffer, and enable multiple automatically. This removes the possibility of mistakenly looking at an unpopulated 'fname' parameter for the result. * Create mutt_enter_filename(). This isn't used currently, but it makes sense to have a "single filename" api already set up with correct parameters. get_field() api: * Rename _mutt_buffer_get_field() to a static _get_field() function. * Remove _mutt_get_field() and make mutt_get_field() an actual function. * Remove the multiple/files/numfiles parameters, since this should only be done through mutt_enter_filenames(). _mutt_enter_string() api: Add comments to mutt_enter_string() and _mutt_enter_string() headers. Noting that they should generally not be called directly. List the functions that should be used inside Mutt. Note the behavior of the multiple parameter.
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-09Convert "non-fatal" handler errors to return 1 instead of -1.Kevin McCarthy
When displaying a message, display a mutt_error() to warn of incomplete rendering. Fix mutt_copy_message() to check for ferror and feof errors on partial decode too. Clean up _mutt_append_message() to not pass a partial-decode along as a success. Modify the crypt handlers to return 1 if any kind of state message is displayed. There is some fuzzyness about what a "fatal" error is, but for now just consider a handler error that notifies by state_attach_puts() as "non-fatal".
2020-04-07Print progress meter when copying/saving tagged messages.Kevin McCarthy
When copying from local to IMAP, it would previously only display a percentage count for each individual message. Suppress that by passing MUTT_QUIET. Note, this is only for "regular" copies. IMAP server-side copies happen in a single command and can't display a progress meter.
2020-03-31Convert LastSaveFolder to buffer.Kevin McCarthy
2020-03-31Convert mutt_parse_rc_line() to use real buffer to hold the line.Kevin McCarthy
Previously, the parameter converted into a kind of read-only buffer, pointing to the char *line passed in. The problem is that mutt_extract_token() backtick processing allocates and assigns a new token->data. As a result, buffer->destroy was added, whose sole purpose is to keep track of the read-only token buffer being reallocated so that it can be properly freed inside mutt_parse_rc_line(). (The char *line is allocated and freed in source_rc()). Remove the token parameter, and convert line to a const char *. Copy that into a buffer-pool buffer, so the buffer can be modified "normally". Create a mutt_buffer_rc_buffer() function taking the line buffer parameter. To make the source_rc() just a tiny bit faster, have it directly manage and call mutt_parse_rc_buffer() itself. Other callers likely don't need the speed, so remove their cumbersome creation/free of that parameter. The next commit will deal with removing buffer->destroy and fixing up backtick handling.
2020-03-30Convert mutt_pipe_message() to use buffer pool.Kevin McCarthy
2019-10-15Update mime fields when piping a message with $pipe_decode set.Kevin McCarthy
Programs that process the message may get confused if the original mime fields are in the output. Add the CH_MIME flag to strip mime headers and CH_TXTPLAIN to add decoded text mime headers in their place, just as <decode-copy> does. However, make sure not to add the flags when printing, as printers highly likely won't care and users probably don't want to see those headers in their printout.
2019-09-21Fix mutt_save_message() "enter_fname()" to use buffer version.Kevin McCarthy
Commit be632f11 converted this function to use the buffer pool, but accidentally used the non-buffer prompt when there was already a buffer-converted version.
2019-09-13Convert mutt_save_message() to use buffer pool.Kevin McCarthy
Change imap_copy_messages() dest parameter to const char *. mutt_default_save() will be converted to use a buffer next, removing the dptr fixups.
2019-09-13Convert mutt_display_message() to buffer pool.Kevin McCarthy
Remove an unused mime-type string generation at the top of the function too. The code using the mime type was removed a long time ago in commit 246198ae.
2019-08-03Fix process_gossip_headers() to look at the right envelope.Kevin McCarthy
2019-08-03Add gossip header processing.Kevin McCarthy
2019-06-28Remove unnecessary "" checks for DT_STR and DT_PATH MuttVars.Kevin McCarthy
MuttVars of those types are set via safe_strdup(), which returns NULL if the original is "". Thus Var implies *Var. A good portion of the code relies on that axiom, but over the years some (Var && *Var) checks have crept in, including from me. This was partially because of the INITVAL("") that were in the code, which implied (incorrectly) the initial value could be "". Commit 2f91d43e removed those to make it more clear. This commit removes the *Var checks to make it even clearer, and help avoid them creeping back in again.
2019-04-17Increase prompt size to remove warning.Kevin McCarthy
2019-04-11Generate version string during make not configureAaron Schrab
Switch to generating the version string during make process rather than at configure time. This makes it easier to keep the detailed version string accurate when doing development which doesn't require that the configure script be rerun.
2019-01-04Clean up formatting.Kevin McCarthy
Add spaces after if, else, while, for, switch. Unify the brace placement style. The vast majority of the code uses Allman style so convert the relatively few K&R braces over.
2019-01-04Clean up code indentation.Kevin McCarthy
These are mostly automated changes corresponding to the emacs settings: (c-set-style "linux") (setq c-basic-offset 2) (c-set-offset 'case-label '+) Most of the code follows the convention: (add-to-list 'c-cleanup-list 'space-before-funcall) but this is not enforced by this indentation cleanup. Also, I personally dislike tabs, so I have: (setq-default indent-tabs-mode nil) in my own configuration. However I have no desire to change every line just for that effect. So this cleanup does nothing about the mix issue. Some of the secondary files (e.g. regex.c) have been skipped. I've also skipped crypt-gpgme.c, because I need to think about that file. Werner Koch and the GnuPG team contributed most it, and it follows the Gnu indentation settings. It should probably be made uniform with Mutt, but I don't want to discourage future GnuPG contribution to the file. I manually reverted a few unsightly cleanups, and added a few tweeks when I saw things that could be improved.
2018-12-31Remove trailing whitespace.Kevin McCarthy
The result of find . -name "*.[ch]" -exec emacs -batch {} \ --eval="(progn (delete-trailing-whitespace) (and (buffer-modified-p) (save-buffer)))" \;
2018-12-31Remove unused MUTT_FORMAT_MAKEPRINT flag.Kevin McCarthy
The code in mutt_FormatString() that was using it was commented out 19 years ago.
2018-12-29Add $crypt_protected_headers_save.Kevin McCarthy
Setting this option will save the protected header back into the clear-text message headers. This improves usability (searching/limiting/replying) when reopening a mailbox without header cache. However, it is a security trade-off, so defaults off and strongly warns about what it is doing in the documentation.
2018-12-17Add protected header received email support.Kevin McCarthy
Add $crypt_protected_headers_read config variable to enable reading and updating the index/header cache. Print protected Subject header in the pager as parts are rendered. Once opened, update the index, subject hash, and header cache.
2018-06-28Add check-stats function to calculate mailbox statistics.Anton Lindqvist
This allows the statistics to be updated without setting $mail_check_stats or before $mail_check_stats_interval has passed.
2018-03-22Change prompt string for $crypt_verify_sigKevin McCarthy
Thanks to Michael Tatge for pointing out that the prompt is used for both PGP and S/MIME.
2017-08-10Add edit-content-type helper and warning for decrypted attachments. (closes ↵Kevin McCarthy
#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.
2017-04-18Revert sort prompt labels. (see #3930)Kevin McCarthy
Using the (s)ort style may look a bit better, but it makes the prompt over 80 columns. The multichoice prompt supports multiple lines now, but it is better to have it fit on one line if possible. Revert back to the "capital letter" method, but leave the ticket open, to explore other ideas that Vincent and chdiza have for better ways to present a long choice like this.
2017-04-17Change the sort prompt to use (s)ort style prompts.Kevin McCarthy
This is consistent with the rest of mutt, and in my opinion, more readable.
2017-04-08Ensure mutt stays in endwin during calls to pipe_msg() (closes #3929)Kevin McCarthy
The previous commit solved the problem reported in #3929: progressbar output while downloading a message via IMAP was refreshing the mutt ncurses session after launching the pipe program. To ensure another place in the code doesn't inadvertantly generate output, wrap OPTKEEPQUIET around the calls to pipe_msg()/mutt_wait_filter() too.
2017-03-31Remove refresh parameter from mutt_enter_fname().Kevin McCarthy
Also remove it from mutt_save_message(), which used it to pass through to mutt_enter_fname(). The callers of this already had redraw logic, to which REDRAW_STATUS merely needed to be added.
2017-03-26Set refresh when popping the menu stack.Kevin McCarthy
This removes the need for the OPTNEEDREDRAW option and MAYBE_REDRAW macro previously used to communicate back the need to refresh after exiting a menu. Remove the redraw parameter from ci_bounce_message() and mix_make_chain() which served the same purpose.
2017-01-28Minor fixes to the x-label patch from David.Kevin McCarthy
Add L10N comment to sort menu. Mark a couple strings for localization. Use ascii_strncasecmp() for the X-Label header comparison. Simplify label_message() using mutt library routines. Bind label editing to "Y" instead of "y". "y" is already used in the default sample muttrc to display mailboxes.
2017-01-28Adds capability to edit x-labels inside mutt, and to sort by label.David Champion
2016-11-17Backout inlining of MUTT_VERSION in 42fee7585fae.Kevin McCarthy
If MUTT_VERSION contains a %, this will result in problems.
2016-11-13Compress: remove buffy stats "improvisation".Kevin McCarthy
Mutt doesn't support polling compressed mailboxes. This code creates a false impression and dirties mutt_save_message() in the process. I don't like it, so am taking it out.
2016-11-13Compress patch from the neomutt repository.Kevin McCarthy
With the following changes: - po/de.po changes trimmed to just the compress additions. - Move the sample muttrc to contrib, and add it to the Makefile.am so it is distributed. Remove the sample vimrc. - Remove extra fluff from manual. Thanks to Roland Rosenfeld for the original patch, and to the NeoMutt team for their work cleaning up the patch.
2016-11-13search muttrc file according to XDG Base Specification (closes #3207)Damien Riegel
First of all, the MUTT_VERSION symbol is now concatenated (when possible) at compile time. Then, the logic to find the config file has been changed a bit to remove unnecessary calls to access(), so now each possible locations for the config file is only tested once, and it stops as soon as a valid one has been found. So instead of: access("/home/dkc/.muttrc-1.7.1", F_OK) = -1 ENOENT (No such file or directory) access("/home/dkc/.muttrc", F_OK) = 0 access("/home/dkc/.muttrc", F_OK) = 0 access("/home/dkc/.muttrc", F_OK) = 0 [... Tests for Muttrc ... ] access("/home/dkc/.muttrc", F_OK) = 0 We now have: access("/home/dkc/.muttrc-1.7+13 (f658e517960e)", F_OK) = -1 ENOENT (No such file or directory) access("/home/dkc/.muttrc", F_OK) = 0 It also cleans up the case where -F is passed on the command line but points to a non-existent file by moving the error path closer to the actual fail condition. Finally, it adds partial support for the XDG Base Directory Specification. mutt will now try to locate its config at: $XDG_CONFIG_HOME/mutt/muttrc-MUTT_VERSION $XDG_CONFIG_HOME/mutt/muttrc. If XDG_CONFIG_HOME is not set, it will use '~/.config' as a default.
2016-07-17Add the trash folder patch.Kevin McCarthy
This is based on the trash folder patch by Cedric Duval. Modifications to the original patch are: * Use a flag called M_PURGE instead of M_APPENDED. The same flag is then used in the following "purge" patch instead of adding a different flag. * Removed the counter in context. The existing context->deleted is all that's needed. * Removed the "auto unset M_PURGE" when M_DELETED is unset inside _mutt_set_flag(), although this is convenient, it easily leads to header->purge not being reset in a few situations. * Reset purge flag along with the deleted flag if $delete is answered no. * Set M_PURGE on an edited message. (edit_one_message()) * Preserve purge flag in mutt_reopen_mailbox() * Turn off OPTCONFIRMAPPEND when saving to the trash, rather than hardcoding it off in mutt_save_confirm(). That way, normal save to the folder will respect the option.
2016-06-18pass context in mx_close_messageDamien Riegel
The mx_close_message is one of the few mx_* functions that don't have a context as parameter. To make them more consistent, pass the context.
2016-06-07Fix columns used for $status_format and $pager_format in the pager.Kevin McCarthy
The code was hardcoding use of MuttIndexWindow->cols in mutt_make_string_info() and MuttStatusWindow->cols in menu_status_line(). Add a parameter to mutt_make_info_string(). Change menu_status_line() to use menu->statuswin->cols, falling back to MuttStatusWindow if no menu is passed in. Set menu->statuswin appropriately inside pager.c. Thanks to Richard Russon for tracking down this problem, and for the initial patch.
2016-05-09Change M_* symbols to MUTT_*Derek Martin
Changeset 23334e967dd7 created a workaround for a namespace conflict with Solaris and derivatives. After some discussion, the team decided it would be best to move away from using the "M_" prefix for macros. This patch was automatically generated by running: perl -wpi -e 's/\bM_(\w+)\b/MUTT_$1/g' `find . -name '*.[ch]' -print` with the exception that sys_socket.h was exempted. (That file will be backed out subsequent to this commit.) Thanks to Andras Salamon for supplying the perl script used to make this change.
2016-04-27Fix remaining direct usages of COLS/LINES to use mutt window functions.Kevin McCarthy
Most of these were just message update/clearing.
2016-01-01Convert copyright years to all use 4 digit years.Kevin McCarthy
Vincent Lefèvre pointed out the common shortcut, e.g 1996-9, is actually not allowed for copyright years. Convert all the copyright years (for mutt files) to use 4 digits.
2015-11-24Rename idna functions and bits for smtputf8 changes.Kevin McCarthy
This is patch 1 of 4 implementing support for SMTPUTF8 (RFC 6531). Change mutt_idna.c to be always compiled. Remove the stub functions in mutt_idna.h. Instead, put #ifdefs around the idna function calls. The conversion functions will be fixed up in the next patch. Rename the conversion functions to mutt_addrlist_to_intl() and mutt_env_to_intl(). Rename the ADDRESS idna status bits to "intl" status bits.
2015-10-04Create a separate macro/push/exec event buffer. (closes #3779)Kevin McCarthy
Currently, the SSL and TLS certficate prompts turn on OPTUNBUFFEREDINPUT, (to prevent macros and such from running right through the dialog). Unfortunately, the menu dialog processing in menu_dialog_dokey() is using mutt_ungetch() to forward non-dialog keys on to standard menu processing. With OPTUNBUFFEREDINPUT set, those keys never make it to the menu and are buffered until after the menu dialog. This patch creates a new event buffer, separate from the standard "unget" buffer, for use by macros, exec, and push events. These events can be temporarily ignored by setting OPTIGNOREMACROEVENTS (renamed from OPTUNBUFFEREDINPUT), while continuing to allow unget events to be processed. Since the "push" and "unget" functions now go to different buffers, function names were slightly renamed, to make it less easy to unintentionally use the wrong function at the wrong time.
2015-08-30Minor translation fixes.Benno Schulenberg
This makes two equivalent translation messages the exact same so they only need to be translated once. It also adds a missing translation marker (for the same string). This same string is used in recvcmd.c so does not generate a new translation string.
2015-01-03Change bounce to use mutt_parse_adrlist() for address parsing.Kevin McCarthy
When prompting for recipients, forwarding, replying, and mailing all use mutt_parse_adrlist() to parse the addresses. This allows for addresses to be separated by spaces. Bounce message currently uses rfc822_parse_adrlist(), which doesn't allow the spaces. This one-line patch simply changes bounce to behave the same as mail, reply, and forwarding for the address prompt. Thanks to Roger Cornelius for the patch!