# HG changeset patch # User Timo Sirainen # Date 1067191542 -7200 # Node ID b2ceea02ba60ddfa01bed8341cec53ac49b07f8e # Parent 31e628d88253f157885549c76fb68d53e2300310 Moved copy() method from struct mail to struct mailbox - the context parameter makes sense only to destination mailbox handler. diff -r 31e628d88253 -r b2ceea02ba60 src/imap/cmd-copy.c --- a/src/imap/cmd-copy.c Sun Oct 26 19:28:44 2003 +0200 +++ b/src/imap/cmd-copy.c Sun Oct 26 20:05:42 2003 +0200 @@ -4,27 +4,27 @@ #include "commands.h" static int fetch_and_copy(struct mail_copy_context *copy_ctx, - struct mailbox *box, const char *messageset, - int uidset, int *all_found) + struct mailbox *srcbox, struct mailbox *destbox, + const char *messageset, int uidset, int *all_found) { struct mail_fetch_context *fetch_ctx; struct mail *mail; int failed = FALSE; - fetch_ctx = box->fetch_init(box, MAIL_FETCH_STREAM_HEADER | - MAIL_FETCH_STREAM_BODY, NULL, - messageset, uidset); + fetch_ctx = srcbox->fetch_init(srcbox, MAIL_FETCH_STREAM_HEADER | + MAIL_FETCH_STREAM_BODY, NULL, + messageset, uidset); if (fetch_ctx == NULL) return FALSE; - while ((mail = box->fetch_next(fetch_ctx)) != NULL) { - if (!mail->copy(mail, copy_ctx)) { + while ((mail = srcbox->fetch_next(fetch_ctx)) != NULL) { + if (!destbox->copy(mail, copy_ctx)) { failed = TRUE; break; } } - if (!box->fetch_deinit(fetch_ctx, all_found)) + if (!srcbox->fetch_deinit(fetch_ctx, all_found)) return FALSE; return !failed; @@ -75,7 +75,7 @@ if (copy_ctx == NULL) failed = TRUE; else { - if (!fetch_and_copy(copy_ctx, client->mailbox, + if (!fetch_and_copy(copy_ctx, client->mailbox, destbox, messageset, client->cmd_uid, &all_found)) failed = TRUE; diff -r 31e628d88253 -r b2ceea02ba60 src/lib-storage/index/index-mail.c --- a/src/lib-storage/index/index-mail.c Sun Oct 26 19:28:44 2003 +0200 +++ b/src/lib-storage/index/index-mail.c Sun Oct 26 20:05:42 2003 +0200 @@ -561,7 +561,6 @@ get_stream, get_special, index_storage_update_flags, - index_storage_copy, index_storage_expunge }; diff -r 31e628d88253 -r b2ceea02ba60 src/lib-storage/index/maildir/maildir-storage.c --- a/src/lib-storage/index/maildir/maildir-storage.c Sun Oct 26 19:28:44 2003 +0200 +++ b/src/lib-storage/index/maildir/maildir-storage.c Sun Oct 26 20:05:42 2003 +0200 @@ -387,7 +387,6 @@ static void maildir_mail_init(struct index_mail *mail) { - mail->mail.copy = maildir_storage_copy; mail->mail.expunge = maildir_storage_expunge; } @@ -872,6 +871,7 @@ maildir_storage_save_next, maildir_storage_copy_init, maildir_storage_copy_deinit, + maildir_storage_copy, maildir_storage_expunge_init, maildir_storage_expunge_deinit, maildir_storage_expunge_fetch_next, diff -r 31e628d88253 -r b2ceea02ba60 src/lib-storage/index/mbox/mbox-storage.c --- a/src/lib-storage/index/mbox/mbox-storage.c Sun Oct 26 19:28:44 2003 +0200 +++ b/src/lib-storage/index/mbox/mbox-storage.c Sun Oct 26 20:05:42 2003 +0200 @@ -871,6 +871,7 @@ mbox_storage_save_next, index_storage_copy_init, index_storage_copy_deinit, + index_storage_copy, mbox_storage_expunge_init, mbox_storage_expunge_deinit, mbox_storage_expunge_fetch_next, diff -r 31e628d88253 -r b2ceea02ba60 src/lib-storage/mail-storage.h --- a/src/lib-storage/mail-storage.h Sun Oct 26 19:28:44 2003 +0200 +++ b/src/lib-storage/mail-storage.h Sun Oct 26 20:05:42 2003 +0200 @@ -325,6 +325,8 @@ struct mail_copy_context *(*copy_init)(struct mailbox *box); /* Finish copying. */ int (*copy_deinit)(struct mail_copy_context *ctx, int rollback); + /* Copy given message. */ + int (*copy)(struct mail *mail, struct mail_copy_context *ctx); /* Initialize expunging operation to this mailbox. If expunge_all is TRUE, all messages are returned rather than just deleted. */ @@ -390,9 +392,6 @@ const struct mail_full_flags *flags, enum modify_type modify_type); - /* Copy this message to another mailbox. */ - int (*copy)(struct mail *mail, struct mail_copy_context *ctx); - /* Expunge this message. Note that the actual message may or may not be really expunged until expunge_deinit() is called. In any case, after this call you must not try to access this mail, or any other diff -r 31e628d88253 -r b2ceea02ba60 src/lib-storage/proxy-mail.c --- a/src/lib-storage/proxy-mail.c Sun Oct 26 19:28:44 2003 +0200 +++ b/src/lib-storage/proxy-mail.c Sun Oct 26 20:05:42 2003 +0200 @@ -69,13 +69,6 @@ return p->mail->update_flags(p->mail, flags, modify_type); } -static int _copy(struct mail *mail, struct mail_copy_context *ctx) -{ - struct proxy_mail *p = (struct proxy_mail *) mail; - - return p->mail->copy(p->mail, ctx); -} - static int _expunge(struct mail *mail, struct mail_expunge_context *ctx, unsigned int *seq_r, int notify) { @@ -101,7 +94,6 @@ pm->get_stream = _get_stream; pm->get_special = _get_special; pm->update_flags = _update_flags; - pm->copy = _copy; pm->expunge = _expunge; }