# HG changeset patch # User Timo Sirainen # Date 1032181146 -10800 # Node ID 29cf239504529e25a5a7f97d2c34e99dd8890f3a # Parent 38282593753f927c2a65d955aae789751fc373f3 Report FETCH failure properly diff -r 38282593753f -r 29cf23950452 src/lib-storage/index/index-fetch.c --- a/src/lib-storage/index/index-fetch.c Mon Sep 16 15:28:59 2002 +0300 +++ b/src/lib-storage/index/index-fetch.c Mon Sep 16 15:59:06 2002 +0300 @@ -23,7 +23,8 @@ t_string_printfa(ctx->str, "BODY %s ", body); return TRUE; } else { - i_error("Couldn't generate BODY for UID %u (index %s)", + mail_storage_set_critical(ctx->storage, + "Couldn't generate BODY for UID %u (index %s)", rec->uid, ctx->index->filepath); return FALSE; } @@ -39,7 +40,8 @@ bodystructure); return TRUE; } else { - i_error("Couldn't generate BODYSTRUCTURE for UID %u (index %s)", + mail_storage_set_critical(ctx->storage, + "Couldn't generate BODYSTRUCTURE for UID %u (index %s)", rec->uid, ctx->index->filepath); return FALSE; } @@ -54,7 +56,8 @@ t_string_printfa(ctx->str, "ENVELOPE (%s) ", envelope); return TRUE; } else { - i_error("Couldn't generate ENVELOPE for UID %u (index %s)", + mail_storage_set_critical(ctx->storage, + "Couldn't generate ENVELOPE for UID %u (index %s)", rec->uid, ctx->index->filepath); return FALSE; } @@ -66,7 +69,8 @@ if (!imap_msgcache_get_rfc822(ctx->cache, NULL, &hdr_size, &body_size)) { - i_error("Couldn't get RFC822.SIZE for UID %u (index %s)", + mail_storage_set_critical(ctx->storage, + "Couldn't get RFC822.SIZE for UID %u (index %s)", rec->uid, ctx->index->filepath); return FALSE; } @@ -109,7 +113,8 @@ if (!imap_msgcache_get_rfc822(ctx->cache, &inbuf, &hdr_size, &body_size)) { - i_error("Couldn't get RFC822 for UID %u (index %s)", + mail_storage_set_critical(ctx->storage, + "Couldn't get RFC822 for UID %u (index %s)", rec->uid, ctx->index->filepath); return FALSE; } @@ -135,7 +140,8 @@ const char *str; if (!imap_msgcache_get_rfc822(ctx->cache, &inbuf, &hdr_size, NULL)) { - i_error("Couldn't get RFC822.HEADER for UID %u (index %s)", + mail_storage_set_critical(ctx->storage, + "Couldn't get RFC822.HEADER for UID %u (index %s)", rec->uid, ctx->index->filepath); return FALSE; } @@ -158,7 +164,8 @@ const char *str; if (!imap_msgcache_get_rfc822(ctx->cache, &inbuf, NULL, &body_size)) { - i_error("Couldn't get RFC822.TEXT for UID %u (index %s)", + mail_storage_set_critical(ctx->storage, + "Couldn't get RFC822.TEXT for UID %u (index %s)", rec->uid, ctx->index->filepath); return FALSE; } @@ -334,6 +341,7 @@ memset(&ctx, 0, sizeof(ctx)); ctx.box = box; + ctx.storage = box->storage; ctx.cache = ibox->cache; ctx.index = ibox->index; ctx.custom_flags = @@ -375,5 +383,5 @@ return FALSE; } - return ret >= 0; + return ret > 0; } diff -r 38282593753f -r 29cf23950452 src/lib-storage/index/index-fetch.h --- a/src/lib-storage/index/index-fetch.h Mon Sep 16 15:28:59 2002 +0300 +++ b/src/lib-storage/index/index-fetch.h Mon Sep 16 15:59:06 2002 +0300 @@ -3,6 +3,7 @@ typedef struct { Mailbox *box; + MailStorage *storage; ImapMessageCache *cache; MailIndex *index; const char **custom_flags; diff -r 38282593753f -r 29cf23950452 src/lib-storage/index/index-messageset.h --- a/src/lib-storage/index/index-messageset.h Mon Sep 16 15:28:59 2002 +0300 +++ b/src/lib-storage/index/index-messageset.h Mon Sep 16 15:59:06 2002 +0300 @@ -7,6 +7,9 @@ typedef int (*MsgsetForeachFunc)(MailIndex *index, MailIndexRecord *rec, unsigned int seq, void *context); +/* Returns 1 if all were found, 2 if some messages were deleted, + 0 func returned FALSE, -1 if internal error occured or -2 if messageset + was invalid. */ int index_messageset_foreach(IndexMailbox *ibox, const char *messageset, int uidset, MsgsetForeachFunc func, void *context);