From: Timo Sirainen Date: Thu, 24 Nov 2016 13:50:01 +0000 (+0200) Subject: lib-storage: Add mail_storage.list_index_corrupted() X-Git-Tag: 2.3.0.rc1~2514 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=857c471c13ca215f4be9dd4b336b742b8d434e31;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Add mail_storage.list_index_corrupted() The actual implementation is in the next commit. --- diff --git a/src/lib-storage/fail-mail-storage.c b/src/lib-storage/fail-mail-storage.c index 5ad7a6c7f2..36cf2b6bee 100644 --- a/src/lib-storage/fail-mail-storage.c +++ b/src/lib-storage/fail-mail-storage.c @@ -44,7 +44,8 @@ struct mail_storage fail_storage = { fail_storage_get_list_settings, NULL, fail_mailbox_alloc, - NULL + NULL, + NULL, } }; diff --git a/src/lib-storage/index/cydir/cydir-storage.c b/src/lib-storage/index/cydir/cydir-storage.c index 17f9f5be20..e2666a9172 100644 --- a/src/lib-storage/index/cydir/cydir-storage.c +++ b/src/lib-storage/index/cydir/cydir-storage.c @@ -122,7 +122,8 @@ struct mail_storage cydir_storage = { cydir_storage_get_list_settings, NULL, cydir_mailbox_alloc, - NULL + NULL, + NULL, } }; diff --git a/src/lib-storage/index/dbox-multi/mdbox-deleted-storage.c b/src/lib-storage/index/dbox-multi/mdbox-deleted-storage.c index 605084c331..7cb906c78a 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-deleted-storage.c +++ b/src/lib-storage/index/dbox-multi/mdbox-deleted-storage.c @@ -258,7 +258,8 @@ struct mail_storage mdbox_deleted_storage = { dbox_storage_get_list_settings, NULL, mdbox_deleted_mailbox_alloc, - NULL + NULL, + NULL, } }; diff --git a/src/lib-storage/index/dbox-multi/mdbox-storage.c b/src/lib-storage/index/dbox-multi/mdbox-storage.c index 5d8d8cd8df..8a5e9f51b5 100644 --- a/src/lib-storage/index/dbox-multi/mdbox-storage.c +++ b/src/lib-storage/index/dbox-multi/mdbox-storage.c @@ -456,7 +456,8 @@ struct mail_storage mdbox_storage = { dbox_storage_get_list_settings, mdbox_storage_autodetect, mdbox_mailbox_alloc, - mdbox_purge + mdbox_purge, + NULL, } }; diff --git a/src/lib-storage/index/dbox-single/sdbox-storage.c b/src/lib-storage/index/dbox-single/sdbox-storage.c index 2c4ce1d730..dbb85ff586 100644 --- a/src/lib-storage/index/dbox-single/sdbox-storage.c +++ b/src/lib-storage/index/dbox-single/sdbox-storage.c @@ -417,7 +417,8 @@ struct mail_storage sdbox_storage = { dbox_storage_get_list_settings, sdbox_storage_autodetect, sdbox_mailbox_alloc, - NULL + NULL, + NULL, } }; @@ -434,7 +435,8 @@ struct mail_storage dbox_storage = { dbox_storage_get_list_settings, sdbox_storage_autodetect, sdbox_mailbox_alloc, - NULL + NULL, + NULL, } }; diff --git a/src/lib-storage/index/imapc/imapc-storage.c b/src/lib-storage/index/imapc/imapc-storage.c index d03659b77b..d63db3f380 100644 --- a/src/lib-storage/index/imapc/imapc-storage.c +++ b/src/lib-storage/index/imapc/imapc-storage.c @@ -1101,7 +1101,8 @@ struct mail_storage imapc_storage = { imapc_storage_get_list_settings, NULL, imapc_mailbox_alloc, - NULL + NULL, + NULL, } }; diff --git a/src/lib-storage/index/maildir/maildir-storage.c b/src/lib-storage/index/maildir/maildir-storage.c index e294d270ba..c312c7112e 100644 --- a/src/lib-storage/index/maildir/maildir-storage.c +++ b/src/lib-storage/index/maildir/maildir-storage.c @@ -678,7 +678,8 @@ struct mail_storage maildir_storage = { maildir_storage_get_list_settings, maildir_storage_autodetect, maildir_mailbox_alloc, - NULL + NULL, + NULL, } }; diff --git a/src/lib-storage/index/mbox/mbox-storage.c b/src/lib-storage/index/mbox/mbox-storage.c index 011714fb7b..8df1e2f055 100644 --- a/src/lib-storage/index/mbox/mbox-storage.c +++ b/src/lib-storage/index/mbox/mbox-storage.c @@ -821,7 +821,8 @@ struct mail_storage mbox_storage = { mbox_storage_get_list_settings, mbox_storage_autodetect, mbox_mailbox_alloc, - NULL + NULL, + NULL, } }; diff --git a/src/lib-storage/index/pop3c/pop3c-storage.c b/src/lib-storage/index/pop3c/pop3c-storage.c index cad4549ee8..490cef1c75 100644 --- a/src/lib-storage/index/pop3c/pop3c-storage.c +++ b/src/lib-storage/index/pop3c/pop3c-storage.c @@ -309,7 +309,8 @@ struct mail_storage pop3c_storage = { pop3c_storage_get_list_settings, NULL, pop3c_mailbox_alloc, - NULL + NULL, + NULL, } }; diff --git a/src/lib-storage/index/raw/raw-storage.c b/src/lib-storage/index/raw/raw-storage.c index 3e833a6ed2..86a46795d3 100644 --- a/src/lib-storage/index/raw/raw-storage.c +++ b/src/lib-storage/index/raw/raw-storage.c @@ -214,7 +214,8 @@ struct mail_storage raw_storage = { raw_storage_get_list_settings, NULL, raw_mailbox_alloc, - NULL + NULL, + NULL, } }; diff --git a/src/lib-storage/index/shared/shared-storage.c b/src/lib-storage/index/shared/shared-storage.c index ea87a78975..8aa53dd46e 100644 --- a/src/lib-storage/index/shared/shared-storage.c +++ b/src/lib-storage/index/shared/shared-storage.c @@ -375,6 +375,7 @@ struct mail_storage shared_storage = { shared_storage_get_list_settings, NULL, fail_mailbox_alloc, - NULL + NULL, + NULL, } }; diff --git a/src/lib-storage/mail-storage-private.h b/src/lib-storage/mail-storage-private.h index 74da77c20a..5a74327cee 100644 --- a/src/lib-storage/mail-storage-private.h +++ b/src/lib-storage/mail-storage-private.h @@ -48,6 +48,11 @@ struct mail_storage_vfuncs { const char *vname, enum mailbox_flags flags); int (*purge)(struct mail_storage *storage); + /* Called when mailbox list index corruption has been detected. + The callback should add any missing mailboxes to the list index. + Returns 0 on success, -1 on temporary failure that didn't properly + fix the index. */ + int (*list_index_corrupted)(struct mail_storage *storage); }; union mail_storage_module_context { diff --git a/src/plugins/virtual/virtual-storage.c b/src/plugins/virtual/virtual-storage.c index 0e34953d6a..9fcbfd53a7 100644 --- a/src/plugins/virtual/virtual-storage.c +++ b/src/plugins/virtual/virtual-storage.c @@ -777,7 +777,8 @@ struct mail_storage virtual_storage = { virtual_storage_get_list_settings, NULL, virtual_mailbox_alloc, - NULL + NULL, + NULL, } };