mailbox-get.c revision 2454dfa32c93c20a8522c6ed42fe057baaac9f9a
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen/* Copyright (c) 2002-2017 Dovecot authors, see the included COPYING file */
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainenvoid mailbox_get_seq_range(struct mailbox *box, uint32_t uid1, uint32_t uid2,
e392fcb39a06609af20a9e79017683f194de3ddeTimo Sirainen (void)mail_index_lookup_seq_range(box->view, uid1, uid2, seq1_r, seq2_r);
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainenvoid mailbox_get_uid_range(struct mailbox *box,
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen unsigned int i, count;
afbdaecd328f6c912293d713975856cbb2d75452Sergey Kitov for (i = 0; i < count; i++) {
afbdaecd328f6c912293d713975856cbb2d75452Sergey Kitov mail_index_lookup_uid(box->view, range[i].seq1, &uid);
afbdaecd328f6c912293d713975856cbb2d75452Sergey Kitov seq_range_array_add_range(uids, uid, (uint32_t)-1);
afbdaecd328f6c912293d713975856cbb2d75452Sergey Kitov for (seq = range[i].seq1; seq <= range[i].seq2; seq++) {
39dea5f2e78f6bfc3adc0655176f596ee211938fTimo Sirainenadd_expunges(ARRAY_TYPE(seq_range) *expunged_uids, uint32_t min_uid,
39dea5f2e78f6bfc3adc0655176f596ee211938fTimo Sirainen const struct mail_transaction_expunge *src, size_t src_size)
2e07e3182f355cf04a1461dd7f893d0ebc818764Timo Sirainenadd_guid_expunges(ARRAY_TYPE(seq_range) *expunged_uids, uint32_t min_uid,
2e07e3182f355cf04a1461dd7f893d0ebc818764Timo Sirainen const struct mail_transaction_expunge_guid *src,
2e07e3182f355cf04a1461dd7f893d0ebc818764Timo Sirainen const struct mail_transaction_expunge_guid *end;
4316355ca8b7698516272520a972291378698140Timo Sirainenmailbox_get_expunges_init(struct mailbox *box, uint64_t prev_modseq,
4316355ca8b7698516272520a972291378698140Timo Sirainen struct mail_transaction_log_view **log_view_r,
c3785e2a5618182c3d7fb59f4888134e7ac834ccTimo Sirainen if (!mail_index_modseq_get_next_log_offset(box->view, prev_modseq,
bd7b1a9000b12349e2a99bb43b3ce8b96a18e92bTimo Sirainen log_offset >= box->view->log_file_head_offset)) {
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen /* we haven't seen this high expunges at all */
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen log_view = mail_transaction_log_view_open(box->index->log);
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen ret = mail_transaction_log_view_set(log_view, log_seq, log_offset,
3f7583189249a28892cd5bd69e15681c7a8a619bTimo Sirainen mail_transaction_log_get_tail(box->index->log, &tail_seq);
c3785e2a5618182c3d7fb59f4888134e7ac834ccTimo Sirainen ret = mail_transaction_log_view_set(log_view, tail_seq, 0,
b62139aae0a0099d0ede35b164b2870479f9b027Martti Rannanjärvimailbox_get_expunged_guids(struct mail_transaction_log_view *log_view,
38ce5769db11e7f52562610ee6e6fc4f0ea7888fMartti Rannanjärvi ARRAY_TYPE(mailbox_expunge_rec) *expunges)
b62139aae0a0099d0ede35b164b2870479f9b027Martti Rannanjärvi const struct mail_transaction_expunge_guid *rec, *end;
bd7b1a9000b12349e2a99bb43b3ce8b96a18e92bTimo Sirainen unsigned int n;
39dea5f2e78f6bfc3adc0655176f596ee211938fTimo Sirainen while (mail_transaction_log_view_next(log_view, &thdr, &tdata) > 0) {
39dea5f2e78f6bfc3adc0655176f596ee211938fTimo Sirainen if ((thdr->type & MAIL_TRANSACTION_TYPE_MASK) !=
afbdaecd328f6c912293d713975856cbb2d75452Sergey Kitov if (!seq_range_exists(expunged_uids, rec->uid))
1795e934ebcd58175d3b5bbdd811b13c7889efa3Timo Sirainen seq_range_array_remove(expunged_uids, rec->uid);
const void *tdata;
bool modseq_too_old;
int ret;
if (ret != 0)
return ret > 0;
case MAIL_TRANSACTION_EXPUNGE: