[dovecot-cvs] dovecot/src/imap cmd-copy.c,1.29,1.30

cras at dovecot.org cras at dovecot.org
Fri Oct 7 12:34:06 EEST 2005


Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv4310/imap

Modified Files:
	cmd-copy.c 
Log Message:
Added flags and keywords parameters to mailbox_copy() in case they're wanted
to be changed while copying.



Index: cmd-copy.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-copy.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- cmd-copy.c	29 Mar 2005 13:33:08 -0000	1.29
+++ cmd-copy.c	7 Oct 2005 09:34:04 -0000	1.30
@@ -11,6 +11,8 @@
 {
 	struct mail_search_context *search_ctx;
         struct mailbox_transaction_context *src_trans;
+	struct mail_keywords *keywords;
+	const char *const *keywords_list;
 	struct mail *mail;
 	int ret;
 
@@ -20,15 +22,19 @@
 	mail = mail_alloc(src_trans, MAIL_FETCH_STREAM_HEADER |
 			  MAIL_FETCH_STREAM_BODY, NULL);
 	ret = 1;
-	while (mailbox_search_next(search_ctx, mail) > 0) {
+	while (mailbox_search_next(search_ctx, mail) > 0 && ret > 0) {
 		if (mail->expunged) {
 			ret = 0;
 			break;
 		}
-		if (mailbox_copy(t, mail, NULL) < 0) {
+
+		keywords_list = mail_get_keywords(mail);
+		keywords = strarray_length(keywords_list) == 0 ? NULL :
+			mailbox_keywords_create(t, keywords_list);
+		if (mailbox_copy(t, mail, mail_get_flags(mail),
+				 keywords, NULL) < 0)
 			ret = -1;
-			break;
-		}
+		mailbox_keywords_free(t, keywords);
 	}
 	mail_free(mail);
 



More information about the dovecot-cvs mailing list