mail-index-transaction-view.c revision 9bbfcf3e9aa5e1778a13109f471d1725c2766083
/* Copyright (C) 2004-2006 Timo Sirainen */
#include "lib.h"
#include "array.h"
#include "buffer.h"
#include "seq-range-array.h"
#include "mail-index-private.h"
#include "mail-index-view-private.h"
#include "mail-index-transaction-private.h"
struct mail_index_view_transaction {
struct mail_index_view view;
struct mail_index_view_vfuncs *super;
struct mail_index_transaction *t;
struct mail_index_header hdr;
};
{
struct mail_index_view_transaction *tview =
(struct mail_index_view_transaction *)view;
struct mail_index_transaction *t = tview->t;
}
{
struct mail_index_view_transaction *tview =
(struct mail_index_view_transaction *)view;
(tview->t->last_new_seq == 0 ? 0 :
}
static const struct mail_index_header *
{
struct mail_index_view_transaction *tview =
(struct mail_index_view_transaction *)view;
const struct mail_index_header *hdr;
const struct mail_index_record *recs;
unsigned int count;
/* FIXME: header counters may not be correct */
/* update next_uid from appends, if UIDs have been given yet */
}
}
return hdr;
}
struct mail_index_map **map_r,
const struct mail_index_record **rec_r)
{
struct mail_index_view_transaction *tview =
(struct mail_index_view_transaction *)view;
int ret;
/* FIXME: is this right to return index map..?
it's not there yet. */
return 1;
}
if (ret <= 0)
return ret;
/* if we're expunged within this transaction, return 0 */
}
{
struct mail_index_view_transaction *tview =
(struct mail_index_view_transaction *)view;
return 0;
} else {
}
}
{
struct mail_index_view_transaction *tview =
(struct mail_index_view_transaction *)view;
const struct mail_index_record *rec;
first_seq_r, last_seq_r) < 0)
return -1;
if (tview->t->last_new_seq == 0) {
/* no new messages, the results are final. */
return 0;
}
/* new messages don't have UIDs */
return 0;
}
/* all wanted messages were existing */
return 0;
}
/* at least some of the wanted messages are newly created */
if (*first_seq_r == 0)
*last_seq_r = seq;
break;
}
}
return 0;
}
{
struct mail_index_view_transaction *tview =
(struct mail_index_view_transaction *)view;
const struct mail_index_record *rec;
unsigned int append_count;
return -1;
if (*seq_r != 0)
return 0;
break;
}
}
return 0;
}
static int
const void **data_r)
{
struct mail_index_view_transaction *tview =
(struct mail_index_view_transaction *)view;
const void *data;
unsigned int idx;
/* there are some ext updates in transaction.
see if there's any for this sequence. */
if (array_is_created(ext_buf) &&
return 1;
}
}
/* not updated, return the existing value */
}
return 1;
}
{
struct mail_index_view_transaction *tview =
(struct mail_index_view_transaction *)view;
/* FIXME: check updates */
}
static struct mail_index_view_vfuncs trans_view_vfuncs = {
};
struct mail_index_view *
{
struct mail_index_view_transaction *tview;
/* transaction view is being synced. while it's done, it's not
possible to add new messages, but the view itself might
change. so we can't make a copy of the view. */
mail_index_view_ref(t->view);
return t->view;
}
tview->t = t;
}