mail-index-sync.c revision 5a24a68a727ea4c5a13fc2dee686b001ef08db80
/* Copyright (C) 2003-2004 Timo Sirainen */
#include "lib.h"
#include "buffer.h"
#include "mail-index-view-private.h"
#include "mail-index-sync-private.h"
#include "mail-transaction-log.h"
#include "mail-transaction-util.h"
#include <stdlib.h>
{
const struct mail_transaction_flag_update *dest;
size_t i, dest_count;
return;
dest_count /= sizeof(*dest);
new_update = *src;
/* insert it into buffer, split it in multiple parts if needed
to make sure the ordering stays the same */
for (; i < dest_count; i++) {
continue;
break;
/* partial */
&new_update, sizeof(new_update));
dest_count++;
}
&new_update, sizeof(new_update));
dest_count++;
}
}
{
case MAIL_TRANSACTION_EXPUNGE:
} else {
}
break;
} else {
}
break;
case MAIL_TRANSACTION_APPEND:
break;
}
}
{
int ret;
}
return ret;
}
{
/* already synced */
return 0;
}
return 1;
}
struct mail_index_sync_ctx **ctx_r,
struct mail_index_view **view_r,
{
struct mail_index_sync_ctx *ctx;
unsigned int lock_id;
return -1;
return -1;
}
return -1;
}
return 0;
}
MAIL_TRANSACTION_TYPE_MASK) < 0) {
return -1;
}
/* we need to have all the transactions sorted to optimize
caller's mailbox access patterns */
if (mail_index_sync_read_and_sort(ctx) < 0) {
return -1;
}
return 1;
}
void
const struct mail_transaction_expunge *exp)
{
}
void
const struct mail_transaction_flag_update *update)
{
sizeof(rec->add_keywords));
sizeof(rec->remove_keywords));
}
struct mail_index_sync_rec *rec)
{
"Broken UID range: %u..%u (type 0x%x)",
return FALSE;
}
break;
break;
}
return TRUE;
}
struct mail_index_sync_rec *sync_rec)
{
const struct mail_transaction_expunge *next_exp;
const struct mail_transaction_flag_update *next_update;
// FIXME: return dirty flagged records as flag updates
/* the ugliness here is to avoid returning overlapping expunge
and update areas. For example:
updates[] = A { 1, 7 }, B { 1, 3 }
expunges[] = { 5, 6 }
will make us return
update A: 1, 4
update B: 1, 3
expunge : 5, 6
update A: 7, 7
*/
while (next_update != NULL &&
/* it's overlapping.. */
}
ctx->update_idx++;
}
break;
next_update++;
}
return -1;
ctx->expunge_idx++;
/* scan updates again from the beginning */
ctx->update_idx = 0;
return 1;
}
if (ctx->sync_appends) {
return 1;
}
return 0;
}
{
}
{
const struct mail_index_header *hdr;
int ret = 0;
ret = -1;
if (ret == 0) {
ret = -1;
if (mail_index_sync_update_index(ctx) < 0)
ret = -1;
}
return ret;
}
{
int i;
for (i = 0; i < INDEX_KEYWORDS_BYTE_COUNT; i++) {
sync_rec->add_keywords[i];
}
}