| 1 | static int msg_cache_check(const char *id, struct BodyCache *bcache, void *data) |
| 2 | { |
| 3 | struct Context *ctx = (struct Context *) data; |
| 4 | if (!ctx) |
| 5 | return -1; |
| 6 | struct PopData *pop_data = (struct PopData *) ctx->data; |
| 7 | if (!pop_data) |
| 8 | return -1; |
| 9 | |
| 10 | #ifdef USE_HCACHE |
| 11 | /* keep hcache file if hcache == bcache */ |
| 12 | if (strcmp(HC_FNAME "." HC_FEXT, id) == 0) |
| 13 | return 0; |
| 14 | #endif |
| 15 | |
| 16 | for (int i = 0; i < ctx->msgcount; i++) |
| 17 | { |
| 18 | /* if the id we get is known for a header: done (i.e. keep in cache) */ |
| 19 | if (ctx->hdrs[i]->data && (mutt_str_strcmp(ctx->hdrs[i]->data, id) == 0)) |
| 20 | return 0; |
| 21 | } |
| 22 | |
| 23 | /* message not found in context -> remove it from cache |
| 24 | * return the result of bcache, so we stop upon its first error |
| 25 | */ |
| 26 | return mutt_bcache_del(bcache, id); |
| 27 | } |
nothing calls this directly
no outgoing calls
no test coverage detected