Changeset 5025:0cb476dc70a7
- Timestamp:
- 2007-03-30 00:21:02 (22 months ago)
- Author:
- Brendan Cully <brendan@…>
- Branch:
- default
- Message:
-
Consult header cache if available for last known new mail count.
This prevents mutt from announcing new mail in mailboxes that have
unseen, but not new, messages, if those mailboxes are in the header
cache.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r4993
|
r5025
|
|
| 31 | 31 | #include "mx.h" |
| 32 | 32 | #include "buffy.h" |
| | 33 | #if USE_HCACHE |
| | 34 | #include "hcache.h" |
| | 35 | #endif |
| 33 | 36 | |
| 34 | 37 | #include <ctype.h> |
| … |
… |
|
| 819 | 822 | IMAP_STATUS *status, sb; |
| 820 | 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 |
| 821 | 829 | |
| 822 | 830 | mailbox = imap_next_word (s); |
| … |
… |
|
| 862 | 870 | s = imap_next_word (s); |
| 863 | 871 | } |
| 864 | | dprint (2, (debugfile, "%s (UIDVALIDITY: %d, UIDNEXT: %d) %d messages, %d recent, %d unseen\n", |
| | 872 | dprint (3, (debugfile, "%s (UIDVALIDITY: %d, UIDNEXT: %d) %d messages, %d recent, %d unseen\n", |
| 865 | 873 | status->name, status->uidvalidity, status->uidnext, |
| 866 | 874 | status->messages, status->recent, status->unseen)); |
| … |
… |
|
| 873 | 881 | } |
| 874 | 882 | |
| 875 | | dprint (2, (debugfile, "Running default STATUS handler\n")); |
| | 883 | dprint (3, (debugfile, "Running default STATUS handler\n")); |
| 876 | 884 | |
| 877 | 885 | /* should perhaps move this code back to imap_buffy_check */ |
| … |
… |
|
| 901 | 909 | if (value && !imap_mxcmp (mailbox, value)) |
| 902 | 910 | { |
| 903 | | dprint (2, (debugfile, "Found %s in buffy list (OV: %d ON: %d U: %d)\n", |
| | 911 | dprint (3, (debugfile, "Found %s in buffy list (OV: %d ON: %d U: %d)\n", |
| 904 | 912 | mailbox, olduv, oldun, status->unseen)); |
| 905 | 913 | |
| | 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 |
| 906 | 932 | if (olduv && olduv == status->uidvalidity) |
| 907 | 933 | { |
| … |
… |
|
| 909 | 935 | { |
| 910 | 936 | inc->new = status->unseen; |
| | 937 | /* forced back to keep detecting new mail until the mailbox is opened */ |
| | 938 | status->uidnext = oldun; |
| 911 | 939 | } |
| 912 | 940 | } |
| … |
… |
|
| 914 | 942 | inc->new = status->unseen; |
| 915 | 943 | |
| 916 | | /* forced back to keep detecting new mail until the mailbox is opened */ |
| 917 | | status->uidnext = oldun; |
| 918 | | |
| 919 | 944 | FREE (&value); |
| 920 | 945 | return; |