[dovecot-cvs] dovecot/src/imap cmd-append.c, 1.67, 1.68 cmd-check.c, 1.7, 1.8 cmd-copy.c, 1.30, 1.31 cmd-expunge.c, 1.12, 1.13 cmd-fetch.c, 1.29, 1.30 cmd-idle.c, 1.21, 1.22 cmd-noop.c, 1.5, 1.6 cmd-search.c, 1.25, 1.26 cmd-sort.c, 1.18, 1.19 cmd-store.c, 1.32, 1.33 cmd-thread.c, 1.9, 1.10 imap-sync.c, 1.13, 1.14 imap-sync.h, 1.3, 1.4

cras at dovecot.org cras at dovecot.org
Sun Dec 25 13:24:48 EET 2005


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

Modified Files:
	cmd-append.c cmd-check.c cmd-copy.c cmd-expunge.c cmd-fetch.c 
	cmd-idle.c cmd-noop.c cmd-search.c cmd-sort.c cmd-store.c 
	cmd-thread.c imap-sync.c imap-sync.h 
Log Message:
UID STORE command must return UID parameter in FETCH replies.



Index: cmd-append.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-append.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -r1.67 -r1.68
--- cmd-append.c	25 Dec 2005 10:51:25 -0000	1.67
+++ cmd-append.c	25 Dec 2005 11:24:45 -0000	1.68
@@ -212,7 +212,7 @@
 			0 : MAILBOX_SYNC_FLAG_FAST;
 
 		cmd_append_finish(ctx);
-		return cmd_sync(cmd, sync_flags, "OK Append completed.");
+		return cmd_sync(cmd, sync_flags, 0, "OK Append completed.");
 	}
 
 	if (!validate_args(args, &flags_list, &internal_date_str,

Index: cmd-check.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-check.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- cmd-check.c	5 Feb 2005 18:07:26 -0000	1.7
+++ cmd-check.c	25 Dec 2005 11:24:45 -0000	1.8
@@ -9,5 +9,5 @@
 		return TRUE;
 
 	return cmd_sync(cmd, MAILBOX_SYNC_FLAG_FULL_READ |
-			MAILBOX_SYNC_FLAG_FULL_WRITE, "OK Check completed.");
+			MAILBOX_SYNC_FLAG_FULL_WRITE, 0, "OK Check completed.");
 }

Index: cmd-copy.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-copy.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- cmd-copy.c	7 Oct 2005 09:34:04 -0000	1.30
+++ cmd-copy.c	25 Dec 2005 11:24:45 -0000	1.31
@@ -106,10 +106,10 @@
 	}
 
 	if (ret > 0)
-		return cmd_sync(cmd, sync_flags, "OK Copy completed.");
+		return cmd_sync(cmd, sync_flags, 0, "OK Copy completed.");
 	else if (ret == 0) {
 		/* some messages were expunged, sync them */
-		return cmd_sync(cmd, 0,
+		return cmd_sync(cmd, 0, 0,
 			"NO Some of the requested messages no longer exist.");
 	} else {
 		client_send_storage_error(cmd, storage);

Index: cmd-expunge.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-expunge.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cmd-expunge.c	8 May 2005 10:09:43 -0000	1.12
+++ cmd-expunge.c	25 Dec 2005 11:24:45 -0000	1.13
@@ -29,7 +29,7 @@
 		return TRUE;
 
 	if (imap_expunge(client->mailbox, search_arg))
-		return cmd_sync(cmd, 0, "OK Expunge completed.");
+		return cmd_sync(cmd, 0, 0, "OK Expunge completed.");
 	else {
 		client_send_storage_error(cmd,
 					  mailbox_get_storage(client->mailbox));
@@ -45,7 +45,7 @@
 		return TRUE;
 
 	if (imap_expunge(client->mailbox, NULL))
-		return cmd_sync(cmd, 0, "OK Expunge completed.");
+		return cmd_sync(cmd, 0, 0, "OK Expunge completed.");
 	else {
 		client_send_storage_error(cmd,
 					  mailbox_get_storage(client->mailbox));

Index: cmd-fetch.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-fetch.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- cmd-fetch.c	29 Jul 2005 08:43:04 -0000	1.29
+++ cmd-fetch.c	25 Dec 2005 11:24:45 -0000	1.30
@@ -104,7 +104,7 @@
 	}
 
 	return cmd_sync(cmd, MAILBOX_SYNC_FLAG_FAST |
-			(cmd->uid ? 0 : MAILBOX_SYNC_FLAG_NO_EXPUNGES),
+			(cmd->uid ? 0 : MAILBOX_SYNC_FLAG_NO_EXPUNGES), 0,
 			ok_message);
 }
 

Index: cmd-idle.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-idle.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- cmd-idle.c	25 Dec 2005 10:51:25 -0000	1.21
+++ cmd-idle.c	25 Dec 2005 11:24:45 -0000	1.22
@@ -142,7 +142,7 @@
 		ctx->sync_pending = TRUE;
 	else {
 		ctx->sync_pending = FALSE;
-		ctx->sync_ctx = imap_sync_init(ctx->client, box, 0);
+		ctx->sync_ctx = imap_sync_init(ctx->client, box, 0, 0);
 		cmd_idle_continue(ctx->cmd);
 	}
 }

Index: cmd-noop.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-noop.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- cmd-noop.c	5 Feb 2005 18:07:26 -0000	1.5
+++ cmd-noop.c	25 Dec 2005 11:24:45 -0000	1.6
@@ -5,5 +5,5 @@
 
 int cmd_noop(struct client_command_context *cmd)
 {
-	return cmd_sync(cmd, 0, "OK NOOP completed.");
+	return cmd_sync(cmd, 0, 0, "OK NOOP completed.");
 }

Index: cmd-search.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-search.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- cmd-search.c	11 Sep 2005 13:23:00 -0000	1.25
+++ cmd-search.c	25 Dec 2005 11:24:45 -0000	1.26
@@ -101,7 +101,7 @@
 	} else if (imap_search(cmd, charset, sargs)) {
 		return cmd_sync(cmd, MAILBOX_SYNC_FLAG_FAST |
 				(cmd->uid ? 0 : MAILBOX_SYNC_FLAG_NO_EXPUNGES),
-				"OK Search completed.");
+				0, "OK Search completed.");
 	} else {
 		client_send_storage_error(cmd,
 					  mailbox_get_storage(client->mailbox));

Index: cmd-sort.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-sort.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- cmd-sort.c	5 Feb 2005 18:07:26 -0000	1.18
+++ cmd-sort.c	25 Dec 2005 11:24:45 -0000	1.19
@@ -124,7 +124,7 @@
 		pool_unref(pool);
 		return cmd_sync(cmd, MAILBOX_SYNC_FLAG_FAST |
 				(cmd->uid ? 0 : MAILBOX_SYNC_FLAG_NO_EXPUNGES),
-				"OK Sort completed.");
+				0, "OK Sort completed.");
 	} else {
 		client_send_storage_error(cmd,
 					  mailbox_get_storage(client->mailbox));

Index: cmd-store.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-store.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- cmd-store.c	15 Mar 2005 19:01:51 -0000	1.32
+++ cmd-store.c	25 Dec 2005 11:24:45 -0000	1.33
@@ -124,8 +124,15 @@
 	}
 
 	if (!failed) {
+		/* With UID STORE we have to return UID for the flags as well.
+		   Unfortunately we don't have the ability to separate those
+		   flag changes that were caused by UID STORE and those that
+		   came externally, so we'll just send the UID for all flag
+		   changes that we see. */
 		return cmd_sync(cmd, MAILBOX_SYNC_FLAG_FAST |
 				(cmd->uid ? 0 : MAILBOX_SYNC_FLAG_NO_EXPUNGES),
+				cmd->uid && !silent ?
+				IMAP_SYNC_FLAG_SEND_UID : 0,
 				"OK Store completed.");
 	} else {
 		client_send_storage_error(cmd, mailbox_get_storage(box));

Index: cmd-thread.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-thread.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- cmd-thread.c	5 Feb 2005 18:07:26 -0000	1.9
+++ cmd-thread.c	25 Dec 2005 11:24:45 -0000	1.10
@@ -67,7 +67,7 @@
 		pool_unref(pool);
 		return cmd_sync(cmd, MAILBOX_SYNC_FLAG_FAST |
 				(cmd->uid ? 0 : MAILBOX_SYNC_FLAG_NO_EXPUNGES),
-				"OK Thread completed.");
+				0, "OK Thread completed.");
 	} else {
 		client_send_storage_error(cmd,
 					  mailbox_get_storage(client->mailbox));

Index: imap-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/imap-sync.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- imap-sync.c	15 Oct 2005 20:53:12 -0000	1.13
+++ imap-sync.c	25 Dec 2005 11:24:45 -0000	1.14
@@ -15,6 +15,7 @@
 struct imap_sync_context {
 	struct client *client;
 	struct mailbox *box;
+        enum imap_sync_flags imap_flags;
 
 	struct mailbox_transaction_context *t;
 	struct mailbox_sync_context *sync_ctx;
@@ -30,7 +31,7 @@
 
 struct imap_sync_context *
 imap_sync_init(struct client *client, struct mailbox *box,
-	       enum mailbox_sync_flags flags)
+	       enum imap_sync_flags imap_flags, enum mailbox_sync_flags flags)
 {
 	struct imap_sync_context *ctx;
 	struct mailbox_status status;
@@ -40,6 +41,7 @@
 	ctx = i_new(struct imap_sync_context, 1);
 	ctx->client = client;
 	ctx->box = box;
+	ctx->imap_flags = imap_flags;
 
 	ctx->sync_ctx = mailbox_sync_init(box, flags);
 	ctx->t = mailbox_transaction_begin(box, 0);
@@ -131,8 +133,12 @@
 				keywords = mail_get_keywords(ctx->mail);
 
 				str_truncate(str, 0);
-				str_printfa(str, "* %u FETCH (FLAGS (",
-					    ctx->seq);
+				str_printfa(str, "* %u FETCH (", ctx->seq);
+				if (ctx->imap_flags & IMAP_SYNC_FLAG_SEND_UID) {
+					str_printfa(str, "UID %u ",
+						    ctx->mail->uid);
+				}
+				str_append(str, "FLAGS (");
 				imap_write_flags(str, flags, keywords);
 				str_append(str, "))");
 
@@ -201,7 +207,7 @@
 }
 
 int cmd_sync(struct client_command_context *cmd, enum mailbox_sync_flags flags,
-	     const char *tagline)
+	     enum imap_sync_flags imap_flags, const char *tagline)
 {
         struct cmd_sync_context *ctx;
 
@@ -223,7 +229,7 @@
 	ctx = p_new(cmd->pool, struct cmd_sync_context, 1);
 	ctx->tagline = p_strdup(cmd->pool, tagline);
 	ctx->sync_ctx = imap_sync_init(cmd->client, cmd->client->mailbox,
-				       flags);
+				       imap_flags, flags);
 
 	cmd->func = cmd_sync_continue;
 	cmd->context = ctx;

Index: imap-sync.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/imap-sync.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- imap-sync.h	5 Feb 2005 18:07:26 -0000	1.3
+++ imap-sync.h	25 Dec 2005 11:24:45 -0000	1.4
@@ -1,17 +1,21 @@
 #ifndef __IMAP_SYNC_H
 #define __IMAP_SYNC_H
 
+enum imap_sync_flags {
+	IMAP_SYNC_FLAG_SEND_UID	= 0x01
+};
+
 struct client;
 
 struct imap_sync_context *
 imap_sync_init(struct client *client, struct mailbox *box,
-	       enum mailbox_sync_flags flags);
+	       enum imap_sync_flags imap_flags, enum mailbox_sync_flags flags);
 int imap_sync_deinit(struct imap_sync_context *ctx);
 int imap_sync_more(struct imap_sync_context *ctx);
 
 int imap_sync_nonselected(struct mailbox *box, enum mailbox_sync_flags flags);
 
 int cmd_sync(struct client_command_context *cmd, enum mailbox_sync_flags flags,
-	     const char *tagline);
+	     enum imap_sync_flags imap_flags, const char *tagline);
 
 #endif



More information about the dovecot-cvs mailing list