mail-index-transaction.c revision 1f68b6db9b8d02b0f4116e42ac82c4aac5579574
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen/* Copyright (c) 2003-2007 Dovecot authors, see the included COPYING file */
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen/* Inside transaction we keep messages stored in sequences in uid fields.
18398a5d21c88cbb34c601c6b6c1f9dea502e1caTimo Sirainen Before they're written to transaction log the sequences are changed to
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen UIDs. This is because we're able to compress sequence ranges better. */
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenmail_index_transaction_has_ext_changes(struct mail_index_transaction *t);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenvoid mail_index_transaction_reset(struct mail_index_transaction *t)
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen struct mail_index_transaction_ext_hdr_update **ext_hdrs;
44ff75ca53188056ff5a3e50428e3f2078800b3cTimo Sirainen recs = array_get_modifiable(&t->ext_rec_updates, &count);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen for (i = 0; i < count; i++) {
d5960ce1c0adda5c9e259bc429123ebc29c60baeTimo Sirainen ext_hdrs = array_get_modifiable(&t->ext_hdr_updates, &count);
13c6532dc104d23061e6901783ceb1ff8872c206Timo Sirainen for (i = 0; i < count; i++)
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen struct mail_index_transaction_keyword_update *u;
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen u = array_get_modifiable(&t->keyword_updates, &count);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen 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 {
int i, days;
unsigned int ext_count;
unsigned int i, j, count;
for (j = 0; j < count; j++) {
for (i = 0; i < ext_count; i++) {
unsigned int i, count;
for (i = 0; i < count; i++) {
if (i == count) {
for (i = 0; i < count; i++) {
unsigned int i, count;
for (i = 0; i < count; i++) {
unsigned int i, count;
if (!t->appends_nonsorted)
for (i = 0; i < count; i++) {
for (i = 0; i < count; i++)
for (i = 0; i < count; i++)
return next_uid;
int ret;
if (mail_index_transaction_convert_to_uids(t) < 0)
if (ret == 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++) {
for (i = 0; i < count; i++) {
for (i = 0; i < count; i++) {
seq);
t->last_new_seq--;
t->last_new_seq = 0;
const struct mail_transaction_flag_update *u)
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;
if (count == 0) {
for (i = 0; i < src; i++) {
if (i == src)
dest++;
struct mail_keywords *
struct mail_keywords *k;
const unsigned int *indexes;
if (count == 0) {
for (i = 0; i < src; i++) {
if (i == src)
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 =