Nothing used them in the 3 years since they were introduced.
struct mail_save_data *mdata = &ctx->ctx.data;
enum mail_flags save_flags;
- if ((ctx->ctx.transaction->flags & MAILBOX_TRANSACTION_FLAG_FILL_IN_STUB) == 0)
- mail_index_append(ctx->trans, mdata->uid, &ctx->seq);
- else
- ctx->seq = mdata->stub_seq;
-
save_flags = mdata->flags & ~MAIL_RECENT;
+ mail_index_append(ctx->trans, mdata->uid, &ctx->seq);
mail_index_update_flags(ctx->trans, ctx->seq, MODIFY_REPLACE,
save_flags);
if (mdata->keywords != NULL) {
return ret;
}
-int sdbox_file_assign_uid(struct sdbox_file *file, uint32_t uid,
- bool ignore_if_exists)
+int sdbox_file_assign_uid(struct sdbox_file *file, uint32_t uid)
{
const char *p, *old_path, *dir, *new_fname, *new_path;
struct stat st;
new_fname = t_strdup_printf(SDBOX_MAIL_FILE_FORMAT, uid);
new_path = t_strdup_printf("%s/%s", dir, new_fname);
- if (!ignore_if_exists && stat(new_path, &st) == 0) {
+ if (stat(new_path, &st) == 0) {
mailbox_set_critical(&file->mbox->box,
"sdbox: %s already exists, rebuilding index", new_path);
sdbox_set_mailbox_corrupted(&file->mbox->box);
sdbox_file_attachment_relpath(struct sdbox_file *file, const char *srcpath);
/* Assign UID for a newly created file (by renaming it) */
-int sdbox_file_assign_uid(struct sdbox_file *file, uint32_t uid,
- bool ignore_if_exists);
+int sdbox_file_assign_uid(struct sdbox_file *file, uint32_t uid);
int sdbox_file_create_fd(struct dbox_file *file, const char *path,
bool parents);
ret = seq_range_array_iter_nth(&iter, n++, &uid);
i_assert(ret);
- if (sdbox_file_assign_uid(sfile, uid, FALSE) < 0)
+ if (sdbox_file_assign_uid(sfile, uid) < 0)
return -1;
if (ctx->ctx.highest_pop3_uidl_seq == i+1) {
index_pop3_uidl_set_max_uid(&ctx->mbox->box,
return 0;
}
-static int dbox_save_assign_stub_uids(struct sdbox_save_context *ctx)
-{
- struct dbox_file *const *files;
- unsigned int i, count;
-
- files = array_get(&ctx->files, &count);
- for (i = 0; i < count; i++) {
- struct sdbox_file *sfile = (struct sdbox_file *)files[i];
- uint32_t uid;
-
- mail_index_lookup_uid(ctx->ctx.trans->view,
- ctx->first_saved_seq + i, &uid);
- i_assert(uid != 0);
-
- if (sdbox_file_assign_uid(sfile, uid, TRUE) < 0)
- return -1;
- }
-
- return 0;
-}
-
static void dbox_save_unref_files(struct sdbox_save_context *ctx)
{
struct dbox_file **files;
dbox_save_update_header_flags(&ctx->ctx, ctx->sync_ctx->sync_view,
ctx->mbox->hdr_ext_id, offsetof(struct sdbox_index_header, flags));
+ /* assign UIDs for new messages */
hdr = mail_index_get_header(ctx->sync_ctx->sync_view);
-
- if ((_ctx->transaction->flags & MAILBOX_TRANSACTION_FLAG_FILL_IN_STUB) == 0) {
- /* assign UIDs for new messages */
- mail_index_append_finish_uids(ctx->ctx.trans, hdr->next_uid,
- &_t->changes->saved_uids);
- if (dbox_save_assign_uids(ctx, &_t->changes->saved_uids) < 0) {
- sdbox_transaction_save_rollback(_ctx);
- return -1;
- }
- } else {
- /* assign UIDs that we stashed away */
- if (dbox_save_assign_stub_uids(ctx) < 0) {
- sdbox_transaction_save_rollback(_ctx);
- return -1;
- }
+ mail_index_append_finish_uids(ctx->ctx.trans, hdr->next_uid,
+ &_t->changes->saved_uids);
+ if (dbox_save_assign_uids(ctx, &_t->changes->saved_uids) < 0) {
+ sdbox_transaction_save_rollback(_ctx);
+ return -1;
}
_t->changes->uid_validity = hdr->uid_validity;
.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_STUBS,
+ MAIL_STORAGE_CLASS_FLAG_BINARY_DATA,
.event_category = &event_category_sdbox,
.v = {
/* Storage deletes all files internally - mailbox list's
delete_mailbox() shouldn't delete anything itself. */
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 {
time_t received_date, save_date;
int received_tz_offset;
- uint32_t uid, stub_seq;
+ uint32_t uid;
char *guid, *pop3_uidl, *from_envelope;
uint32_t pop3_order;
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 || box->mailbox_undeleting)
return -1;
{
struct mailbox_transaction_context *trans;
- i_assert((flags & MAILBOX_TRANSACTION_FLAG_FILL_IN_STUB) == 0 ||
- (box->flags & MAILBOX_FLAG_USE_STUBS) != 0);
-
i_assert(box->opened);
box->transaction_count++;
void mailbox_save_set_uid(struct mail_save_context *ctx, uint32_t uid)
{
ctx->data.uid = uid;
- if ((ctx->transaction->flags & MAILBOX_TRANSACTION_FLAG_FILL_IN_STUB) != 0) {
- if (!mail_index_lookup_seq(ctx->transaction->view, uid,
- &ctx->data.stub_seq))
- i_panic("Trying to fill in stub for nonexistent UID %u", uid);
- }
}
void mailbox_save_set_guid(struct mail_save_context *ctx, const char *guid)
return -1;
}
- /* if we're filling in a stub, we must have set UID already
- (which in turn sets stub_seq) */
- i_assert(((*ctx)->transaction->flags & MAILBOX_TRANSACTION_FLAG_FILL_IN_STUB) == 0 ||
- (*ctx)->data.stub_seq != 0);
-
/* make sure parts get parsed early on */
const struct mail_storage_settings *mail_set =
mailbox_get_settings(box);
quota updates (possibly resulting in broken quota). and This is
useful for example when deleting entire user accounts. */
MAILBOX_FLAG_DELETE_UNSAFE = 0x400,
- /* Mailbox is used for caching purposes. Some of the mails may be
- stubs, which exist in the index but that don't have a mail body.
- The backend shouldn't treat it as corruption if a mail body isn't
- found. */
- MAILBOX_FLAG_USE_STUBS = 0x800,
/* Mailbox is created implicitly if it does not exist. */
MAILBOX_FLAG_AUTO_CREATE = 0x1000,
/* Mailbox is subscribed to implicitly when it is created automatically */
especially means the notify plugin. This would normally be used only
with _FLAG_SYNC. */
MAILBOX_TRANSACTION_FLAG_NO_NOTIFY = 0x40,
- /* Append fills in an existing stub mail for the specified UID,
- instead of saving a new mail. This requires mailbox to be opened
- with MAILBOX_FLAG_USE_STUBS. */
- MAILBOX_TRANSACTION_FLAG_FILL_IN_STUB = 0x80,
};
enum mailbox_sync_flags {