Changeset 5043:aef7a5bf213c for imap

Show
Ignore:
Timestamp:
2007-04-02 10:36:20 (20 months ago)
Author:
Brendan Cully <brendan@…>
Branch:
HEAD
Message:

Push mbox cache header cache check into imap_mboxcache_get

Location:
imap
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • imap/command.c

    r5033 r5043  
    822822  IMAP_STATUS *status, sb; 
    823823  int olduv, oldun; 
    824 #if USE_HCACHE 
    825   header_cache_t *hc = NULL; 
    826   unsigned int *uidvalidity = NULL; 
    827   unsigned int *uidnext = NULL; 
    828 #endif 
    829824 
    830825  mailbox = imap_next_word (s); 
     
    912907                    mailbox, olduv, oldun, status->unseen)); 
    913908         
    914 #if USE_HCACHE 
    915         /* fetch seen info from hcache if we haven't seen it yet this session */ 
    916         if (!olduv && !oldun) 
    917         { 
    918           hc = mutt_hcache_open (HeaderCache, inc->path); 
    919           if (hc) 
    920           { 
    921             uidvalidity = mutt_hcache_fetch_raw (hc, "/UIDVALIDITY", imap_hcache_keylen); 
    922             uidnext = mutt_hcache_fetch_raw (hc, "/UIDNEXT", imap_hcache_keylen); 
    923             olduv = uidvalidity ? *uidvalidity : 0; 
    924             oldun = uidnext ? *uidnext : 0; 
    925             FREE (&uidvalidity); 
    926             FREE (&uidnext); 
    927             mutt_hcache_close (hc); 
    928             dprint (3, (debugfile, "hcache olduv %d, oldun %d\n", olduv, oldun)); 
    929           } 
    930         } 
    931 #endif 
    932909        if (olduv && olduv == status->uidvalidity) 
    933910        { 
  • imap/imap.c

    r5042 r5043  
    15821582  LIST* cur; 
    15831583  IMAP_STATUS* status; 
     1584  IMAP_STATUS scache; 
     1585#ifdef USE_HCACHE 
     1586  header_cache_t *hc = NULL; 
     1587  ciss_url_t url; 
     1588  char urlstr[LONG_STRING]; 
     1589  unsigned int *uidvalidity = NULL; 
     1590  unsigned int *uidnext = NULL; 
     1591  char* path; 
     1592#endif 
    15841593   
    15851594  for (cur = idata->mboxcache; cur; cur = cur->next) 
     
    15901599      return status; 
    15911600  } 
    1592    
    1593   return NULL; 
     1601  status = NULL; 
     1602 
     1603#ifdef USE_HCACHE 
     1604  path = safe_strdup (idata->ctx->path); 
     1605  url_parse_ciss (&url, path); 
     1606  url.path = (char*)mbox; 
     1607  url_ciss_tostring (&url, urlstr, sizeof (urlstr), 0); 
     1608  FREE (&path); 
     1609  hc = mutt_hcache_open (HeaderCache, urlstr); 
     1610  if (hc) 
     1611  { 
     1612    uidvalidity = mutt_hcache_fetch_raw (hc, "/UIDVALIDITY", imap_hcache_keylen); 
     1613    uidnext = mutt_hcache_fetch_raw (hc, "/UIDNEXT", imap_hcache_keylen); 
     1614    if (uidvalidity) 
     1615    { 
     1616      /* lame */ 
     1617      memset (&scache, 0, sizeof (scache)); 
     1618      scache.name = (char*)mbox; 
     1619      idata->mboxcache = mutt_add_list_n (idata->mboxcache, &scache, 
     1620                                          sizeof (scache)); 
     1621      status = imap_mboxcache_get (idata, mbox); 
     1622      status->name = safe_strdup (mbox); 
     1623      status->uidvalidity = *uidvalidity; 
     1624      status->uidnext = uidnext ? *uidnext: 0; 
     1625      dprint (3, (debugfile, "mboxcache: hcache uidvalidity %d, uidnext %d\n", 
     1626                  status->uidvalidity, status->uidnext)); 
     1627    } 
     1628    FREE (&uidvalidity); 
     1629    FREE (&uidnext); 
     1630    mutt_hcache_close (hc); 
     1631  } 
     1632#endif 
     1633 
     1634  return status; 
    15941635} 
    15951636