mail-index-transaction.c revision 27bc15088a485a8047fca9b0d24d2904c6dda919
bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (C) 2003-2004 Timo Sirainen */
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi/* Inside transaction we keep messages stored in sequences in uid fields.
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi Before they're written to transaction log the sequences are changed to
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi UIDs. This is because we're able to compress sequence ranges better. */
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomivoid mail_index_transaction_reset(struct mail_index_transaction *t)
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi struct mail_index_transaction_ext_hdr_update **ext_hdrs;
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi unsigned i, count;
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi recs = array_get_modifiable(&t->ext_rec_updates, &count);
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi for (i = 0; i < count; i++) {
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi ext_hdrs = array_get_modifiable(&t->ext_hdr_updates, &count);
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi for (i = 0; i < count; i++)
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi u = array_get_modifiable(&t->keyword_updates, &count);
e88e76e782853e826d00524ee1133e64fb69b3d9Aki Tuomi for (i = 0; i < count; i++) {
t->last_new_seq = 0;
t->last_update_idx = 0;
i_free(t);
struct mail_index_view *
return t->view;
t->refcount++;
if (--t->refcount == 0)
const void *base;
unsigned int count;
void *old_record)
return TRUE;
return FALSE;
for (i = 0; i < count; i++) {
unsigned int i, count;
for (i = 0; i < count; i++) {
unsigned int i, count;
for (i = 0; i < count; i++) {
FALSE);
struct uid_map {
const int max_days =
int i, days;
if (!t->appends_nonsorted)
for (i = 0; i < count; i++) {
for (i = 0; i < count; i++)
for (i = 0; i < count; i++)
ext_rec_array_count = 0;
for (j = 0; j < ext_rec_array_count; j++) {
unsigned int ext_count;
for (i = 0; i < ext_count; i++) {
(t->first_new_seq +
return next_uid;
int ret;
if (mail_index_transaction_convert_to_uids(t) < 0)
return ret;
t->v.rollback(t);
struct mail_index_record *
if (t->last_new_seq != 0)
if (uid != 0) {
if (!t->appends_nonsorted &&
unsigned int i, count;
for (i = 0; i < count; i++) {
for (; i < count; i++) {
const struct mail_transaction_flag_update *u)
return TRUE;
return TRUE;
return TRUE;
return FALSE;
struct mail_transaction_flag_update u,
unsigned int count;
idx++;
tmp_update = u;
move = 0;
&count);
~u.remove_flags;
~u.add_flags;
idx--;
if (mail_transaction_update_want_add(t, &u)) {
count++;
switch (modify_type) {
case MODIFY_REPLACE:
case MODIFY_ADD:
case MODIFY_REMOVE:
memset(&u, 0, sizeof(u));
switch (modify_type) {
case MODIFY_REPLACE:
case MODIFY_ADD:
case MODIFY_REMOVE:
if (mail_transaction_update_want_add(t, &u))
t->last_update_idx++;
last_update++;
if (mail_transaction_update_want_add(t, &u))
else if (t->last_update_idx > 0)
t->last_update_idx--;
first_idx = 0;
bool prepend)
if (prepend) {
unsigned int i, count;
for (i = 0; i < count; i++) {
return TRUE;
for (i = 0; i < count; i++) {
return TRUE;
for (i = 0; i < count; i++) {
if (ids[i] != 0)
return TRUE;
for (i = 0; i < count; i++) {
return TRUE;
return FALSE;
unsigned int count;
count = 0;
old_data_r)) {
struct mail_keywords *
const char *const keywords[])
struct mail_keywords *k;
unsigned int i, count;
if (count == 0) {
for (i = 0; i < count; i++) {
struct mail_keywords *
struct mail_keywords *k;
unsigned int count;
if (count == 0) {
struct mail_index_transaction_keyword_update *u;
unsigned int i, ku_count;
switch (modify_type) {
case MODIFY_ADD:
case MODIFY_REMOVE:
case MODIFY_REPLACE:
&ku_count);
for (i = 0; i < ku_count; i++) {
struct mail_index_transaction *
struct mail_index_transaction *t;
t->v = trans_vfuncs;
t->first_new_seq =