mail-index-transaction.c revision a4533a1b40dd668a038ede64af2c237710d195e7
51cbc45fc1ac5dde29bc2adbb175945df1b4f7d4Timo Sirainen/* Copyright (c) 2003-2007 Dovecot authors, see the included COPYING file */
51cbc45fc1ac5dde29bc2adbb175945df1b4f7d4Timo Sirainen/* Inside transaction we keep messages stored in sequences in uid fields.
51cbc45fc1ac5dde29bc2adbb175945df1b4f7d4Timo Sirainen Before they're written to transaction log the sequences are changed to
51cbc45fc1ac5dde29bc2adbb175945df1b4f7d4Timo Sirainen UIDs. This is because we're able to compress sequence ranges better. */
51cbc45fc1ac5dde29bc2adbb175945df1b4f7d4Timo Sirainenmail_index_transaction_has_ext_changes(struct mail_index_transaction *t);
51cbc45fc1ac5dde29bc2adbb175945df1b4f7d4Timo Sirainenvoid mail_index_transaction_reset(struct mail_index_transaction *t)
51cbc45fc1ac5dde29bc2adbb175945df1b4f7d4Timo Sirainen struct mail_index_transaction_ext_hdr_update **ext_hdrs;
51cbc45fc1ac5dde29bc2adbb175945df1b4f7d4Timo Sirainen recs = array_get_modifiable(&t->ext_rec_updates, &count);
4ee00532a265bdfb38539d811fcd12d51210ac35Timo Sirainen for (i = 0; i < count; i++) {
51cbc45fc1ac5dde29bc2adbb175945df1b4f7d4Timo Sirainen ext_hdrs = array_get_modifiable(&t->ext_hdr_updates, &count);
51cbc45fc1ac5dde29bc2adbb175945df1b4f7d4Timo Sirainen for (i = 0; i < count; i++)
51cbc45fc1ac5dde29bc2adbb175945df1b4f7d4Timo Sirainen struct mail_index_transaction_keyword_update *u;
51cbc45fc1ac5dde29bc2adbb175945df1b4f7d4Timo Sirainen u = array_get_modifiable(&t->keyword_updates, &count);
51cbc45fc1ac5dde29bc2adbb175945df1b4f7d4Timo 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++)
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++) {
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 =