Changeset 5114:c72582d8023f
- Timestamp:
- 2007-04-10 16:40:53 (21 months ago)
- Author:
- Brendan Cully <brendan@…>
- Branch:
- HEAD
- Message:
-
Add hcache path name hook
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r5097
|
r5114
|
|
| 465 | 465 | /* Append md5sumed folder to path if path is a directory. */ |
| 466 | 466 | static const char * |
| 467 | | mutt_hcache_per_folder(const char *path, const char *folder) |
| | 467 | mutt_hcache_per_folder(const char *path, const char *folder, |
| | 468 | hcache_namer_t namer) |
| 468 | 469 | { |
| 469 | 470 | static char mutt_hcache_per_folder_path[_POSIX_PATH_MAX]; |
| … |
… |
|
| 750 | 751 | #if HAVE_QDBM |
| 751 | 752 | header_cache_t * |
| 752 | | mutt_hcache_open(const char *path, const char *folder) |
| | 753 | mutt_hcache_open(const char *path, const char *folder, hcache_namer_t namer) |
| 753 | 754 | { |
| 754 | 755 | struct header_cache *h = safe_calloc(1, sizeof (HEADER_CACHE)); |
| … |
… |
|
| 766 | 767 | } |
| 767 | 768 | |
| 768 | | path = mutt_hcache_per_folder(path, h->folder); |
| | 769 | path = mutt_hcache_per_folder(path, h->folder, namer); |
| 769 | 770 | |
| 770 | 771 | if (option(OPTHCACHECOMPRESS)) |
| … |
… |
|
| 815 | 816 | |
| 816 | 817 | header_cache_t * |
| 817 | | mutt_hcache_open(const char *path, const char *folder) |
| | 818 | mutt_hcache_open(const char *path, const char *folder, hcache_namer_t namer) |
| 818 | 819 | { |
| 819 | 820 | struct header_cache *h = safe_calloc(1, sizeof (HEADER_CACHE)); |
| … |
… |
|
| 831 | 832 | } |
| 832 | 833 | |
| 833 | | path = mutt_hcache_per_folder(path, h->folder); |
| | 834 | path = mutt_hcache_per_folder(path, h->folder, namer); |
| 834 | 835 | |
| 835 | 836 | h->db = gdbm_open((char *) path, pagesize, GDBM_WRCREAT, 00600, NULL); |
| … |
… |
|
| 899 | 900 | |
| 900 | 901 | header_cache_t * |
| 901 | | mutt_hcache_open(const char *path, const char *folder) |
| | 902 | mutt_hcache_open(const char *path, const char *folder, hcache_namer_t namer) |
| 902 | 903 | { |
| 903 | 904 | struct stat sb; |
| … |
… |
|
| 917 | 918 | |
| 918 | 919 | tmp = get_foldername (folder); |
| 919 | | path = mutt_hcache_per_folder(path, tmp); |
| | 920 | path = mutt_hcache_per_folder(path, tmp, namer); |
| 920 | 921 | snprintf(h->lockfile, _POSIX_PATH_MAX, "%s-lock-hack", path); |
| 921 | 922 | FREE(&tmp); |
-
|
r4646
|
r5114
|
|
| 25 | 25 | typedef struct header_cache header_cache_t; |
| 26 | 26 | |
| 27 | | header_cache_t *mutt_hcache_open(const char *path, const char *folder); |
| | 27 | typedef int (*hcache_namer_t)(const char* path, char* dest, size_t dlen); |
| | 28 | |
| | 29 | header_cache_t *mutt_hcache_open(const char *path, const char *folder, |
| | 30 | hcache_namer_t namer); |
| 28 | 31 | void mutt_hcache_close(header_cache_t *h); |
| 29 | 32 | HEADER *mutt_hcache_restore(const unsigned char *d, HEADER **oh); |
-
|
r5112
|
r5114
|
|
| 1598 | 1598 | url.path = (char*)mbox; |
| 1599 | 1599 | url_ciss_tostring (&url, urlstr, sizeof (urlstr), 0); |
| 1600 | | hc = mutt_hcache_open (HeaderCache, urlstr); |
| | 1600 | hc = mutt_hcache_open (HeaderCache, urlstr, NULL); |
| 1601 | 1601 | if (hc) |
| 1602 | 1602 | { |
-
|
r5112
|
r5114
|
|
| 86 | 86 | FREE (&mx.mbox); |
| 87 | 87 | |
| 88 | | idata->hcache = mutt_hcache_open (HeaderCache, cachepath); |
| | 88 | idata->hcache = mutt_hcache_open (HeaderCache, cachepath, NULL); |
| 89 | 89 | |
| 90 | 90 | return idata->hcache != NULL ? 0 : -1; |
-
|
r5071
|
r5114
|
|
| 796 | 796 | #ifdef USE_HCACHE |
| 797 | 797 | if (ctx && ctx->magic == M_MH) |
| 798 | | hc = mutt_hcache_open (HeaderCache, ctx->path); |
| | 798 | hc = mutt_hcache_open (HeaderCache, ctx->path, NULL); |
| 799 | 799 | #endif |
| 800 | 800 | |
| … |
… |
|
| 999 | 999 | int ret; |
| 1000 | 1000 | |
| 1001 | | hc = mutt_hcache_open (HeaderCache, ctx->path); |
| | 1001 | hc = mutt_hcache_open (HeaderCache, ctx->path, NULL); |
| 1002 | 1002 | #endif |
| 1003 | 1003 | |
| … |
… |
|
| 1587 | 1587 | #if USE_HCACHE |
| 1588 | 1588 | if (ctx->magic == M_MAILDIR || ctx->magic == M_MH) |
| 1589 | | hc = mutt_hcache_open(HeaderCache, ctx->path); |
| | 1589 | hc = mutt_hcache_open(HeaderCache, ctx->path, NULL); |
| 1590 | 1590 | #endif /* USE_HCACHE */ |
| 1591 | 1591 | |
-
|
r5034
|
r5114
|
|
| 204 | 204 | void *data; |
| 205 | 205 | |
| 206 | | hc = mutt_hcache_open (HeaderCache, ctx->path); |
| | 206 | hc = mutt_hcache_open (HeaderCache, ctx->path, NULL); |
| 207 | 207 | #endif |
| 208 | 208 | |
| … |
… |
|
| 614 | 614 | |
| 615 | 615 | #if USE_HCACHE |
| 616 | | hc = mutt_hcache_open (HeaderCache, ctx->path); |
| | 616 | hc = mutt_hcache_open (HeaderCache, ctx->path, NULL); |
| 617 | 617 | #endif |
| 618 | 618 | |