Changeset 5112:4411620e877b for imap
Legend:
- Unmodified
- Added
- Removed
-
imap/imap.c
r5111 r5112 249 249 int i, cacheno; 250 250 251 #ifdef USE_HCACHE 252 imap_hcache_open (idata); 253 #endif 254 251 255 for (i = 0; i < idata->ctx->msgcount; i++) 252 256 { … … 277 281 } 278 282 } 283 284 #if USE_HCACHE 285 imap_hcache_close (idata); 286 #endif 279 287 280 288 /* We may be called on to expunge at any time. We can't rely on the caller … … 735 743 ctx->v2r = safe_calloc (count, sizeof (int)); 736 744 ctx->msgcount = 0; 737 #ifdef USE_HCACHE 738 idata->hcache = imap_hcache_open (idata, idata->ctx->path); 739 #endif 745 740 746 if (count && (imap_read_headers (idata, 0, count-1) < 0)) 741 747 { … … 1140 1146 } 1141 1147 1148 #if USE_HCACHE 1149 imap_hcache_open (idata); 1150 #endif 1151 1142 1152 /* save messages with real (non-flag) changes */ 1143 1153 for (n = 0; n < ctx->msgcount; n++) … … 1175 1185 } 1176 1186 1187 #if USE_HCACHE 1188 imap_hcache_close (idata); 1189 #endif 1190 1177 1191 /* sync +/- flags for the five flags mutt cares about */ 1178 1192 rc = 0; … … 1308 1322 } 1309 1323 1310 #ifdef USE_HCACHE1311 mutt_hcache_close (idata->hcache);1312 idata->hcache = NULL;1313 #endif1314 1324 mutt_bcache_close (&idata->bcache); 1315 1325 -
imap/imap_private.h
r5111 r5112 260 260 /* util.c */ 261 261 #ifdef USE_HCACHE 262 header_cache_t* imap_hcache_open (IMAP_DATA* idata, const char* path); 262 int imap_hcache_open (IMAP_DATA* idata); 263 void imap_hcache_close (IMAP_DATA* idata); 263 264 HEADER* imap_hcache_get (IMAP_DATA* idata, unsigned int uid); 264 265 int imap_hcache_put (IMAP_DATA* idata, HEADER* h); -
imap/message.c
r5098 r5112 120 120 121 121 #if USE_HCACHE 122 imap_hcache_open (idata); 123 122 124 if (idata->hcache && !msgbegin) 123 125 { … … 200 202 if (h.data) 201 203 imap_free_header_data ((void**) (void*) &h.data); 204 imap_hcache_close (idata); 202 205 fclose (fp); 203 206 return -1; … … 301 304 if (h.data) 302 305 imap_free_header_data ((void**) (void*) &h.data); 306 #if USE_HCACHE 307 imap_hcache_close (idata); 308 #endif 303 309 fclose (fp); 304 310 return -1; … … 330 336 mutt_hcache_store_raw (idata->hcache, "/UIDNEXT", &idata->uidnext, 331 337 sizeof (idata->uidnext), imap_hcache_keylen); 338 339 imap_hcache_close (idata); 332 340 #endif /* USE_HCACHE */ 333 341 -
imap/util.c
r5111 r5112 72 72 73 73 #ifdef USE_HCACHE 74 header_cache_t* imap_hcache_open (IMAP_DATA* idata, const char* path)74 int imap_hcache_open (IMAP_DATA* idata) 75 75 { 76 76 IMAP_MBOX mx; … … 78 78 char cachepath[LONG_STRING]; 79 79 80 if (imap_parse_path ( path, &mx) < 0)81 return NULL;80 if (imap_parse_path (idata->ctx->path, &mx) < 0) 81 return -1; 82 82 83 83 mutt_account_tourl (&idata->conn->account, &url); … … 86 86 FREE (&mx.mbox); 87 87 88 return mutt_hcache_open (HeaderCache, cachepath); 88 idata->hcache = mutt_hcache_open (HeaderCache, cachepath); 89 90 return idata->hcache != NULL ? 0 : -1; 91 } 92 93 void imap_hcache_close (IMAP_DATA* idata) 94 { 95 if (!idata->hcache) 96 return; 97 98 mutt_hcache_close (idata->hcache); 99 idata->hcache = NULL; 89 100 } 90 101
