mail-transaction-log-view.c revision 5c1a8aee989af87bddefd71e2aa83aa2bd695155
/* Copyright (C) 2003-2004 Timo Sirainen */
#include "lib.h"
#include "buffer.h"
#include "mail-index-private.h"
#include "mail-transaction-log-private.h"
#include "mail-transaction-util.h"
struct mail_transaction_log_view {
struct mail_transaction_log *log;
struct mail_transaction_log_view *next;
struct mail_transaction_header tmp_hdr;
struct mail_transaction_log_file *file;
unsigned int broken:1;
};
struct mail_transaction_log_view *
{
struct mail_transaction_log_view *view;
view->expunges_buf =
return view;
}
static void
{
struct mail_transaction_log_file *file;
break;
}
}
{
}
int
{
/* FIXME: error handling for "not found" case is bad.. should the
caller after all check it and handle as it sees best..? */
int ret;
if (ret <= 0)
return -1;
if (ret <= 0)
return -1;
return -1;
sizeof(struct mail_transaction_log_header),
if (ret <= 0)
return -1;
}
/* we have it all, refcount the files */
}
view->prev_file_seq = 0;
view->prev_file_offset = 0;
return 0;
}
void
{
}
void
const char *fmt, ...)
{
t_push();
t_pop();
}
int
{
}
const struct mail_transaction_header **hdr_r,
const void **data_r)
{
const struct mail_transaction_header *hdr;
const struct mail_transaction_type_map *type_rec;
const void *data;
unsigned int record_size;
return 0;
}
return -1;
}
"record size too large "
"(type=0x%x, offset=%u, size=%u, end=%u)",
return -1;
}
else {
"unknown record type 0x%x",
return -1;
}
"found expunge without protection mask");
return -1;
}
"extra bits in header type: 0x%x",
return -1;
}
"record size wrong (type 0x%x, %u %% %u != 0)",
return -1;
}
return 1;
}
static int seqfix_expunge(const struct mail_transaction_expunge *e,
void *context)
{
struct mail_transaction_expunge new_e;
e->seq2);
if (expunges_before == 0) {
return 1;
}
/* FIXME: if there's expunges in the middle of the
range, we'd have to split this to multiple records */
new_e = *e;
return 1;
}
static int seqfix_flag_update(const struct mail_transaction_flag_update *u,
void *context)
{
struct mail_transaction_flag_update new_u;
u->seq2);
if (expunges_before == 0) {
return 1;
}
/* FIXME: if there's expunges in the middle of the
range, we'd have to split this to multiple records */
new_u = *u;
return 1;
}
static int seqfix_cache_update(const struct mail_transaction_cache_update *u,
void *context)
{
struct mail_transaction_cache_update new_u;
u->seq);
if (expunges_before != 0) {
new_u = *u;
u = &new_u;
}
return 1;
}
const struct mail_transaction_header **hdr_r,
{
struct mail_transaction_map_functions seqfix_funcs = {
};
const struct mail_transaction_header *hdr;
const void *data;
int ret = 0;
return -1;
break;
/* we don't want this record */
}
append isn't in mask */
}
if (ret <= 0)
return ret;
/* we have to fix sequences in the data */
} else {
}
view->expunges_buf);
if (ret > 0) {
/* modified */
} else {
}
}
/* hide expunge protection */
}
return 1;
}
buffer_t *
{
return view->expunges_buf;
}