index-sync.c revision b1ba6a91bd73e1407865acd405814753dedd0121
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen/* Copyright (c) 2002-2011 Dovecot authors, see the included COPYING file */
471e447023ab73a73f0f78da2afc0c55905330ddTimo Sirainenenum mail_index_sync_flags index_storage_get_sync_flags(struct mailbox *box)
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen if ((box->flags & MAILBOX_FLAG_KEEP_RECENT) == 0)
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen sync_flags |= MAIL_INDEX_SYNC_FLAG_DROP_RECENT;
bbce20cb4e5739e9a06058cf8ee1f38a7f6884f6Timo Sirainen sync_flags |= MAIL_INDEX_SYNC_FLAG_DELETING_INDEX;
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenbool index_mailbox_want_full_sync(struct mailbox *box,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen struct index_mailbox_context *ibox = INDEX_STORAGE_CONTEXT(box);
fc7b17677ac1a5fa3f7fe13d5ef7dcfea8d9b4a1Timo Sirainen ioloop_time < ibox->sync_last_check + MAILBOX_FULL_SYNC_INTERVAL)
44ff75ca53188056ff5a3e50428e3f2078800b3cTimo Sirainenvoid index_mailbox_set_recent_uid(struct mailbox *box, uint32_t uid)
51795bfe9d05d92fe942cb451aec2b9d16d32a11Timo Sirainen struct index_mailbox_context *ibox = INDEX_STORAGE_CONTEXT(box);
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen if (seq_range_exists(&ibox->recent_flags, uid))
d9fdacd5fb3e07997e5c389739d2054f0c8441d8Timo Sirainen "Recent flags state corrupted for mailbox %s",
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen seq_range_array_add(&ibox->recent_flags, 64, uid);
45e62043058738e294f89504c319d852e25943ccTimo Sirainenvoid index_mailbox_set_recent_seq(struct mailbox *box,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenbool index_mailbox_is_recent(struct mailbox *box, uint32_t uid)
43d32cbe60fdaef2699d99f1ca259053e9350411Timo Sirainen struct index_mailbox_context *ibox = INDEX_STORAGE_CONTEXT(box);
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen return array_is_created(&ibox->recent_flags) &&
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainenvoid index_mailbox_reset_uidvalidity(struct mailbox *box)
4bc96ba6f1d67a90a75fa131bcd2cd508ea5a05aTimo Sirainen struct index_mailbox_context *ibox = INDEX_STORAGE_CONTEXT(box);
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen /* can't trust the currently cached recent flags anymore */
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenunsigned int index_mailbox_get_recent_count(struct mailbox *box)
2e99f3f3bb35715ce5e0a75a2f2a9bac3ab4224bTimo Sirainen struct index_mailbox_context *ibox = INDEX_STORAGE_CONTEXT(box);
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen range = array_get(&ibox->recent_flags, &count);
b87a4156eca6dcf6b29c504eb0cb9be2fdb11b63Timo Sirainen for (i = count; i > 0; ) {
return recent_count;
struct mailbox_sync_context *
bool failed)
if (failed) {
return FALSE;
return TRUE;
unsigned int count;
return FALSE;
return TRUE;
return TRUE;
uid = 0;
#ifdef DEBUG
unsigned int i, count;
for (i = 0; i < count; i++) {
static enum cache_mask
const char *const *cache_fields;
unsigned int i, count;
for (i = 0; i < count; i++) {
else if (debug) {
cache_fields[i]);
return cache;
const char *str;
if (cache == 0) {
seq++;
&str);
&delayed_expunges) < 0) {
if (seq1 != 0) {
return ret;
return FALSE;
for (i = 0; i < count1; i++) {
for (j = 0; j < count1; j++) {
if (j == count1)
return FALSE;
return TRUE;
return ret;