diff src/dsync/dsync-brain.c @ 9644:16849c0931be HEAD

dsync: Handle missing mail GUIDs.
author Timo Sirainen <tss@iki.fi>
date Fri, 17 Jul 2009 20:11:05 -0400
parents fb91695ec0bf
children 4d5cc6ce68aa
line wrap: on
line diff
--- a/src/dsync/dsync-brain.c	Fri Jul 17 20:09:22 2009 -0400
+++ b/src/dsync/dsync-brain.c	Fri Jul 17 20:11:05 2009 -0400
@@ -225,6 +225,8 @@
 
 	buffer_create_data(&guid_128_buf, dest, dest_len);
 	mail_generate_guid_128_hash(guid, guid_128);
+	if (mail_guid_128_is_empty(guid_128))
+		return "";
 	binary_to_hex_append(&guid_128_buf, guid_128, sizeof(guid_128));
 	buffer_append_c(&guid_128_buf, '\0');
 	return guid_128_buf.data;
@@ -274,8 +276,12 @@
 		return 0;
 	}
 
-	/* UIDs match, but do GUIDs? */
-	if (strcmp(src_guid, dest_guid) != 0) {
+	/* UIDs match, but do GUIDs? If either of the GUIDs aren't set, it
+	   means that either the storage doesn't support GUIDs or we're
+	   handling an old-style expunge record. In that case just assume
+	   they match. */
+	if (strcmp(src_guid, dest_guid) != 0 &&
+	    *src_guid != '\0' && *dest_guid != '\0') {
 		/* UID conflict. give new UIDs to messages in both src and
 		   dest (if they're not expunged already) */
 		sync->uid_conflict = TRUE;