Changeset 5111:c38765da3fe8
- Timestamp:
- 2007-04-10 15:32:08 (21 months ago)
- Author:
- Brendan Cully <brendan@…>
- Branch:
- HEAD
- Message:
-
Add imap_hcache_del; minor cleanups
- Location:
- imap
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r5062
|
r5111
|
|
| 31 | 31 | #include "mx.h" |
| 32 | 32 | #include "buffy.h" |
| 33 | | #if USE_HCACHE |
| 34 | | #include "hcache.h" |
| 35 | | #endif |
| 36 | 33 | |
| 37 | 34 | #include <ctype.h> |
-
|
r5102
|
r5111
|
|
| 249 | 249 | int i, cacheno; |
| 250 | 250 | |
| 251 | | #if USE_HCACHE |
| 252 | | char uidbuf[32]; |
| 253 | | #endif |
| 254 | | |
| 255 | 251 | for (i = 0; i < idata->ctx->msgcount; i++) |
| 256 | 252 | { |
| … |
… |
|
| 266 | 262 | imap_cache_del (idata, h); |
| 267 | 263 | #if USE_HCACHE |
| 268 | | if (idata->hcache) |
| 269 | | { |
| 270 | | sprintf (uidbuf, "/%u", HEADER_DATA(h)->uid); |
| 271 | | mutt_hcache_delete (idata->hcache, uidbuf, imap_hcache_keylen); |
| 272 | | } |
| | 264 | imap_hcache_del (idata, HEADER_DATA(h)->uid); |
| 273 | 265 | #endif |
| 274 | 266 | |
| … |
… |
|
| 1104 | 1096 | int n; |
| 1105 | 1097 | int rc; |
| 1106 | | #if USE_HCACHE |
| 1107 | | char uidbuf[32]; |
| 1108 | | #endif |
| 1109 | 1098 | |
| 1110 | 1099 | idata = (IMAP_DATA*) ctx->data; |
| … |
… |
|
| 1157 | 1146 | |
| 1158 | 1147 | if (h->deleted) |
| | 1148 | { |
| 1159 | 1149 | imap_cache_del (idata, h); |
| 1160 | 1150 | #if USE_HCACHE |
| 1161 | | if (idata->hcache && h->deleted) |
| 1162 | | { |
| 1163 | | sprintf (uidbuf, "/%u", HEADER_DATA(h)->uid); |
| 1164 | | mutt_hcache_delete (idata->hcache, uidbuf, imap_hcache_keylen); |
| 1165 | | } |
| | 1151 | imap_hcache_del (idata, HEADER_DATA(h)->uid); |
| 1166 | 1152 | #endif |
| | 1153 | } |
| | 1154 | |
| 1167 | 1155 | if (h->active && h->changed) |
| 1168 | 1156 | { |
-
|
r5074
|
r5111
|
|
| 263 | 263 | HEADER* imap_hcache_get (IMAP_DATA* idata, unsigned int uid); |
| 264 | 264 | int imap_hcache_put (IMAP_DATA* idata, HEADER* h); |
| | 265 | int imap_hcache_del (IMAP_DATA* idata, unsigned int uid); |
| 265 | 266 | #endif |
| 266 | 267 | |
-
|
r5074
|
r5111
|
|
| 95 | 95 | HEADER* h = NULL; |
| 96 | 96 | |
| 97 | | sprintf(key, "/%u", uid); |
| | 97 | if (!idata->hcache) |
| | 98 | return NULL; |
| | 99 | |
| | 100 | sprintf (key, "/%u", uid); |
| 98 | 101 | uv = (unsigned int*)mutt_hcache_fetch (idata->hcache, key, |
| 99 | 102 | imap_hcache_keylen); |
| … |
… |
|
| 112 | 115 | char key[16]; |
| 113 | 116 | |
| 114 | | sprintf(key, "/%u", HEADER_DATA (h)->uid); |
| | 117 | if (!idata->hcache) |
| | 118 | return -1; |
| | 119 | |
| | 120 | sprintf (key, "/%u", HEADER_DATA (h)->uid); |
| 115 | 121 | return mutt_hcache_store (idata->hcache, key, h, idata->uid_validity, |
| 116 | 122 | imap_hcache_keylen); |
| | 123 | } |
| | 124 | |
| | 125 | int imap_hcache_del (IMAP_DATA* idata, unsigned int uid) |
| | 126 | { |
| | 127 | char key[16]; |
| | 128 | |
| | 129 | if (!idata->hcache) |
| | 130 | return -1; |
| | 131 | |
| | 132 | sprintf (key, "/%u", uid); |
| | 133 | return mutt_hcache_delete (idata->hcache, key, imap_hcache_keylen); |
| 117 | 134 | } |
| 118 | 135 | #endif |