struct mailbox_keywords old_flags;
struct mail_full_flags flags;
struct istream *input;
- struct mail *mail;
time_t internal_date;
const char *mailbox, *internal_date_str;
uoff_t msg_size;
- string_t *reply;
- struct msgset_generator_context msgset_ctx;
unsigned int count;
int ret, failed, timezone_offset, nonsync;
}
}
- if (mailbox_get_status(box, STATUS_KEYWORDS | STATUS_UIDVALIDITY,
- &status) < 0) {
+ if (mailbox_get_status(box, STATUS_KEYWORDS, &status) < 0) {
client_send_storage_error(client, storage);
mailbox_close(box);
return TRUE;
/* if error occurs, the CRLF is already read. */
client->input_skip_line = FALSE;
- reply = str_new(default_pool, 256);
- str_printfa(reply, "OK [APPENDUID %u ", status.uidvalidity);
-
- msgset_generator_init(&msgset_ctx, reply);
count = 0;
failed = TRUE;
save_parser = imap_parser_create(client->input, client->output,
client->input->v_offset,
msg_size);
if (mailbox_save(t, &flags, internal_date, timezone_offset,
- NULL, input, &mail) < 0) {
+ NULL, input, NULL) < 0) {
i_stream_unref(input);
client_send_storage_error(client, storage);
break;
}
i_stream_unref(input);
- msgset_generator_next(&msgset_ctx, mail->uid);
-
if (client->input->closed)
break;
}
imap_parser_destroy(save_parser);
- msgset_generator_finish(&msgset_ctx);
-
if (failed)
mailbox_transaction_rollback(t);
else {
if (!failed) {
client_sync_full(client);
- str_append(reply, "] Append completed.");
- client_send_tagline(client, str_c(reply));
+ client_send_tagline(client, "OK Append completed.");
}
- str_free(reply);
return TRUE;
}
static int fetch_and_copy(struct mailbox_transaction_context *t,
struct mailbox *srcbox,
- struct mail_search_arg *search_args,
- string_t *reply)
+ struct mail_search_arg *search_args)
{
struct mail_search_context *search_ctx;
struct mailbox_transaction_context *src_trans;
- struct mail *mail, *dest_mail;
- struct msgset_generator_context srcset_ctx, destset_ctx;
+ struct mail *mail;
string_t *dest_str;
int ret;
}
dest_str = t_str_new(128);
- msgset_generator_init(&srcset_ctx, reply);
- msgset_generator_init(&destset_ctx, dest_str);
ret = 1;
while ((mail = mailbox_search_next(search_ctx)) != NULL) {
ret = 0;
break;
}
- if (mailbox_copy(t, mail, &dest_mail) < 0) {
+ if (mailbox_copy(t, mail, NULL) < 0) {
ret = -1;
break;
}
- msgset_generator_next(&srcset_ctx, mail->uid);
- msgset_generator_next(&destset_ctx, dest_mail->uid);
-
- }
-
- msgset_generator_finish(&srcset_ctx);
- msgset_generator_finish(&destset_ctx);
-
- if (str_len(dest_str) == 0)
- str_truncate(reply, 0);
- else {
- str_append_c(reply, ' ');
- str_append_str(reply, dest_str);
- str_append(reply, "] Copy completed.");
}
if (mailbox_search_deinit(search_ctx) < 0)
struct mailbox *destbox;
struct mailbox_transaction_context *t;
struct mail_search_arg *search_arg;
- struct mailbox_status status;
const char *messageset, *mailbox;
- string_t *reply;
int ret;
/* <message set> <mailbox> */
}
}
- if (mailbox_get_status(destbox, STATUS_UIDVALIDITY, &status) < 0) {
- client_send_storage_error(client, storage);
- if (destbox != client->mailbox)
- mailbox_close(destbox);
- return TRUE;
- }
-
- reply = str_new(default_pool, 512);
- str_printfa(reply, "OK [COPYUID %u ", status.uidvalidity);
-
t = mailbox_transaction_begin(destbox, FALSE);
- ret = fetch_and_copy(t, client->mailbox, search_arg, reply);
+ ret = fetch_and_copy(t, client->mailbox, search_arg);
if (ret <= 0)
mailbox_transaction_rollback(t);
client_sync_full(client);
else
client_sync_full_fast(client);
- if (str_len(reply) > 0)
- client_send_tagline(client, str_c(reply));
- else {
- client_send_tagline(client,
- "OK Copy completed, no messages found.");
- }
+ client_send_tagline(client, "OK Copy completed.");
}
if (destbox != client->mailbox)