index-sync-pvt.c revision ad58254389ac8f9af6076a6ec1df97dd3f90b21f
/* Copyright (c) 2013 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "mailbox-list-private.h"
#include "index-sync-private.h"
struct index_mailbox_sync_pvt_context {
struct mail_index_sync_ctx *sync_ctx;
struct mail_index_view *view_pvt;
struct mail_index_transaction *trans_pvt;
struct mail_index_view *view_shared;
};
{
if (uid_pvt == uid_shared) {
seq_pvt++;
seq_shared++;
} else if (uid_pvt < uid_shared) {
/* message expunged */
seq_pvt++;
} else {
"%s: Message UID=%u unexpectedly inserted to mailbox",
return -1;
}
}
return 0;
}
static void
{
const struct mail_index_record *old_rec;
}
if (array_count(keywords) > 0) {
struct mail_keywords *kw;
keywords);
MODIFY_ADD, kw);
}
}
static void
{
const struct mail_index_record *rec;
}
static int
{
/* open a view for the latest version of the index */
return -1;
}
return 0;
}
static int
{
if (index_mailbox_sync_view_refresh(ctx) < 0)
return -1;
/* the mailbox hasn't been fully created yet,
no need for a private index yet */
return 0;
}
/* no new or expunged mails, don't bother syncing */
return 0;
}
return -1;
}
/* refresh once more now that we're locked */
if (index_mailbox_sync_view_refresh(ctx) < 0)
return -1;
return 1;
}
struct index_mailbox_sync_pvt_context **ctx_r)
{
struct index_mailbox_sync_pvt_context *ctx;
int ret;
return ret;
if (lock) {
return -1;
}
}
return 1;
}
static int
const struct mail_save_private_changes *pvt_changes,
unsigned int pvt_changes_count)
{
unsigned int pc_idx = 0;
int ret;
return ret;
}
/* same mailbox. expunge messages from private index that
no longer exist. */
if (sync_pvt_expunges(ctx) < 0) {
}
}
/* for public namespaces copy the initial private flags from the shared
index. this allows Sieve scripts to set the initial flags. */
if (!reset) {
&seq_shared, &seq2)) {
/* no new messages */
}
} else {
seq_shared = 1;
}
uid = 0;
if (preserve_old_flags &&
/* copy flags from the original private index */
} else if (copy_shared_flags) {
}
while (pc_idx < pvt_changes_count &&
}
pc_idx++;
}
}
}
return ret;
}
static int
const struct mail_save_private_changes *c2)
{
return -1;
return 1;
return 0;
}
struct mailbox_transaction_context *trans)
{
struct mail_save_private_changes *pvt_changes;
struct seq_range_iter iter;
unsigned int i, n, pvt_count;
if (index_mailbox_sync_view_refresh(ctx) < 0)
return -1;
/* translate mail numbers to UIDs */
n = i = 0;
if (pvt_changes[i].mailnum == n) {
i++;
}
n++;
}
/* sort the changes by UID */
/* add new mails to the private index with the private flags */
}
{
struct mail_index_view_sync_ctx *view_sync_ctx;
struct mail_index_view_sync_rec sync_rec;
bool delayed_expunges;
return -1;
/* sync the private view */
continue;
/* *_updates contains ctx->box->view sequences (not view_pvt
sequences) */
} else {
}
}
}
return -1;
return 0;
}
{
}