[dovecot-cvs] dovecot/src/imap cmd-append.c, 1.56, 1.57 cmd-copy.c, 1.27, 1.28 cmd-status.c, 1.21, 1.22 commands-util.c, 1.41, 1.42 commands-util.h, 1.21, 1.22

cras at dovecot.org cras at dovecot.org
Tue Mar 15 23:52:09 EET 2005


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

Modified Files:
	cmd-append.c cmd-copy.c cmd-status.c commands-util.c 
	commands-util.h 
Log Message:
mailbox_name_equals() renamed to mailbox_equals(), which also now checks
that mail storages match. Fixes problems with copying messages from one
namespace to another between identically named mailboxes.



Index: cmd-append.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-append.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- cmd-append.c	15 Mar 2005 19:01:51 -0000	1.56
+++ cmd-append.c	15 Mar 2005 21:52:07 -0000	1.57
@@ -356,7 +356,7 @@
 		return NULL;
 
 	if (cmd->client->mailbox != NULL &&
-	    mailbox_name_equals(mailbox_get_name(cmd->client->mailbox), name))
+	    mailbox_equals(cmd->client->mailbox, storage, name))
 		return cmd->client->mailbox;
 
 	box = mailbox_open(storage, name, MAILBOX_OPEN_FAST |

Index: cmd-copy.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-copy.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- cmd-copy.c	15 Mar 2005 19:01:51 -0000	1.27
+++ cmd-copy.c	15 Mar 2005 21:52:07 -0000	1.28
@@ -71,7 +71,7 @@
 	if (storage == NULL)
 		return TRUE;
 
-	if (mailbox_name_equals(mailbox_get_name(client->mailbox), mailbox))
+	if (mailbox_equals(client->mailbox, storage, mailbox))
 		destbox = client->mailbox;
 	else {
 		destbox = mailbox_open(storage, mailbox, MAILBOX_OPEN_FAST |

Index: cmd-status.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-status.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- cmd-status.c	5 Feb 2005 18:07:26 -0000	1.21
+++ cmd-status.c	15 Mar 2005 21:52:07 -0000	1.22
@@ -53,7 +53,7 @@
 	int failed;
 
 	if (client->mailbox != NULL &&
-	    mailbox_name_equals(mailbox_get_name(client->mailbox), mailbox)) {
+	    mailbox_equals(client->mailbox, storage, mailbox)) {
 		/* this mailbox is selected */
 		box = client->mailbox;
 	} else {

Index: commands-util.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/commands-util.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- commands-util.c	5 Feb 2005 18:07:26 -0000	1.41
+++ commands-util.c	15 Mar 2005 21:52:07 -0000	1.42
@@ -310,12 +310,21 @@
 		dest->keywords[i] = p_strdup(dest->pool, keywords[i]);
 }
 
-int mailbox_name_equals(const char *box1, const char *box2)
+int mailbox_equals(struct mailbox *box1, struct mail_storage *storage2,
+		   const char *name2)
 {
-	if (strcmp(box1, box2) == 0)
+	struct mail_storage *storage1 = mailbox_get_storage(box1);
+	const char *name1;
+
+	if (storage1 != storage2)
+		return FALSE;
+
+        name1 = mailbox_get_name(box1);
+	if (strcmp(name1, name2) == 0)
 		return TRUE;
 
-	return strcasecmp(box1, "INBOX") == 0 && strcasecmp(box2, "INBOX") == 0;
+	return strcasecmp(name1, "INBOX") == 0 &&
+		strcasecmp(name2, "INBOX") == 0;
 }
 
 void msgset_generator_init(struct msgset_generator_context *ctx, string_t *str)

Index: commands-util.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/commands-util.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- commands-util.h	5 Feb 2005 18:07:26 -0000	1.21
+++ commands-util.h	15 Mar 2005 21:52:07 -0000	1.22
@@ -52,7 +52,8 @@
 			  const char *const keywords[],
 			  unsigned int keywords_count);
 
-int mailbox_name_equals(const char *box1, const char *box2);
+int mailbox_equals(struct mailbox *box1, struct mail_storage *storage2,
+		   const char *name2);
 
 void msgset_generator_init(struct msgset_generator_context *ctx, string_t *str);
 void msgset_generator_next(struct msgset_generator_context *ctx, uint32_t uid);



More information about the dovecot-cvs mailing list