imapc-save.c (dovecot-2.3.16) | : | imapc-save.c (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
#include "lib.h" | #include "lib.h" | |||
#include "str.h" | #include "str.h" | |||
#include "istream.h" | #include "istream.h" | |||
#include "istream-crlf.h" | #include "istream-crlf.h" | |||
#include "ostream.h" | #include "ostream.h" | |||
#include "imap-date.h" | #include "imap-date.h" | |||
#include "imap-util.h" | #include "imap-util.h" | |||
#include "index-mail.h" | #include "index-mail.h" | |||
#include "mail-copy.h" | #include "mail-copy.h" | |||
#include "mailbox-list-private.h" | #include "mailbox-list-private.h" | |||
#include "imapc-msgmap.h" | ||||
#include "imapc-storage.h" | #include "imapc-storage.h" | |||
#include "imapc-sync.h" | #include "imapc-sync.h" | |||
#include "imapc-mail.h" | #include "imapc-mail.h" | |||
struct imapc_save_context { | struct imapc_save_context { | |||
struct mail_save_context ctx; | struct mail_save_context ctx; | |||
struct imapc_mailbox *mbox; | struct imapc_mailbox *mbox; | |||
struct mail_index_transaction *trans; | struct mail_index_transaction *trans; | |||
skipping to change at line 406 | skipping to change at line 407 | |||
"imapc: COPY failed: %s", reply->text_full); | "imapc: COPY failed: %s", reply->text_full); | |||
ctx->ret = -1; | ctx->ret = -1; | |||
} | } | |||
imapc_client_stop(ctx->ctx->mbox->storage->client->client); | imapc_client_stop(ctx->ctx->mbox->storage->client->client); | |||
} | } | |||
int imapc_copy(struct mail_save_context *_ctx, struct mail *mail) | int imapc_copy(struct mail_save_context *_ctx, struct mail *mail) | |||
{ | { | |||
struct imapc_save_context *ctx = IMAPC_SAVECTX(_ctx); | struct imapc_save_context *ctx = IMAPC_SAVECTX(_ctx); | |||
struct mailbox_transaction_context *_t = _ctx->transaction; | struct mailbox_transaction_context *_t = _ctx->transaction; | |||
struct imapc_mailbox *src_mbox = IMAPC_MAILBOX(mail->box); | struct imapc_mailbox *src_mbox; | |||
struct imapc_msgmap *src_msgmap; | ||||
struct imapc_command *cmd; | struct imapc_command *cmd; | |||
struct imapc_save_cmd_context sctx; | struct imapc_save_cmd_context sctx; | |||
uint32_t rseq; | ||||
i_assert((_t->flags & MAILBOX_TRANSACTION_FLAG_EXTERNAL) != 0); | i_assert((_t->flags & MAILBOX_TRANSACTION_FLAG_EXTERNAL) != 0); | |||
if (_t->box->storage == mail->box->storage) { | if (_t->box->storage == mail->box->storage) { | |||
src_mbox = IMAPC_MAILBOX(mail->box); | ||||
/* same server, we can use COPY for the mail */ | /* same server, we can use COPY for the mail */ | |||
src_msgmap = | ||||
imapc_client_mailbox_get_msgmap(src_mbox->client_box); | ||||
if (mail->expunged || | ||||
!imapc_msgmap_uid_to_rseq(src_msgmap, mail->uid, &rseq)) { | ||||
mail_storage_set_error(mail->box->storage, | ||||
MAIL_ERROR_EXPUNGED, | ||||
"Some of the requested messages no | ||||
longer exist."); | ||||
ctx->finished = TRUE; | ||||
index_save_context_free(_ctx); | ||||
return -1; | ||||
} | ||||
/* Mail has not been expunged and can be copied. */ | ||||
sctx.ret = -2; | sctx.ret = -2; | |||
sctx.ctx = ctx; | sctx.ctx = ctx; | |||
cmd = imapc_client_mailbox_cmd(src_mbox->client_box, | cmd = imapc_client_mailbox_cmd(src_mbox->client_box, | |||
imapc_copy_callback, &sctx); | imapc_copy_callback, &sctx); | |||
imapc_command_sendf(cmd, "UID COPY %u %s", | imapc_command_sendf(cmd, "UID COPY %u %s", | |||
mail->uid, _t->box->name); | mail->uid, _t->box->name); | |||
while (sctx.ret == -2) | while (sctx.ret == -2) | |||
imapc_mailbox_run(src_mbox); | imapc_mailbox_run(src_mbox); | |||
ctx->finished = TRUE; | ctx->finished = TRUE; | |||
index_save_context_free(_ctx); | index_save_context_free(_ctx); | |||
End of changes. 5 change blocks. | ||||
1 lines changed or deleted | 18 lines changed or added |