56b8bee5943ad628f292a307a68a8cff7e966132Timo Sirainen#ifndef INDEX_SEARCH_PRIVATE_H
56b8bee5943ad628f292a307a68a8cff7e966132Timo Sirainen#define INDEX_SEARCH_PRIVATE_H
56b8bee5943ad628f292a307a68a8cff7e966132Timo Sirainen
56b8bee5943ad628f292a307a68a8cff7e966132Timo Sirainen#include "mail-storage-private.h"
56b8bee5943ad628f292a307a68a8cff7e966132Timo Sirainen
7ba3065dc2bd2c421dd9076deb39a9d6fb9fdb10SATOH Fumiyasu#include <sys/time.h>
7ba3065dc2bd2c421dd9076deb39a9d6fb9fdb10SATOH Fumiyasu
74bc7e646663255703e10e0c0b7242ad7ad52f94Stephan Boschstruct mail_search_mime_part;
74bc7e646663255703e10e0c0b7242ad7ad52f94Stephan Boschstruct imap_message_part;
74bc7e646663255703e10e0c0b7242ad7ad52f94Stephan Bosch
56b8bee5943ad628f292a307a68a8cff7e966132Timo Sirainenstruct index_search_context {
56b8bee5943ad628f292a307a68a8cff7e966132Timo Sirainen struct mail_search_context mail_ctx;
56b8bee5943ad628f292a307a68a8cff7e966132Timo Sirainen struct mail_index_view *view;
56b8bee5943ad628f292a307a68a8cff7e966132Timo Sirainen struct mailbox *box;
56b8bee5943ad628f292a307a68a8cff7e966132Timo Sirainen
3bd3e8e748379cbbf690c6ee9dfbce5e17464e44Timo Sirainen uint32_t pvt_uid, pvt_seq;
3bd3e8e748379cbbf690c6ee9dfbce5e17464e44Timo Sirainen
e29f8a6a52ca72fc6010132fb86dd00e9d96432aTimo Sirainen enum mail_fetch_field extra_wanted_fields;
e29f8a6a52ca72fc6010132fb86dd00e9d96432aTimo Sirainen struct mailbox_header_lookup_ctx *extra_wanted_headers;
e29f8a6a52ca72fc6010132fb86dd00e9d96432aTimo Sirainen
56b8bee5943ad628f292a307a68a8cff7e966132Timo Sirainen uint32_t seq1, seq2;
e15b305e90c9834734ccf35ed78f0ad29d570ee9Timo Sirainen struct mail *cur_mail;
e15b305e90c9834734ccf35ed78f0ad29d570ee9Timo Sirainen struct index_mail *cur_imail;
56b8bee5943ad628f292a307a68a8cff7e966132Timo Sirainen struct mail_thread_context *thread_ctx;
56b8bee5943ad628f292a307a68a8cff7e966132Timo Sirainen
4ee00532a265bdfb38539d811fcd12d51210ac35Timo Sirainen ARRAY(struct mail *) mails;
e15b305e90c9834734ccf35ed78f0ad29d570ee9Timo Sirainen unsigned int unused_mail_idx;
e15b305e90c9834734ccf35ed78f0ad29d570ee9Timo Sirainen unsigned int max_mails;
e15b305e90c9834734ccf35ed78f0ad29d570ee9Timo Sirainen
56b8bee5943ad628f292a307a68a8cff7e966132Timo Sirainen struct timeval search_start_time, last_notify;
56b8bee5943ad628f292a307a68a8cff7e966132Timo Sirainen struct timeval last_nonblock_timeval;
56b8bee5943ad628f292a307a68a8cff7e966132Timo Sirainen unsigned long long cost, next_time_check_cost;
56b8bee5943ad628f292a307a68a8cff7e966132Timo Sirainen
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool failed:1;
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool sorted:1;
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool have_seqsets:1;
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool have_index_args:1;
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool have_mailbox_args:1;
56b8bee5943ad628f292a307a68a8cff7e966132Timo Sirainen};
56b8bee5943ad628f292a307a68a8cff7e966132Timo Sirainen
e15b305e90c9834734ccf35ed78f0ad29d570ee9Timo Sirainenstruct mail *index_search_get_mail(struct index_search_context *ctx);
56b8bee5943ad628f292a307a68a8cff7e966132Timo Sirainen
74bc7e646663255703e10e0c0b7242ad7ad52f94Stephan Boschint index_search_mime_arg_match(struct mail_search_arg *args,
74bc7e646663255703e10e0c0b7242ad7ad52f94Stephan Bosch struct index_search_context *ctx);
2b1933b133f3e3571b32fa56fb823b4a6f9aab57Stephan Boschvoid index_search_mime_arg_deinit(struct mail_search_arg *arg,
2b1933b133f3e3571b32fa56fb823b4a6f9aab57Stephan Bosch struct index_search_context *ctx);
74bc7e646663255703e10e0c0b7242ad7ad52f94Stephan Bosch
56b8bee5943ad628f292a307a68a8cff7e966132Timo Sirainen#endif