Changeset 5120:429fb67340cd
- Timestamp:
- 2007-04-10 20:22:06 (21 months ago)
- Author:
- Brendan Cully <brendan@…>
- Branch:
- HEAD
- Message:
-
Add $message_cache_clean option to prune message cache on sync
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r5118
|
r5120
|
|
| 1 | | 2007-04-10 19:19 -0700 Brendan Cully <brendan@kublai.com> (ddd38b4cf15c) |
| | 1 | 2007-04-10 19:28 -0700 Brendan Cully <brendan@kublai.com> (d12143e1a610) |
| | 2 | |
| | 3 | * hcache.c: Try to unlink old header cache if open fails |
| | 4 | |
| | 5 | * bcache.c, imap/imap.c, imap/util.c, lib.c: Fix some warnings |
| 2 | 6 | |
| 3 | 7 | * hcache.c: Refactor mutt_hcache_open to share more code |
-
|
r5087
|
r5120
|
|
| 4 | 4 | The keys used are: |
| 5 | 5 | !: modified feature, -: deleted feature, +: new feature |
| | 6 | |
| | 7 | + $message_cache_clean (clean cache on sync) |
| 6 | 8 | |
| 7 | 9 | 1.5.15 (2007-04-06) |
-
|
r5118
|
r5120
|
|
| 1262 | 1262 | } |
| 1263 | 1263 | |
| | 1264 | if (option (OPTMESSAGECACHECLEAN)) |
| | 1265 | imap_cache_clean (idata); |
| | 1266 | |
| 1264 | 1267 | rc = 0; |
| | 1268 | |
| 1265 | 1269 | out: |
| 1266 | 1270 | if (cmd.data) |
-
|
r5115
|
r5120
|
|
| 257 | 257 | char* imap_set_flags (IMAP_DATA* idata, HEADER* h, char* s); |
| 258 | 258 | int imap_cache_del (IMAP_DATA* idata, HEADER* h); |
| | 259 | int imap_cache_clean (IMAP_DATA* idata); |
| 259 | 260 | |
| 260 | 261 | /* util.c */ |
-
|
r5115
|
r5120
|
|
| 907 | 907 | } |
| 908 | 908 | |
| | 909 | static int msg_cache_clean_cb (const char* id, body_cache_t* bcache, void* data) |
| | 910 | { |
| | 911 | unsigned int uv, uid, n; |
| | 912 | IMAP_DATA* idata = (IMAP_DATA*)data; |
| | 913 | |
| | 914 | if (sscanf (id, "%u-%u", &uv, &uid) != 2) |
| | 915 | return 0; |
| | 916 | |
| | 917 | /* bad UID */ |
| | 918 | if (uv != idata->uid_validity) |
| | 919 | mutt_bcache_del (bcache, id); |
| | 920 | |
| | 921 | /* TODO: presort UIDs, walk in order */ |
| | 922 | for (n = 0; n < idata->ctx->msgcount; n++) |
| | 923 | { |
| | 924 | if (uid == HEADER_DATA(idata->ctx->hdrs[n])->uid) |
| | 925 | return 0; |
| | 926 | } |
| | 927 | mutt_bcache_del (bcache, id); |
| | 928 | |
| | 929 | return 0; |
| | 930 | } |
| | 931 | |
| | 932 | int imap_cache_clean (IMAP_DATA* idata) |
| | 933 | { |
| | 934 | idata->bcache = msg_cache_open (idata); |
| | 935 | mutt_bcache_list (idata->bcache, msg_cache_clean_cb, idata); |
| | 936 | |
| | 937 | return 0; |
| | 938 | } |
| | 939 | |
| 909 | 940 | /* imap_add_keywords: concatenate custom IMAP tags to list, if they |
| 910 | 941 | * appear in the folder flags list. Why wouldn't they? */ |
-
|
r5064
|
r5120
|
|
| 1295 | 1295 | ** time, for instance if stale entries accumulate because you have |
| 1296 | 1296 | ** deleted messages with another mail client. |
| | 1297 | */ |
| | 1298 | { "message_cache_clean", DT_BOOL, R_NONE, OPTMESSAGECACHECLEAN, 0 }, |
| | 1299 | /* |
| | 1300 | ** .pp |
| | 1301 | ** If set, mutt will clean out obsolete entries from the cache when |
| | 1302 | ** the mailbox is synchronized. You probably only want to set it |
| | 1303 | ** every once in a while, since it can be a little slow. |
| 1297 | 1304 | */ |
| 1298 | 1305 | #endif |
-
|
r5029
|
r5120
|
|
| 401 | 401 | OPTMENUSCROLL, /* scroll menu instead of implicit next-page */ |
| 402 | 402 | OPTMENUMOVEOFF, /* allow menu to scroll past last entry */ |
| | 403 | #if defined(USE_IMAP) || defined(USE_POP) |
| | 404 | OPTMESSAGECACHECLEAN, |
| | 405 | #endif |
| 403 | 406 | OPTMETAKEY, /* interpret ALT-x as ESC-x */ |
| 404 | 407 | OPTMETOO, |