Changeset 5043:aef7a5bf213c
- Timestamp:
- 2007-04-02 10:36:20 (22 months ago)
- Author:
- Brendan Cully <brendan@…>
- Branch:
- HEAD
- Message:
-
Push mbox cache header cache check into imap_mboxcache_get
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r5041
|
r5043
|
|
| | 1 | 2007-04-02 10:02 -0700 Brendan Cully <brendan@kublai.com> (becbad651ecc) |
| | 2 | |
| | 3 | * imap/imap.c: Cache IMAP access checks |
| | 4 | |
| | 5 | 2007-04-01 23:12 -0700 Brendan Cully <brendan@kublai.com> (4f598543d7a5) |
| | 6 | |
| | 7 | * imap/imap.c, imap/message.c: Adjust context->size on IMAP load |
| | 8 | and expunge (closes #2749) |
| | 9 | |
| 1 | 10 | 2007-04-01 20:00 -0700 Ambrose Li <a.c.li@ieee.org> (38e896c4c192) |
| 2 | 11 | |
-
|
r5033
|
r5043
|
|
| 822 | 822 | IMAP_STATUS *status, sb; |
| 823 | 823 | 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 |
| 829 | 824 | |
| 830 | 825 | mailbox = imap_next_word (s); |
| … |
… |
|
| 912 | 907 | mailbox, olduv, oldun, status->unseen)); |
| 913 | 908 | |
| 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 |
| 932 | 909 | if (olduv && olduv == status->uidvalidity) |
| 933 | 910 | { |
-
|
r5042
|
r5043
|
|
| 1582 | 1582 | LIST* cur; |
| 1583 | 1583 | 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 |
| 1584 | 1593 | |
| 1585 | 1594 | for (cur = idata->mboxcache; cur; cur = cur->next) |
| … |
… |
|
| 1590 | 1599 | return status; |
| 1591 | 1600 | } |
| 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; |
| 1594 | 1635 | } |
| 1595 | 1636 | |