mailbox-search-result.c revision 4fb98a31d0e4f67978a98a83a5895472b2da0401
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch/* Copyright (c) 2008-2012 Dovecot authors, see the included COPYING file */
38af46387e565053adf6c47f7f6871676d685de8Stephan Boschmailbox_search_result_analyze_args(struct mail_search_result *result,
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Boschmailbox_search_result_alloc(struct mailbox *box, struct mail_search_args *args,
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch if ((result->flags & MAILBOX_SEARCH_RESULT_FLAG_UPDATE) != 0) {
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch mailbox_search_result_analyze_args(result, args->args);
5560e4cd4f5eded857471042fb5485dfa16b7c46Stephan Bosch array_append(&result->box->search_results, &result, 1);
38af46387e565053adf6c47f7f6871676d685de8Stephan Boschvoid mailbox_search_result_free(struct mail_search_result **_result)
38af46387e565053adf6c47f7f6871676d685de8Stephan Bosch unsigned int i, count;
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch results = array_get(&result->box->search_results, &count);
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch for (i = 0; i < count; i++) {
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch array_delete(&result->box->search_results, i, 1);
7c7117e542b6a44c1db7fc91c0180bdace6dbce7Stephan Bosch if (array_is_created(&result->removed_uids)) {
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainenmailbox_search_result_save(struct mail_search_context *ctx,
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen result = mailbox_search_result_alloc(ctx->transaction->box,
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Boschvoid mailbox_search_result_initial_done(struct mail_search_result *result)
dc05b1fb4b7a2b4d91248078311458cb4cbad9a1Stephan Bosch if ((result->flags & MAILBOX_SEARCH_RESULT_FLAG_QUEUE_SYNC) != 0) {
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch mail_search_args_seq2uid(result->search_args);
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Boschvoid mailbox_search_results_initial_done(struct mail_search_context *ctx)
201c3b9375760bafbc180629b4c6ad71ed554aecStephan Bosch unsigned int i, count;
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch for (i = 0; i < count; i++)
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch mailbox_search_result_initial_done(results[i]);
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainenvoid mailbox_search_result_add(struct mail_search_result *result, uint32_t uid)
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch seq_range_array_add(&result->added_uids, uid);
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch seq_range_array_remove(&result->removed_uids, uid);
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Boschvoid mailbox_search_result_remove(struct mail_search_result *result,
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch if (seq_range_array_try_remove(&result->uids, uid)) {
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch if (array_is_created(&result->removed_uids)) {
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch seq_range_array_add(&result->removed_uids, uid);
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch seq_range_array_remove(&result->added_uids, uid);
38af46387e565053adf6c47f7f6871676d685de8Stephan Boschvoid mailbox_search_results_add(struct mail_search_context *ctx, uint32_t uid)
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch unsigned int i, count;
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch for (i = 0; i < count; i++)
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainenvoid mailbox_search_results_remove(struct mailbox *box, uint32_t uid)
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen unsigned int i, count;
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch results = array_get(&box->search_results, &count);
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch for (i = 0; i < count; i++)
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch mailbox_search_result_remove(results[i], uid);
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Boschvoid mailbox_search_result_never(struct mail_search_result *result,
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Bosch seq_range_array_add(&result->never_uids, uid);
e1a4ea6ad3e799ef8df7395e765c0ae9218e6c5dStephan Boschvoid mailbox_search_results_never(struct mail_search_context *ctx,
5560e4cd4f5eded857471042fb5485dfa16b7c46Stephan Bosch unsigned int i, count;
5560e4cd4f5eded857471042fb5485dfa16b7c46Stephan Bosch mailbox_search_result_never(ctx->update_result, uid);
5560e4cd4f5eded857471042fb5485dfa16b7c46Stephan Bosch for (i = 0; i < count; i++)
5560e4cd4f5eded857471042fb5485dfa16b7c46Stephan Boschmailbox_search_result_get(struct mail_search_result *result)
3fcb3d2d1f3583025ff62bae95ec706920f398b1Stephan Boschvoid mailbox_search_result_sync(struct mail_search_result *result,
2f64a4c88de91c483fb378bc80d10e1caa6f2305Stephan Bosch array_append_array(removed_uids, &result->removed_uids);