Changeset 5073:efbcef81ac49 for imap
Legend:
- Unmodified
- Added
- Removed
-
imap/imap.c
r5046 r5073 250 250 251 251 #if USE_HCACHE 252 header_cache_t *hc;253 252 char uidbuf[32]; 254 255 hc = imap_hcache_open (idata, idata->ctx->path);256 253 #endif 257 254 … … 269 266 imap_cache_del (idata, h); 270 267 #if USE_HCACHE 271 if ( hc)268 if (idata->hcache) 272 269 { 273 270 sprintf (uidbuf, "/%u", HEADER_DATA(h)->uid); 274 mutt_hcache_delete ( hc, uidbuf, imap_hcache_keylen);271 mutt_hcache_delete (idata->hcache, uidbuf, imap_hcache_keylen); 275 272 } 276 273 #endif … … 288 285 } 289 286 } 290 291 #if USE_HCACHE292 mutt_hcache_close (hc);293 #endif294 287 295 288 /* We may be called on to expunge at any time. We can't rely on the caller … … 750 743 ctx->v2r = safe_calloc (count, sizeof (int)); 751 744 ctx->msgcount = 0; 745 #ifdef USE_HCACHE 746 idata->hcache = imap_hcache_open (idata, idata->ctx->path); 747 #endif 752 748 if (count && (imap_read_headers (idata, 0, count-1) < 0)) 753 749 { … … 762 758 763 759 fail: 760 #ifdef USE_HCACHE 761 mutt_hcache_close (idata->hcache); 762 #endif 764 763 if (idata->state == IMAP_SELECTED) 765 764 idata->state = IMAP_AUTHENTICATED; … … 1109 1108 int rc; 1110 1109 #if USE_HCACHE 1111 void* hc = NULL;1112 1110 char uidbuf[32]; 1113 1111 #endif … … 1156 1154 } 1157 1155 1158 #if USE_HCACHE1159 if (expunge && ctx->closing)1160 hc = imap_hcache_open (idata, idata->ctx->path);1161 #endif1162 1163 1156 /* save messages with real (non-flag) changes */ 1164 1157 for (n = 0; n < ctx->msgcount; n++) … … 1169 1162 imap_cache_del (idata, h); 1170 1163 #if USE_HCACHE 1171 if ( hc&& h->deleted)1164 if (idata->hcache && h->deleted) 1172 1165 { 1173 1166 sprintf (uidbuf, "/%u", HEADER_DATA(h)->uid); 1174 mutt_hcache_delete ( hc, uidbuf, imap_hcache_keylen);1167 mutt_hcache_delete (idata->hcache, uidbuf, imap_hcache_keylen); 1175 1168 } 1176 1169 #endif … … 1272 1265 rc = 0; 1273 1266 out: 1274 #if USE_HCACHE1275 mutt_hcache_close (hc);1276 #endif1277 1267 if (cmd.data) 1278 1268 FREE (&cmd.data); … … 1333 1323 } 1334 1324 1325 #ifdef USE_HCACHE 1326 mutt_hcache_close (idata->hcache); 1327 #endif 1335 1328 mutt_bcache_close (&idata->bcache); 1336 1329 -
imap/imap_private.h
r5064 r5073 25 25 #include "mutt_socket.h" 26 26 #include "bcache.h" 27 #ifdef USE_HCACHE 28 #include "hcache.h" 29 #endif 27 30 28 31 /* -- symbols -- */ … … 209 212 /* all folder flags - system flags AND keywords */ 210 213 LIST *flags; 214 #ifdef USE_HCACHE 215 header_cache_t *hcache; 216 #endif 211 217 } IMAP_DATA; 212 218 /* I wish that were called IMAP_CONTEXT :( */ … … 254 260 /* util.c */ 255 261 #ifdef USE_HCACHE 256 void* imap_hcache_open (IMAP_DATA* idata, const char* path);262 header_cache_t* imap_hcache_open (IMAP_DATA* idata, const char* path); 257 263 #endif 258 264 -
imap/message.c
r5071 r5073 76 76 77 77 #if USE_HCACHE 78 header_cache_t *hc = NULL;79 78 unsigned int *uid_validity = NULL; 80 79 unsigned int *uidnext = NULL; … … 122 121 123 122 #if USE_HCACHE 124 if (!msgbegin) 125 hc = imap_hcache_open (idata, ctx->path); 126 127 if (hc) 128 { 129 uid_validity = mutt_hcache_fetch_raw (hc, "/UIDVALIDITY", imap_hcache_keylen); 130 uidnext = mutt_hcache_fetch_raw (hc, "/UIDNEXT", imap_hcache_keylen); 123 if (idata->hcache) 124 { 125 uid_validity = mutt_hcache_fetch_raw (idata->hcache, "/UIDVALIDITY", imap_hcache_keylen); 126 uidnext = mutt_hcache_fetch_raw (idata->hcache, "/UIDNEXT", imap_hcache_keylen); 131 127 if (uid_validity && uidnext && *uid_validity == idata->uid_validity 132 128 && *uidnext > 0) … … 174 170 idx = h.sid - 1; 175 171 sprintf(uid_buf, "/%u", h.data->uid); /* XXX --tg 21:41 04-07-11 */ 176 uid_validity = (unsigned int*)mutt_hcache_fetch ( hc, uid_buf, &imap_hcache_keylen);172 uid_validity = (unsigned int*)mutt_hcache_fetch (idata->hcache, uid_buf, &imap_hcache_keylen); 177 173 178 174 if (uid_validity != NULL && *uid_validity == idata->uid_validity) … … 210 206 imap_free_header_data ((void**) &h.data); 211 207 fclose (fp); 212 mutt_hcache_close (hc);213 208 return -1; 214 209 } … … 300 295 #if USE_HCACHE 301 296 sprintf(uid_buf, "/%u", h.data->uid); 302 mutt_hcache_store( hc, uid_buf, ctx->hdrs[idx], idata->uid_validity, &imap_hcache_keylen);297 mutt_hcache_store(idata->hcache, uid_buf, ctx->hdrs[idx], idata->uid_validity, &imap_hcache_keylen); 303 298 #endif /* USE_HCACHE */ 304 299 … … 313 308 imap_free_header_data ((void**) &h.data); 314 309 fclose (fp); 315 #if USE_HCACHE316 mutt_hcache_close (hc);317 #endif /* USE_HCACHE */318 310 return -1; 319 311 } … … 334 326 335 327 #if USE_HCACHE 336 mutt_hcache_store_raw ( hc, "/UIDVALIDITY", &idata->uid_validity,328 mutt_hcache_store_raw (idata->hcache, "/UIDVALIDITY", &idata->uid_validity, 337 329 sizeof (idata->uid_validity), imap_hcache_keylen); 338 330 if (maxuid && idata->uidnext < maxuid + 1) … … 342 334 } 343 335 if (idata->uidnext > 1) 344 mutt_hcache_store_raw ( hc, "/UIDNEXT", &idata->uidnext,336 mutt_hcache_store_raw (idata->hcache, "/UIDNEXT", &idata->uidnext, 345 337 sizeof (idata->uidnext), imap_hcache_keylen); 346 mutt_hcache_close (hc);347 338 #endif /* USE_HCACHE */ 348 339 -
imap/util.c
r5055 r5073 71 71 72 72 #ifdef USE_HCACHE 73 void* imap_hcache_open (IMAP_DATA* idata, const char* path)73 header_cache_t* imap_hcache_open (IMAP_DATA* idata, const char* path) 74 74 { 75 75 IMAP_MBOX mx;
