index-status.c revision 54f9cedf212e30f690e8c7487374f2ea890494c6
bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (C) 2002 Timo Sirainen */
bdd36cfdba3ff66d25570a9ff568d69e1eb543cfTimo Sirainen (STATUS_MESSAGES | STATUS_RECENT | STATUS_UIDNEXT | \
dd7cbb32412c2f4d2d223af66672535bc1237246Timo Sirainen STATUS_UIDVALIDITY | STATUS_UNSEEN | STATUS_FIRST_UNSEEN_SEQ)
306b3f41b05da642d87e7ca7a1496efce9f5902fTimo Sirainenget_keywords(struct mail_keywords *mcf, struct mailbox_status *status)
6c2ce1d5bf17b21e804a079eb0f973b7ab83e0d8Timo Sirainen const char **flags;
a64adf62fa33f2463a86f990217b0c9078531a40Timo Sirainen unsigned int i;
1701b354e81ff1dfd0b6c7bb4412b8d9c2b9f986Timo Sirainen status->keywords_count = MAIL_KEYWORDS_COUNT;
1701b354e81ff1dfd0b6c7bb4412b8d9c2b9f986Timo Sirainen status->keywords = t_new(const char *, MAIL_KEYWORDS_COUNT);
8d3278a82b964217d95c340ec6f82037cdc59d19Timo Sirainen flags = mail_keywords_list_get(mcf);
9fd2181788a61500641c66aec0f8c746b19bf830Timo Sirainen for (i = 0; i < MAIL_KEYWORDS_COUNT; i++)
a64adf62fa33f2463a86f990217b0c9078531a40Timo Sirainen status->keywords[i] = t_strdup(flags[i]);
d80f37f025593d959bdfa9c378915e4322f4f504Timo Sirainenint index_storage_get_status(struct mailbox *box,
d80f37f025593d959bdfa9c378915e4322f4f504Timo Sirainen struct index_mailbox *ibox = (struct index_mailbox *) box;
d80f37f025593d959bdfa9c378915e4322f4f504Timo Sirainen memset(status, 0, sizeof(struct mailbox_status));
d80f37f025593d959bdfa9c378915e4322f4f504Timo Sirainen /* sync mailbox to update message counts */
9fd2181788a61500641c66aec0f8c746b19bf830Timo Sirainen /* we can get most of the status items without any trouble */
d80f37f025593d959bdfa9c378915e4322f4f504Timo Sirainen if (mail_index_get_header(ibox->view, &hdr) < 0)
d80f37f025593d959bdfa9c378915e4322f4f504Timo Sirainen status->unseen = hdr->messages_count - hdr->seen_messages_count;
5231ae561283595a73e9d838bdf4eb5d1b074679Josef 'Jeff' Sipek //FIXME:status->diskspace_full = ibox->nodiskspace;
379175cfba8150d481d9898b78330b719d128d84Timo Sirainen if (mail_index_lookup_first(ibox->view, 0, MAIL_SEEN,
d80f37f025593d959bdfa9c378915e4322f4f504Timo Sirainen i_assert(ibox->last_recent_count_initialized);
d80f37f025593d959bdfa9c378915e4322f4f504Timo Sirainen /*FIXME:if (items & STATUS_KEYWORDS)
4c892b0d94c5b1d6853dbe8e0b38059ea5b08ecaTimo Sirainen get_keywords(ibox, status);*/