.class_flags = MAIL_STORAGE_CLASS_FLAG_FILE_PER_MSG |
MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUIDS |
MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_SAVE_GUIDS |
- MAIL_STORAGE_CLASS_FLAG_BINARY_DATA,
+ MAIL_STORAGE_CLASS_FLAG_BINARY_DATA |
+ MAIL_STORAGE_CLASS_FLAG_STUBS,
.v = {
NULL,
MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUID128 = 0x200,
/* Storage deletes all files internally - mailbox list's
delete_mailbox() shouldn't delete anything itself. */
- MAIL_STORAGE_CLASS_FLAG_NO_LIST_DELETES = 0x400
+ MAIL_STORAGE_CLASS_FLAG_NO_LIST_DELETES = 0x400,
+ /* Storage supports stubs (used for caching purposes). */
+ MAIL_STORAGE_CLASS_FLAG_STUBS = 0x800,
};
struct mail_binary_cache {
int mailbox_open(struct mailbox *box)
{
+ /* check that the storage supports stubs if require them */
+ if (((box->flags & MAILBOX_FLAG_USE_STUBS) != 0) &&
+ ((box->storage->storage_class->class_flags & MAIL_STORAGE_CLASS_FLAG_STUBS) == 0)) {
+ mail_storage_set_error(box->storage, MAIL_ERROR_NOTPOSSIBLE,
+ "Mailbox does not support mail stubs");
+ return -1;
+ }
+
if (mailbox_open_full(box, NULL) < 0) {
if (!box->mailbox_deleted)
return -1;