Mercurial > dovecot > core-2.2
changeset 21362:ef9c844a24bd
index-storage: Update mailbox last_rename_stamp on rename
author | Aki Tuomi <aki.tuomi@dovecot.fi> |
---|---|
date | Wed, 28 Dec 2016 22:45:22 +0200 |
parents | 8902229240d5 |
children | cf8705ec586c |
files | src/lib-storage/index/index-storage.c src/lib-storage/mail-storage-private.h |
diffstat | 2 files changed, 18 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/index-storage.c Tue Dec 27 15:03:51 2016 -0500 +++ b/src/lib-storage/index/index-storage.c Wed Dec 28 22:45:22 2016 +0200 @@ -299,6 +299,10 @@ box->box_name_hdr_ext_id = mail_index_ext_register(box->index, "box-name", 0, 0, 0); + box->box_last_rename_stamp_ext_id = + mail_index_ext_register(box->index, "last-rename-stamp", + sizeof(uint32_t), 0, sizeof(uint32_t)); + box->opened = TRUE; if ((box->enabled_features & MAILBOX_FEATURE_CONDSTORE) != 0) @@ -794,6 +798,19 @@ return -1; } + if (mailbox_open(dest) == 0) { + struct mail_index_transaction *t = + mail_index_transaction_begin(dest->view, 0); + + uint32_t stamp = ioloop_time; + + mail_index_update_header_ext(t, dest->box_last_rename_stamp_ext_id, + 0, &stamp, sizeof(stamp)); + + /* can't do much if this fails anyways */ + (void)mail_index_transaction_commit(&t); + } + /* we'll track mailbox names, instead of GUIDs. We may be renaming a non-selectable mailbox (directory), which doesn't even have a GUID */ mailbox_name_get_sha128(dest->vname, guid);
--- a/src/lib-storage/mail-storage-private.h Tue Dec 27 15:03:51 2016 -0500 +++ b/src/lib-storage/mail-storage-private.h Wed Dec 28 22:45:22 2016 +0200 @@ -361,6 +361,7 @@ uint32_t vsize_hdr_ext_id; uint32_t pop3_uidl_hdr_ext_id; uint32_t box_name_hdr_ext_id; + uint32_t box_last_rename_stamp_ext_id; /* MAIL_RECENT flags handling */ ARRAY_TYPE(seq_range) recent_flags;