Age | Commit message (Collapse) | Author |
|
|
|
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.
|
|
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.)
|
|
While fixing up mutt_decrease_mtime(), I thought about creating a
helper function to loop for EINTR. However, there is only one other
place in the code that cares enough about utime succeeding to check
the return value.
maildir_commit_message() is used fairly often, so it's possible I
might be writing useless error handling. However there are
reports (easily found by internet search) of some systems returning
EINTR, so might as well fix this place too.
|
|
While testing the hcache buffer pool changes, I noticed a misaligned
pointer warning when using LMDB.
The other header cache backends must ensure alignment of the pointer
they return, but LMDB apparently does not.
Instead of directly assigning and dereferencing the pointer fetched,
use memcpy to the appropriate type, just as the header cache restore
operation does.
|
|
Rename to BUFFER->pathbuf to make it clear the field is a BUFFER, and
to make sure to catch and review all usages.
There are still uses of pathbuf that are truncating and need to be
fixed, for example in browser.c and buffy.c.
Fix up sidebar usage in one place, that was pointing inside the
BUFFY->path with a char *. At the same time, change their "short
folder" computation to also use a BUFFER.
|
|
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.
|
|
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.
|
|
The result of
find . -name "*.[ch]" -exec emacs -batch {} \
--eval="(progn (delete-trailing-whitespace) (and (buffer-modified-p) (save-buffer)))" \;
|
|
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().
|
|
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.
|
|
This will be used when reading protected headers, to store the
encrypted subject in the header cache so it can be searched with.
|
|
* mh_read_sequences
* mh_sequences_changed
* mh_already_notified
* mh_mkstemp
* mh_update_sequences
* mh_sequences_add_one
* maildir_update_time
* maildir_delayed_parsing
* maildir_open_mailbox_append
* mh_open_mailbox_append
* maildir_mh_open_message
* maildir_open_new_message
* _mh_commit_message
* mh_rewrite_message
* mh_sync_mailbox
* mh_check_mailbox
* maildir_check_empty
* mx_is_maildir
* mx_is_mh()
|
|
Callers are maildir_check_mailbox(), _maildir_open_find_message(), and
maildir_open_find_message().
|
|
|
|
|
|
Note: the uses of buf and tmp don't overlap, so we only use a single
BUFFER.
|
|
The monitor code is too fast, and can result in all the changes for a
single directory stat update being missed.
Work around this issue by not recording stat time updates when the
check_mailbox() is triggered by the monitor. This will cause the next
subsequent check to take another look.
|
|
The inotify interface has an unfortunate side effect of making Mutt
react too quickly to new mail. Sometimes, the mail is only
half-delivered when the mailbox is checked. Because Mutt is using the
stat mtime - seconds resolution - this means it won't realize there
are more messages delivered during the same second.
Nanosecond resolution fields were standardized in POSIX.1-2008, so
check for and use those if they are available.
|
|
|
|
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.
|
|
#3865)
mx_check_mailbox() would update the header flags, but was not
returning MUTT_FLAGS back to the index loop. That meant a screen
redraw was needed to be notified of externally modified flags.
Change maildir_update_flags() to return 1 if the flags were actually
changed. Change maildir_check_mailbox() and mh_check_mailbox() to
return MUTT_FLAGS when that happens.
Thanks to jcdenton and mike-burns for the original patch.
|
|
Instead of having an "allow_dups" parameter for hash_insert(), add a
flag, MUTT_HASH_ALLOW_DUPS, to hash_create().
Currently ReverseAlias, subj_hash, and thread_hash allow duplicate
keys. Change those hashes to pass the flag at creation, and remove
the last parameter from all callers of hash_insert().
|
|
Kyoto Cabinet documents that data from it should be freed via
kcfree().
LMDB claims ownership of the data returned, so convert its free
operation to be a noop and remove the malloc from its fetch function.
|
|
|
|
This saves them from bulk operations on threads and tagged messages. To
remove a flagged message, first unflag it.
|
|
Change compress.sync_mailbox() to lock the compressed mailbox around
both the tempfile sync and compress operations. This will prevent
changes made inbetween the two syncs from being overwritten.
Thanks to Damien Riegel for his original patch refactoring
mx_ops.sync, which this patch is partially based upon.
|
|
|
|
The previous commit re-used MUTT_NEWFOLDER, but the meaning of that
flag is slightly different: it causes mbox to use fopen with mode "w",
and is used only for the case of a brand-new mktemp-generated mbox.
Setting it for other non-existing mbox files leads to a race condition
between the stat and the fopen/lock, and so could end up truncating an
existing mailbox created in-between!
Create a different flag, MUTT_APPENDNEW to notify the open_append()
functions that the mailbox doesn't exist. Change maildir and mh to
check for that flag to create their directory structures.
|
|
Set the flag MUTT_NEWFOLDER to signal Maildir and MH to create the directory structure.
Distribute the "open append" code to mbox, mh, and imap/imap.c.
Set pop's mx_ops handler to NULL to signal it is not supported.
|
|
|
|
This commit adds a maildir_commit_message with a prototype consistent
with other kind of mailboxes, to simplify upcoming refactoring.
|
|
Basically, rename maildir_commit_message to _maildir_commit_message.
This commit is preparatory to make the maildir_commit_message symbol
available for further use.
Symbols starting with underscore should be avoided but this one is long
enough to prevent collision.
|
|
mh_commit_message is only called in one place with the header parameter
set to NULL. To make the commit function consistent with other
mailboxes, which only takes ctx and msg as parameters, remove this
unused parameter.
|
|
|
|
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.
|
|
Add the callback to open an existing message to struct mx_ops. For mbox,
mmdf, maildir, and mh, the code was implemented directly into
mx_open_message, so it is moved in their respective source files. For
imap and pop, there were already <mailbox>_fetch_message functions, but
their argument order has been changed to pass the context as a first
argument.
|
|
Add a check_stats parameter to the mbox, maildir, and mh buffy
functions. Use that parameter to determine whether to also count
total, new, and flagged messages.
This makes the functions a bit more complicated, but improves
efficiency (for maildir and mh).
Also includes the following cleanup/fixes:
* Move the orig-value counter reset to the beginnining of the loop,
(before tmp->new is set to 0).
* Change trashed maildir messages to not be counted in msg_count
* Remove an incorrect setting of mailbox->new based on msg_count in
maildir. (I missed this one for 1f840760e6e0)
* Change mbox to use the context->mtime for stats_last_checked,
removing a race condition.
* Fix mh to actually count the messages in order to generate msg_count.
mh_sequences only covers the range of messages with some sort of
flag.
|
|
Add new boolean option $mail_check_stats (default off) and
$mail_check_stats_interval. The first turns extended buffy on. The
second sets the amount of time in between extended buffy checks
(defaulting to 60 seconds).
Remove the option $sidebar_refresh_time.
Change mutt_buffy_check() to only notify the sidebar to redraw if a
mailbox buffy value changes.
Remove the #ifdefs around the extended buffy functions. The next
patch will merge these functions with the basic functions and pass a
parameter instead.
Imap is a special case, because it sends out the status in one batch.
Change this to perform the comparisons inside cmd_parse_status() and
flag the sidebar there. It was previously directly assigning the
status counters (unsigned int) to the buffy->new (short). Change this
to assign 1/0.
|
|
The extended buffy for mh had incorrect placement of the loop
brackets. The counters weren't being incremented in the loop.
Fix extended buffy for maildir to count a maildir message as new if it
doesn't have the info delimeter.
Remove shortcircuits added to the basic buffy stating there is new
mail when (msg_unread > 0). This is not necessarily true, depending
on $mail_check_recent.
Note: the extended buffy still needs more fixes, which will be done
when it is refactored into its own option.
|
|
This is the patch from neomutt; branch 'devel/win-sidebar'; commit
c796fa85f9cacefb69b8f7d8545fc9ba71674180 with the following changes:
- move the sample muttrc and vimrc to contrib.
- remove the README.sidebar.
- empty out the PATCHES file.
|
|
In mx_check_mailbox switch case, we simply call
<mailbox>_check_mailbox, so this operation can be move into the mx_ops
structure pretty easily.
This commit adds a mandatory "check" operation to struct mx_ops and
change all mailboxes to use it. Check functions are made static as they
are only used in their respective source files now.
|
|
The code was already using a function pointer to do this operation. This
commit moves this function pointer to the mx_ops structure and the
open_new_message functions to their respective source files if it needs
to.
|
|
Introduce a dedicated structure for mailbox operations: struct mx_ops.
Move the open and close operations into that structure.
Assign this structure to the context in mx_open_mailbox. This is
currently based on the "magic" for the mailbox type, but may be
refactored in the future.
Add a stub mbox_close_mailbox function. This function does nothing,
the main purpose is to introduce a mx_ops structure for mbox, so its
usage is similar to mh/imap/pop. We reuse the name that was made
available by the previous commmit. Note that the actual closing of
the descriptor is done in mx.c.
To be more consistent with other mailboxes, introduce functions
mh_open_mailbox and maildir_open_mailbox, and create a dedicated
structure for mmdf.
|
|
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.
|
|
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.
|
|
The fnames hash uses the maildir->header->path as the key. As matches
are found, the headers are freed. This inadvertantly also freed the key
to the hashtable entry; the next hash_find() going to the same bucket
might end up comparing keys with a freed string.
This patch stores the path in the struct maildir canon_fname field (just
as maildir_check_mailbox() does) and uses that as the hash key instead.
This field isn't used outside of maildir_check_mailbox(), and is
automatically freed for us in the maildir_move_to_context() call at the
bottom of both functions.
Note there are other ways to fix this problem:
- Add a new mode to the hash table, causing it to strdup the keys and
free them itself.
- Delete the entries in the fnames hash, rather leaving them there.
The first seems the cleanest, but would end up touching much more code.
The second is also clean, but might have a negative performance impact.
Additionally, peeking back in history to changeset 1d45a50b6f9b, it
looks like the canon_fname used to be used by mh too, so perhaps
removing the strdup may have been a mistake during refactoring at some
point.
|
|
|
|
closes #3629
|
|
gettimeofday() value should be substituted, so that a 0 uidvalidity can be used by the imap driver.
closes #3501
|