mail-index-transaction-update.c revision 01e29d9d23a1844b4582592a473a3b3eac56b36b
9917c138d9a270deb5820915384fbde751190c2aLukas Slebodnik/* Copyright (c) 2003-2015 Dovecot authors, see the included COPYING file */
9917c138d9a270deb5820915384fbde751190c2aLukas Slebodnik/* Inside transaction we keep messages stored in sequences in uid fields.
9917c138d9a270deb5820915384fbde751190c2aLukas Slebodnik Before they're written to transaction log the sequences are changed to
9917c138d9a270deb5820915384fbde751190c2aLukas Slebodnikmail_index_transaction_has_ext_changes(struct mail_index_transaction *t);
9917c138d9a270deb5820915384fbde751190c2aLukas Slebodnikmail_index_transaction_lookup(struct mail_index_transaction *t, uint32_t seq)
9917c138d9a270deb5820915384fbde751190c2aLukas Slebodnik i_assert(seq >= t->first_new_seq && seq <= t->last_new_seq);
9917c138d9a270deb5820915384fbde751190c2aLukas Slebodnik return array_idx_modifiable(&t->appends, seq - t->first_new_seq);
9917c138d9a270deb5820915384fbde751190c2aLukas Slebodnikvoid mail_index_transaction_reset_v(struct mail_index_transaction *t)
9917c138d9a270deb5820915384fbde751190c2aLukas Slebodnik struct mail_index_transaction_ext_hdr_update *ext_hdr;
9917c138d9a270deb5820915384fbde751190c2aLukas Slebodnik if (array_is_created(&t->ext_rec_updates)) {
9917c138d9a270deb5820915384fbde751190c2aLukas Slebodnik array_foreach_modifiable(&t->ext_rec_updates, rec) {
struct mail_index_transaction_keyword_update *u;
t->last_new_seq = 0;
t->last_update_idx = 0;
t->min_flagupdate_seq = 0;
t->max_flagupdate_seq = 0;
t->min_highest_modseq = 0;
t->min_highest_modseq != 0;
int i, days;
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 = 0; i < count; i++) {
struct mail_transaction_modseq_update *u;
unsigned int idx;
seq);
seq);
t->last_new_seq--;
t->last_new_seq = 0;
unsigned int count;
else if (!t->expunges_nonsorted) {
if (t->min_flagupdate_seq == 0) {
unsigned int left_idx,
unsigned int right_idx,
idx++;
return idx;
struct mail_index_flag_update u,
unsigned int idx)
tmp_update = u;
idx++;
~u.remove_flags;
~u.add_flags;
max--;
t->last_update_idx--;
idx++;
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:
if (flags == 0)
case MODIFY_REMOVE:
if (flags == 0)
t->last_update_idx++;
last_update++;
first_idx = 0;
bool prepend)
if (prepend) {
return TRUE;
return FALSE;
return TRUE;
return TRUE;
return TRUE;
return TRUE;
return TRUE;
return FALSE;
bool changed;
if (changed) {
unsigned int count;
count = 0;
old_data_r)) {
&old_diff32)) {
return diff32;
const unsigned int *existing_idx;
unsigned int i, j, existing_count;
bool found;
return TRUE;
for (j = 0; j < existing_count; j++) {
switch (modify_type) {
case MODIFY_ADD:
case MODIFY_REPLACE:
if (!found)
return TRUE;
case MODIFY_REMOVE:
if (found)
return TRUE;
return FALSE;
static struct mail_keywords *
for (i = 0; i < keywords_count; i++)
return NULL;
&keywords);
struct mail_index_transaction_keyword_update *u;
bool changed;
T_BEGIN {
keywords);
} T_END;
if (!changed)
switch (modify_type) {
case MODIFY_REPLACE:
case MODIFY_ADD:
case MODIFY_REMOVE:
unsigned int i, count;
return FALSE;
if (i == count)
return FALSE;
return FALSE;
return TRUE;
return TRUE;
return FALSE;
return FALSE;
if (!have_kw_changes)
return ret;
t->v.reset(t);