summaryrefslogtreecommitdiffstats
path: root/hcache.c
AgeCommit message (Collapse)Author
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-09Consistently use uint32_t (closes #294)Remco Rijnders
2020-03-31Remove buffer->destroy.Kevin McCarthy
Fix backtick processing to append to tok instead of allocating and assigning to tok->data directly.
2019-09-28Convert hcache delete and open calls to use buffer pool.Kevin McCarthy
2019-09-28Convert hcache fetch and store raw to use buffer pool.Kevin McCarthy
2019-09-27Convert hcache_open to use buffer pool.Kevin McCarthy
Change the namer function and mutt_hcache_per_folder to operate on a buffer parameter.
2019-09-27Convert hcache db4 lockfile to buffer.Kevin McCarthy
2019-09-09Convert remaining mutt_encode_path() call to use BUFFER.Kevin McCarthy
Then rename the other uses of mutt_buffer_encode_path() to mutt_encode_path().
2019-07-18Fix a reference to HeaderCachePageSize.Kevin McCarthy
Commit 4c728278 converted the config far to type DT_LNUM, but embarrassingly I missed a usage.
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-06-27Convert $header_cache_pagesize to type DT_LNUM.Kevin McCarthy
Prior to commit 4bc76c2f there was no LNUM type, and so the workaround was to store it as a string, converting in the hcache_open_gdbm() call. This will not affect the user interface or config file, because DT_NUM and DT_LNUM read in a string from the config file and convert to a number. Quotes are used for escaping style, not passed through to the variable setter. So essentially this simply moves the conversion to parse_set(), and provides feedback for a non-numeric type immediately.
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-17Parse and store mime headers in the BODY.Kevin McCarthy
Don't store the field in the header cache though.
2018-12-08Add $auto_subscribe variable.Kevin McCarthy
When set, it automatically subscribes to mailing lists found in List-Post headers. This commit is based on Michael Elkins's patch from the thread <https://marc.info/?l=mutt-users&m=127076105423565&w=2>. I've added an opt-in variable $auto_subscribe and a hash table cache to speed up reading headers when the variable is set.
2018-06-01Correct spelling mistakes.Edward Betts
2017-02-08Fix build for bdb.Kevin McCarthy
Changeset fca7e504ab6a removed #else/#endif around two blocks of code that won't compile with bdb enabled. Restore those directives. Thanks to Richard Russon for pointing out the problem and saving me from having egg all over my face with the 1.8 release!
2017-02-07Create function to free header cache data.Kevin McCarthy
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.
2017-02-07Add Kyoto Cabinet support to the header cache.Kevin McCarthy
Retain the defaults as they are, although we might switch to Kyoto Cabinet for the next major release.
2017-02-04Fixes to the LMDB header cache. (closes #3691)Kevin McCarthy
Use mdb_txn_abort() to free up readonly/reset transactions, and avoid leaking memory. Fix hcache_delete() key generation - looks like this was an incorrect copy/paste from the bdb code. Use dprint, not fprintf, for debugging messages. Remove strange blending of enum and bitfield logic for the txn_mode state. Remove some duplicate code from store/fetch raw.
2017-02-04Add LMDB backend support for header cache. (see #3691)Kevin McCarthy
Based on the original from JP Mens: https://gist.github.com/jpmens/15969d9d678a3d450e4e The following performance patch was manually applied on top of the original patch: https://github.com/neomutt/neomutt/commit/7e5380cd4c40d119ff83b2cf5f51f2cdb8a95ab3 A variant of this patch was added to handle larger mailboxes: https://github.com/neomutt/neomutt/commit/6d337642e701b1dde4b5d0812e01c85f41ba65ca Thanks to all the developers and contributors to this patch, and to Fabian Groffen for bundling and posting this to mutt-dev.
2017-01-23Abstract the SPAM_LIST as a generic REPLACE_LISTDavid Champion
REPLACE_LIST can be used more generally as a list of pattern match-replace settings. SPAM_LIST was a special case of this, so spam handling has been been changed to use REPLACE_LIST instead, and SPAM_LIST was removed. A generic function for performing a REPLACE_LIST replacement has been added in mutt_apply_replace(). Commited by Kevin McCarthy with some buffer overflow fixes in mutt_apply_replace().
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-03-17Fix three build warnings when DEBUG isn't defined.Richard Russon
2016-03-16Fix tcbdb error reporting to use ecode, not errno.Kevin McCarthy
After committing aff8d62ebddb and taking a closer look at the tcbdb documentation, I realized those functions don't set errno. Change the error handling messages to instead get the ecode and message using tcbdbecode() and tcbdberrmsg().
2016-03-16Fix crash in hcache_open_tc() when open fails and debug is on. (closes #3813)Kevin McCarthy
When the hcache open fails, it was trying to dprint. The dprint had a %s where it was passing errno, leading to a crash in strlen. Unify the dprint messages for tcdbopen and tcdbclose to report the path, strerror, and errno. Thanks to Will Yardley for capturing the stack trace!
2015-07-23Fix compiler type warnings. (closes #3765)Kevin McCarthy
The output of mutt_local_tz() was being passed to abs(). Technically the return type is time_t, but it represents a small value: the timezone offset in seconds. Add a safe explicit cast to int. Change the txt parameter of mutt_make_help() to type const char *. Typically all calls run the txt parameter through _(), which accepts const char * and returns a char *. However, if NLS is not enabled, _() is a noop, simply returning the parameter itself. In mutt_compile_help(), items[i].name is const char *, so it will generate a warning when passed as the txt parameter of mutt_make_help(). On some systems, e.g. OS X, snprintf is defined as a macro. One call in hcache.c was embedding directives inside the snprintf call. This is apparently undefined behavior, so duplicate the call instead.
2015-01-17Fix the hcache type punning warning.Kevin McCarthy
This patch fixes the type punning warning by switching from (safe but perhaps not elegant) casting to using a union. Thanks to Vincent Lefevre for his input and suggestion to use the union as a better solution to the problem!
2014-10-11hcache tcdb debug loggingBrendan Cully
2013-01-17use a separate flag for mutt_hcache_store() to signal that the ↵Michael Elkins
gettimeofday() value should be substituted, so that a 0 uidvalidity can be used by the imap driver. closes #3501
2013-01-01Drop unneeded variable HEADER_CACHE that causes clang warnings.Matthias Andree
The variable was unused and clang warned that it was not emitted to the .o file.
2011-07-13Invalidate header caches when spam rules change. closes #3473David Champion
User 'exg' on #mutt reported a problem when using header cache with IMAP and spam rules. Spam tags are retrieved from cache and not updated when spam rules change. 1. Enable header caching in muttrc 2. Set spam rules in muttrc 3. Use IMAP (or POP or Maildir). Your spam rules store spam tags into your message headers, and these get cached. 4. Quit mutt 5. Change your spam rules in muttrc 6. Relaunch mutt 7. Because of header caching, the rfc822 headers are not reparsed, and spam rules are not reapplied. User has outdated spam tags. Spam rules are applied during rfc822 header parsing because it's the only time we get a full and unadulterated view of all headers. Once header parse is done we have only processed headers and 'user headers' (X-headers). We might do spam rule matching against the struct HEADER copy of headers, except that: a. the header might not be in HEADER if it's non-standard and not an X-header; b. spam rules are regular expressions matching any arbitrary header line, and we would need to map these regexps to the header used to create the HEADER fields. This would change the syntax and behavior of spam rules dramatically. One solution, perhaps stopgap, is to invalidate the header cache when spam rules change. That's what this patch does. It alters the hcache versioning algorithm so that in addition to using the compiled-in checksum of mutt's structures definitions, we also mix in the user's runtime spam rules. Any time spam rules change the hcachever hash value changes, causing the hcache to be rewritten.
2009-12-10Do not store header color in hcache.Dan Fandrich
If the color directive is removed from muttrc, the cached value from the last directive would otherwise still be in effect.
2009-07-29Harmonize hcache uidvalidity size to unsigned int (per IMAP RFC).Brendan Cully
Closes #3296.
2009-07-22Properly restore addresses from hcache using rfc822_new_address(). Closes #3302.Kees Cook
2009-07-07Make hcache+bcache paths always UTF-8. Closes #3284.Rocco Rutte
2009-06-01More atoi() fixesRocco Rutte
2009-04-01Use PATH_MAX for buffers passed to realpath(3) as we're supposed toMiroslav Lichvar
2008-12-16Remove unused #include directivesErik Hovland
2008-09-25Support tokyocabinet (successor to qdbm). Closes #3112Emanuele Giaquinta
2008-07-10Prevent some pointers of 'struct body' being saved to hcacheRocco Rutte
This addresses the hcache safety issue but maybe doesn't fix it completely, see #2942. This also prevents mutt from crashing when using a hcache that was synced when syncing the mailbox (updating changed and fully-parsed messages).
2008-05-17When necessary, convert strings to utf-8 in the header cache.Rocco Rutte
If iconv is unavailable, include the charset in effect as part of the cache file name. Closes #3023.
2007-11-29Fix hcache build issue when building with gdbm if qdbm is installed, tooRocco Rutte
2007-09-17Include hcache backend version info in mutt -v outputRocco Rutte
2007-08-27Replace RFC md5 implementation with GPL version from coreutilsBrendan Cully
2007-04-10Try to unlink old header cache if open failsBrendan Cully
2007-04-10Refactor mutt_hcache_open to share more codeBrendan Cully
2007-04-10Save some stats when header cache already existsBrendan Cully