index-status.c revision 4945c8a753cdfa19fdedc62049a8ee1890618706
/* Copyright (c) 2002-2017 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "mail-cache.h"
#include "mail-index-modseq.h"
#include "mailbox-recent-flags.h"
#include "index-storage.h"
static void
{
const struct mail_index_header *hdr;
struct mail_cache_view *cache_view;
*last_cached_seq_r = 0;
return;
*last_cached_seq_r = seq;
break;
}
}
}
enum mailbox_status_items items,
struct mailbox_status *status_r)
{
if (items == 0) {
/* caller could have wanted only e.g. mailbox_status.have_*
flags */
return 0;
}
if (mailbox_open(box) < 0)
return -1;
return -1;
}
return 0;
}
{
const struct mail_index_record *pvt_rec;
unsigned int unseen_count = 0;
/* we can't trust private index to be up to date. we'll need to go
through the shared index and for each existing mail lookup its
private flags. if a mail doesn't exist in private index then its
flags are 0. */
unseen_count++;
shared_seq++; pvt_seq++;
shared_seq++;
} else {
pvt_seq++;
}
}
return unseen_count;
}
{
const struct mail_index_header *pvt_hdr;
const struct mail_index_record *pvt_rec;
if (pvt_seq == 0)
return shared_seq;
}
/* if shared index has any messages that don't exist in private index,
the first of them is the first unseen message */
&shared_seq, &seq2))
return shared_seq;
return 0;
}
enum mailbox_status_items items,
struct mailbox_status *status_r)
{
const struct mail_index_header *hdr;
/* we can get most of the status items without any trouble */
if ((items & STATUS_RECENT) != 0) {
/* recent flags are set and dropped by the previous
sync while index was locked. if we updated the
recent flags here we'd have a race condition. */
} else {
/* make sure recent count is set, in case we haven't
synced yet */
}
}
if ((items & STATUS_UNSEEN) != 0) {
} else {
}
}
if ((items & STATUS_HIGHESTMODSEQ) != 0) {
if (status_r->highest_modseq == 0) {
/* modseqs not enabled yet, but we can't return 0 */
}
}
if (status_r->highest_pvt_modseq == 0) {
/* modseqs not enabled yet, but we can't return 0 */
}
}
if ((items & STATUS_FIRST_UNSEEN_SEQ) != 0) {
} else {
}
}
if ((items & STATUS_LAST_CACHED_SEQ) != 0)
if ((items & STATUS_KEYWORDS) != 0)
if ((items & STATUS_PERMANENT_FLAGS) != 0) {
if (!mailbox_is_readonly(box)) {
}
}
}
static void
struct mailbox_metadata *metadata_r)
{
const struct mail_cache_field *fields;
enum mail_cache_decision_type dec;
struct mailbox_cache_field *cf;
unsigned int i, count;
box->metadata_pool =
}
for (i = 0; i < count; i++) {
if (dec != MAIL_CACHE_DECISION_NO) {
}
}
}
struct mailbox_metadata *metadata_r)
{
const struct mail_cache_field *fields;
unsigned int i, count;
enum mail_fetch_field cache = 0;
pool_datastack_create(), &count);
for (i = 0; i < count; i++) {
cache |= MAIL_FETCH_GUID;
/* just ignore for now at least.. */
}
}
static int
struct mailbox_metadata *metadata_r)
{
const struct mail_index_header *hdr;
struct mailbox_transaction_context *t;
int ret = -1;
if (hdr->messages_count == 0) {
return 0;
}
t = mailbox_transaction_begin(box, 0);
ret = 0;
break;
}
/* failed */
break;
}
}
(void)mailbox_transaction_commit(&t);
/* all messages were expunged after all */
return 0;
}
return ret;
}
enum mailbox_metadata_items items,
struct mailbox_metadata *metadata_r)
{
/* handle items that don't require opening the mailbox */
if ((items & MAILBOX_METADATA_BACKEND_NAMESPACE) != 0) {
}
if (items == 0)
return 0;
/* handle items that require opening the mailbox */
if (mailbox_open(box) < 0)
return -1;
}
return -1;
}
if ((items & MAILBOX_METADATA_VIRTUAL_SIZE) != 0) {
return -1;
}
if ((items & MAILBOX_METADATA_PHYSICAL_SIZE) != 0) {
return -1;
}
if ((items & MAILBOX_METADATA_FIRST_SAVE_DATE) != 0) {
return -1;
}
if ((items & MAILBOX_METADATA_CACHE_FIELDS) != 0)
if ((items & MAILBOX_METADATA_PRECACHE_FIELDS) != 0)
return 0;
}