Mercurial > dovecot > core-2.2
changeset 16557:230f111056b4
pop3c: Return error instead of crashing when trying to save a mail.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 26 Jun 2013 15:44:08 +0300 |
parents | af8ce0a84bb5 |
children | f3b9325509fd |
files | src/lib-storage/index/pop3c/pop3c-storage.c |
diffstat | 1 files changed, 39 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/pop3c/pop3c-storage.c Wed Jun 26 15:29:43 2013 +0300 +++ b/src/lib-storage/index/pop3c/pop3c-storage.c Wed Jun 26 15:44:08 2013 +0300 @@ -234,6 +234,40 @@ { } +static struct mail_save_context * +pop3c_save_alloc(struct mailbox_transaction_context *t) +{ + struct mail_save_context *ctx; + + ctx = i_new(struct mail_save_context, 1); + ctx->transaction = t; + return ctx; +} + +static int +pop3c_save_begin(struct mail_save_context *ctx ATTR_UNUSED, + struct istream *input ATTR_UNUSED) +{ + mail_storage_set_error(ctx->transaction->box->storage, + MAIL_ERROR_NOTPOSSIBLE, "POP3 doesn't support saving mails"); + return -1; +} + +static int pop3c_save_continue(struct mail_save_context *ctx ATTR_UNUSED) +{ + return -1; +} + +static int pop3c_save_finish(struct mail_save_context *ctx ATTR_UNUSED) +{ + return -1; +} + +static void +pop3c_save_cancel(struct mail_save_context *ctx ATTR_UNUSED) +{ +} + static bool pop3c_storage_is_inconsistent(struct mailbox *box) { struct pop3c_mailbox *mbox = (struct pop3c_mailbox *)box; @@ -295,11 +329,11 @@ index_storage_search_deinit, index_storage_search_next_nonblock, index_storage_search_next_update_seq, - NULL, - NULL, - NULL, - NULL, - NULL, + pop3c_save_alloc, + pop3c_save_begin, + pop3c_save_continue, + pop3c_save_finish, + pop3c_save_cancel, mail_storage_copy, NULL, NULL,