summaryrefslogtreecommitdiffstats
path: root/copy.c
AgeCommit message (Collapse)Author
2020-12-22Correct length to use LOFF_T.Kevin McCarthy
This is a part two, made in master, to the stable branch commit 11b18027. These are mostly length adjustments to use LOFF_T, matching the BODY->length type. An argument could be made for size_t instead, and a few places in Mutt do assign between those types. I've used LOFF_T because off_t is a signed integer. Some changes in this commit affect loops that decrement a length pointer while > 0. Switching to a size_t could create a wraparound infinite loop bug. This also changes the Content-Length header parser to use atoll() intead of atol(). I noticed from the man page that atol() doesn't seem to return -1 on error. But I've kept the check anyway.
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-06-03Modify mutt_make_date() to append to a buffer.Kevin McCarthy
Remove the "Date: " prefix and the trailing newline, and convert callers to add those. This will be needed for protected headers Date support, where we will have to generate and store the date inside mutt_protect().
2020-05-07Clarify CH_WEED debug messageRemco Rijnders
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".
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 dead code.Kevin McCarthy
Most of these have been "#if 0" out for 10-20 years. Any utility in keeping them around is miniscule at this point. There are a few other "#if 0" in the code, but I've kept them for now. Some are utility functions that are not used, but I think still may have some documentation value.
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-29Change x-label editing flag to be in the envelope.Kevin McCarthy
Handle like In-Reply-To and References editing. Change the flag setting to be inside mutt_copy_header(). The resetting of the changed flag occurs explicitly in the imap and maildir/mh sync_mailbox code. It occurs for mbox in the mx_update_tables() call in mx_sync_mailbox().
2018-12-29Create envelope->changed to mark all field changes.Kevin McCarthy
In subsequent commits, we're going to add the x-label and subject headers changed flags into the envelope. To avoid the list of checks exploding everywhere, just use a single field to check and reset those values. Several places in the code are checking for a null header->env. I wasn't aware this was possible, so I've added todo notes to track down when this occurs.
2018-12-28Make a copy of x_label before encoding it for updates.Kevin McCarthy
This isn't actually a bug. Context->label_hash strdups the keys, so we are safe from dangling references. However, the subj_hash uses direct references, so to keep things consistent and safe, make a copy and encode that.
2018-12-27Restore the xlabel_changed reset.Kevin McCarthy
The cherry pick accidentally obliterated the reset. That flag is now located in hdr->env->changed in the branch and is reset properly elsewhere. Keep it in place in the stable branch.
2018-12-27Rfc2047 encode and fold X-Label when writing updates.Kevin McCarthy
Also, add a missing "skip" in mutt_copy_hdr() for the non-simple case. These fixes were backported from the kevin/mutt_protected_header branch.
2017-01-29Fix the x-label update code check location.Kevin McCarthy
The x-label comparison was outside the "beginning of header" block. This meant that it could theoretically match a continuation line. Additionally, the continuation lines of x-labels would not be stripped, because the comparison was after the ignore variable was reset. Move the comparison inside the block and before the ignore reset.
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-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-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-27Modify the pager to use windows.Kevin McCarthy
The pager view is somewhat complex, due to the "mini-index" and the positioning of the index_status vs pager_status changes depending on $status_on_top as well as $pager_index_lines and $help. To make things simpler, it creates four "pager windows": index_status_window, index_window, pager_status_window, pager_window. mutt_term_width() is renamed to mutt_window_wrap_cols() and a mutt_window_t parameter passed in. Also, the pager drawing loop calling display_line() has a mutt_window_move() added to move to the beginning of the next line each time. This is in case the pager_window isn't flush with the left side of the terminal.
2016-01-01Update copyright notices.Kevin McCarthy
This patch only updates existing copyright notices in the source files, using commit dates since the last copyright update in commits e3af935cdb1a and f8fd60d8d3f2. Add a notice to the COPYRIGHT file to refer to our mercurial repository for the full commit history. Add myself to the COPYRIGHT file and smime_keys.pl file.
2014-03-11Fix buffer overrun caused by not updating a string length after address ↵Michael Elkins
expansion.
2012-07-08Fix some spelling errors (closes #3493)Antonio Radici
2010-03-02Fix thinko in [cc02f079b1b9]Brendan Cully
2010-03-01Guard dequote with NULL check on personal fieldBrendan Cully
2010-03-01Another attempt to dequote RFC2047-encoded address comments (see #2014)Brendan Cully
2009-06-13Rewrite header foldingRocco Rutte
We now distinct between sending and display case. For display, we always use tabs for folding for readability; for sending we now correctly fold using whitespace found in the header. Closes #2995. Closes #3080.
2009-06-11Don't reformat Return-Path (angle brackets are not optional). Closes #1702.Rocco Rutte
2009-03-15Use safe_fclose() instead of fclose(), add fclose() to check_sec.shRocco Rutte
2008-07-10Fix three bugs handling flags in mutt_copy_headerAron Griffis
1. mutt_copy_header incorrectly tests CH_UPDATE to determine whether to write the In-Reply-To and References headers. CH_UPDATE refers only to Status: and X-Status: 2. mutt_copy_header ignores CH_NOSTATUS which is supposed to indicate that the mailbox type doesn't use those headers. 3. mutt_copy_header tests h->env->irt_changed and h->env->refs_changed when it should be testing CH_UPDATE_IRT and CH_UPDATE_REFS, respectively. Early in the function this happens: if (h->env) flags |= (h->env->irt_changed ? CH_UPDATE_IRT : 0) | (h->env->refs_changed ? CH_UPDATE_REFS : 0); This means that for most callers, the result is the same, but mutt_copy_header should be testing the flags because the caller might have set them explicitly without setting irt_changed/refs_changed. Signed-off-by: Aron Griffis <agriffis@n01se.net>
2008-07-24Remove variables no longer used since [7729b1ad530c]Brendan Cully
2008-07-10Unify mutt_write_referencesAron Griffis
copy.c and sendlib.c have independent and different implementations of writing references to a file. Choose the one in sendlib since it's conservative with mallocs and supports trimming the list. Signed-off-by: Aron Griffis <agriffis@n01se.net>
2008-07-10Clean up error handling in mutt_copy_headerAron Griffis
mutt_copy_header unnecessarily tests the result of each fputc/fputs (well, most of them anyway, it's not consistent). This obfuscates the code and hides bugs. Remove these extraneous checks since ferror/feof are checked at the bottom of the function, and get rid of all the early returns. Signed-off-by: Aron Griffis <agriffis@n01se.net>
2008-07-01Bail out of copy if decryption is requested but the desired engine is missing.Brendan Cully
This closes #2684, but handling of mixed crypto in a single message needs more investigation.
2008-07-01When deleting attachments, always print newline separating header from body.rtc
Closes #3085.
2008-06-25Make mutt_copy_message distinguish between fatal and non-fatal errors.Brendan Cully
Non-fatal errors should prevent moving messages, since they indicate data loss. But mutt should still attempt to display them, since being able to see some attachments is better than nothing. Also stop printing out non-PGP material in application/pgp attachments. Closes #2545, #2912.
2007-11-08Turn down some debug logging levelsBrendan Cully
2007-04-07Fix some compiler warningsFabian Groffen
2007-03-12Improve strcat usage (#2802).Sami Farin
2007-03-03Add $wrap, which supersedes $wrapmargin.Brendan Cully
When set to a positive number, wrap at that column. When set to a negative number, keep that many characters empty on the right.
2007-01-09Smarter header wrapping -- different behavior for displayThomas Roessler
purposes and sent messages.
2006-08-16Do intelligent things with long header lines.Thomas Roessler
2005-10-21Full large file support. Keep a close watch on your mailboxes everyone!Brendan Cully
2005-09-29Ensure that Content-Length printf format specifier matches off_t size, toBrendan Cully
avoid mail-losing Content-Length: 0 (bug introduced by large file patch a couple of days ago). Closes: #2096.
2005-09-24Cosmetic fixes to MIME headers. Closes: #2086.Alain Bench
2005-09-17Gah, forgot the zip code when updating the FSF address...Brendan Cully
2005-09-17Update FSF address (via sed, I hope nothing got mangled). Closes: #2071.Brendan Cully
2005-08-11Add error results to mutt_body_handlers, and check them when doingBrendan Cully
decode-save. Closes: #1919.
2005-08-09Remove an unneeded cast, which introduces type-punning. Modified to use FREEMads Martin Joergensen
instead of safe_free, since that seems to be the convention. I personally don't see the point.