Show
Ignore:
Timestamp:
2007-04-05 18:03:05 (22 months ago)
Author:
Brendan Cully <brendan@…>
Branch:
HEAD
Message:

IMAP header cache API improvements.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • imap/message.c

    r5073 r5074  
    7979  unsigned int *uidnext = NULL; 
    8080  int evalhc = 0; 
    81   char uid_buf[64]; 
    8281#endif /* USE_HCACHE */ 
    8382 
     
    169168 
    170169        idx = h.sid - 1; 
    171         sprintf(uid_buf, "/%u", h.data->uid); /* XXX --tg 21:41 04-07-11 */ 
    172         uid_validity = (unsigned int*)mutt_hcache_fetch (idata->hcache, uid_buf, &imap_hcache_keylen); 
    173  
    174         if (uid_validity != NULL && *uid_validity == idata->uid_validity) 
     170        ctx->hdrs[idx] = imap_hcache_get (idata, h.data->uid); 
     171        if (ctx->hdrs[idx]) 
    175172        { 
    176           ctx->hdrs[idx] = mutt_hcache_restore((unsigned char *) uid_validity, 0); 
    177173          ctx->hdrs[idx]->index = idx; 
    178174          /* messages which have not been expunged are ACTIVE (borrowed from mh  
     
    195191           * TODO: consider the possibility of a holey cache. */ 
    196192          imap_free_header_data((void**) &h.data); 
    197    
    198         FREE(&uid_validity); 
    199193      } 
    200194      while (rc != IMAP_CMD_OK && mfhrc == -1); 
     
    294288 
    295289#if USE_HCACHE 
    296       sprintf(uid_buf, "/%u", h.data->uid); 
    297       mutt_hcache_store(idata->hcache, uid_buf, ctx->hdrs[idx], idata->uid_validity, &imap_hcache_keylen); 
     290      imap_hcache_put (idata, ctx->hdrs[idx]); 
    298291#endif /* USE_HCACHE */ 
    299292