Changeset 5114:c72582d8023f

Show
Ignore:
Timestamp:
2007-04-10 16:40:53 (21 months ago)
Author:
Brendan Cully <brendan@…>
Branch:
HEAD
Message:

Add hcache path name hook

Files:
6 modified

Legend:

Unmodified
Added
Removed
  • hcache.c

    r5097 r5114  
    465465/* Append md5sumed folder to path if path is a directory. */ 
    466466static const char * 
    467 mutt_hcache_per_folder(const char *path, const char *folder) 
     467mutt_hcache_per_folder(const char *path, const char *folder, 
     468                       hcache_namer_t namer) 
    468469{ 
    469470  static char mutt_hcache_per_folder_path[_POSIX_PATH_MAX]; 
     
    750751#if HAVE_QDBM 
    751752header_cache_t * 
    752 mutt_hcache_open(const char *path, const char *folder) 
     753mutt_hcache_open(const char *path, const char *folder, hcache_namer_t namer) 
    753754{ 
    754755  struct header_cache *h = safe_calloc(1, sizeof (HEADER_CACHE)); 
     
    766767  } 
    767768 
    768   path = mutt_hcache_per_folder(path, h->folder); 
     769  path = mutt_hcache_per_folder(path, h->folder, namer); 
    769770 
    770771  if (option(OPTHCACHECOMPRESS)) 
     
    815816 
    816817header_cache_t * 
    817 mutt_hcache_open(const char *path, const char *folder) 
     818mutt_hcache_open(const char *path, const char *folder, hcache_namer_t namer) 
    818819{ 
    819820  struct header_cache *h = safe_calloc(1, sizeof (HEADER_CACHE)); 
     
    831832  } 
    832833 
    833   path = mutt_hcache_per_folder(path, h->folder); 
     834  path = mutt_hcache_per_folder(path, h->folder, namer); 
    834835 
    835836  h->db = gdbm_open((char *) path, pagesize, GDBM_WRCREAT, 00600, NULL); 
     
    899900 
    900901header_cache_t * 
    901 mutt_hcache_open(const char *path, const char *folder) 
     902mutt_hcache_open(const char *path, const char *folder, hcache_namer_t namer) 
    902903{ 
    903904  struct stat sb; 
     
    917918 
    918919  tmp = get_foldername (folder); 
    919   path = mutt_hcache_per_folder(path, tmp); 
     920  path = mutt_hcache_per_folder(path, tmp, namer); 
    920921  snprintf(h->lockfile, _POSIX_PATH_MAX, "%s-lock-hack", path); 
    921922  FREE(&tmp); 
  • hcache.h

    r4646 r5114  
    2525typedef struct header_cache header_cache_t; 
    2626 
    27 header_cache_t *mutt_hcache_open(const char *path, const char *folder); 
     27typedef int (*hcache_namer_t)(const char* path, char* dest, size_t dlen); 
     28 
     29header_cache_t *mutt_hcache_open(const char *path, const char *folder, 
     30  hcache_namer_t namer); 
    2831void mutt_hcache_close(header_cache_t *h); 
    2932HEADER *mutt_hcache_restore(const unsigned char *d, HEADER **oh); 
  • imap/imap.c

    r5112 r5114  
    15981598  url.path = (char*)mbox; 
    15991599  url_ciss_tostring (&url, urlstr, sizeof (urlstr), 0); 
    1600   hc = mutt_hcache_open (HeaderCache, urlstr); 
     1600  hc = mutt_hcache_open (HeaderCache, urlstr, NULL); 
    16011601  if (hc) 
    16021602  { 
  • imap/util.c

    r5112 r5114  
    8686  FREE (&mx.mbox); 
    8787 
    88   idata->hcache = mutt_hcache_open (HeaderCache, cachepath); 
     88  idata->hcache = mutt_hcache_open (HeaderCache, cachepath, NULL); 
    8989 
    9090  return idata->hcache != NULL ? 0 : -1; 
  • mh.c

    r5071 r5114  
    796796#ifdef USE_HCACHE 
    797797  if (ctx && ctx->magic == M_MH) 
    798     hc = mutt_hcache_open (HeaderCache, ctx->path); 
     798    hc = mutt_hcache_open (HeaderCache, ctx->path, NULL); 
    799799#endif 
    800800 
     
    999999  int ret; 
    10001000 
    1001   hc = mutt_hcache_open (HeaderCache, ctx->path); 
     1001  hc = mutt_hcache_open (HeaderCache, ctx->path, NULL); 
    10021002#endif 
    10031003 
     
    15871587#if USE_HCACHE 
    15881588  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); 
    15901590#endif /* USE_HCACHE */ 
    15911591 
  • pop.c

    r5034 r5114  
    204204  void *data; 
    205205 
    206   hc = mutt_hcache_open (HeaderCache, ctx->path); 
     206  hc = mutt_hcache_open (HeaderCache, ctx->path, NULL); 
    207207#endif 
    208208 
     
    614614 
    615615#if USE_HCACHE 
    616     hc = mutt_hcache_open (HeaderCache, ctx->path); 
     616    hc = mutt_hcache_open (HeaderCache, ctx->path, NULL); 
    617617#endif 
    618618