.chr = 'B',
.required_keys = "mailbox_guid uid_validity uid_next messages_count "
"first_recent_uid highest_modseq highest_pvt_modseq",
- .optional_keys = "mailbox_lost cache_fields have_guids have_save_guids"
+ .optional_keys = "mailbox_lost cache_fields have_guids have_save_guids have_only_guid128"
},
{ .name = "mailbox_attribute",
.chr = 'A',
dsync_serializer_encode_add(encoder, "have_guids", "");
if (dsync_box->have_save_guids)
dsync_serializer_encode_add(encoder, "have_save_guids", "");
+ if (dsync_box->have_only_guid128)
+ dsync_serializer_encode_add(encoder, "have_only_guid128", "");
dsync_serializer_encode_add(encoder, "uid_validity",
dec2str(dsync_box->uid_validity));
dsync_serializer_encode_add(encoder, "uid_next",
if (dsync_deserializer_decode_try(decoder, "have_save_guids", &value) ||
(box->have_guids && ibc->minor_version < DSYNC_PROTOCOL_MINOR_HAVE_SAVE_GUID))
box->have_save_guids = TRUE;
+ if (dsync_deserializer_decode_try(decoder, "have_only_guid128", &value))
+ box->have_only_guid128 = TRUE;
value = dsync_deserializer_decode_get(decoder, "uid_validity");
if (str_to_uint32(value, &box->uid_validity) < 0) {
dsync_ibc_input_error(ibc, decoder, "Invalid uid_validity");
unsigned int master_brain:1;
unsigned int revert_local_changes:1;
unsigned int mails_have_guids:1;
+ unsigned int mails_use_guid128:1;
};
static void dsync_mailbox_save_newmails(struct dsync_mailbox_importer *importer,
importer->debug = (flags & DSYNC_MAILBOX_IMPORT_FLAG_DEBUG) != 0;
importer->mails_have_guids =
(flags & DSYNC_MAILBOX_IMPORT_FLAG_MAILS_HAVE_GUIDS) != 0;
+ importer->mails_use_guid128 =
+ (flags & DSYNC_MAILBOX_IMPORT_FLAG_MAILS_USE_GUID128) != 0;
mailbox_get_open_status(importer->box, STATUS_UIDNEXT |
STATUS_HIGHESTMODSEQ | STATUS_HIGHESTPVTMODSEQ,
}
static bool
-dsync_mail_change_guid_equals(const struct dsync_mail_change *change,
+dsync_mail_change_guid_equals(struct dsync_mailbox_importer *importer,
+ const struct dsync_mail_change *change,
const char *guid, const char **cmp_guid_r)
{
guid_128_t guid_128, change_guid_128;
- if (change->type != DSYNC_MAIL_CHANGE_TYPE_EXPUNGE) {
+ if (change->type != DSYNC_MAIL_CHANGE_TYPE_EXPUNGE &&
+ !importer->mails_use_guid128) {
if (cmp_guid_r != NULL)
*cmp_guid_r = change->guid;
return strcmp(change->guid, guid) == 0;
mail_generate_guid_128_hash(guid, guid_128);
if (memcmp(change_guid_128, guid_128, GUID_128_SIZE) != 0) {
if (cmp_guid_r != NULL) {
- *cmp_guid_r = t_strdup_printf("%s(expunged, orig=%s)",
+ *cmp_guid_r = t_strdup_printf("%s(guid128, orig=%s)",
binary_to_hex(change_guid_128, sizeof(change_guid_128)),
change->guid);
}
dsync_mail_error(importer, importer->mail, "GUID");
return FALSE;
}
- if (!dsync_mail_change_guid_equals(change, guid, &cmp_guid)) {
+ if (!dsync_mail_change_guid_equals(importer, change, guid, &cmp_guid)) {
dsync_import_unexpected_state(importer, t_strdup_printf(
"Unexpected GUID mismatch for UID=%u: %s != %s",
change->uid, guid, cmp_guid));
if (change->guid == NULL || change->guid[0] == '\0' ||
importer->cur_guid[0] == '\0')
return TRUE;
- if (!dsync_mail_change_guid_equals(change, importer->cur_guid, &cmp_guid)) {
+ if (!dsync_mail_change_guid_equals(importer, change,
+ importer->cur_guid, &cmp_guid)) {
dsync_import_unexpected_state(importer, t_strdup_printf(
"Unexpected GUID mismatch (2) for UID=%u: %s != %s",
change->uid, importer->cur_guid, cmp_guid));
if (*change->guid != '\0' && *importer->cur_guid != '\0') {
/* we have GUIDs, verify them */
- if (dsync_mail_change_guid_equals(change, importer->cur_guid, NULL))
+ if (dsync_mail_change_guid_equals(importer, change,
+ importer->cur_guid, NULL))
return 1;
else
return 0;
return FALSE;
i_assert(local_change->type == DSYNC_MAIL_CHANGE_TYPE_EXPUNGE);
- if (dsync_mail_change_guid_equals(local_change, change->guid, NULL))
+ if (dsync_mail_change_guid_equals(importer, local_change,
+ change->guid, NULL))
importer->last_common_uid = change->uid;
else if (change->type != DSYNC_MAIL_CHANGE_TYPE_EXPUNGE)
dsync_mailbox_common_uid_found(importer);