imap-fetch.h revision 46e17407ed48155ac7290a992216a11b2b2b3cf4
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen/* Returns 1 = ok, 0 = client output buffer full, call again, -1 = error.
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen mail = NULL for deinit. */
5363a534097c170ef9cccbdde5ca802f581f5eb7Timo Sirainentypedef int imap_fetch_handler_t(struct imap_fetch_context *ctx,
d371507847d62ba311b4bcc23d18f45c3d0f1a38Timo Sirainen /* Returns FALSE and sets ctx->error if arg is invalid */
d371507847d62ba311b4bcc23d18f45c3d0f1a38Timo Sirainen bool (*init)(struct imap_fetch_init_context *ctx);
a205d315b0978985ba77d871f44e4a98273612e6Timo Sirainen const ARRAY_TYPE(uint32_t) *qresync_sample_seqset;
abe8230dd1dd37d7ccf0163100e934bb5e658c20Timo Sirainen const ARRAY_TYPE(uint32_t) *qresync_sample_uidset;
12d34ab79772e0748a1daef30fa749dfe3036608Timo Sirainen int (*cont_handler)(struct imap_fetch_context *ctx);
f0569d9fbb25c8437760be69f194595a841ad711Timo Sirainen /* TRUE if the first FETCH parameter result hasn't yet been sent to
abe8230dd1dd37d7ccf0163100e934bb5e658c20Timo Sirainen the IMAP client. Note that this doesn't affect buffered content in
abe8230dd1dd37d7ccf0163100e934bb5e658c20Timo Sirainen cur_str until it gets flushed out. */
abe8230dd1dd37d7ccf0163100e934bb5e658c20Timo Sirainen /* TRUE if the cur_str prefix has been flushed. More data may still
abe8230dd1dd37d7ccf0163100e934bb5e658c20Timo Sirainen be added to it. */
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen ARRAY(struct imap_fetch_context_handler) handlers;
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainenvoid imap_fetch_handlers_register(const struct imap_fetch_handler *handlers,
9aa52288a4b53186d81b0ec9afa7d9e0a8ee8753Timo Sirainenvoid imap_fetch_add_handler(struct imap_fetch_init_context *ctx,
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen#define imap_fetch_add_handler(ctx, flags, nil_reply, handler, context) \
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen imap_fetch_add_handler(ctx, flags, nil_reply + \
8bb360f9e5de1c25e4f875205bb06e8bf15dae14Timo Sirainenint imap_fetch_att_list_parse(struct client *client, pool_t pool,
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen const char **error_r);
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainenimap_fetch_alloc(struct client *client, pool_t pool);
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainenvoid imap_fetch_free(struct imap_fetch_context **ctx);
8d80659e504ffb34bb0c6a633184fece35751b18Timo Sirainenbool imap_fetch_init_handler(struct imap_fetch_init_context *init_ctx);
8d80659e504ffb34bb0c6a633184fece35751b18Timo Sirainenvoid imap_fetch_init_nofail_handler(struct imap_fetch_context *ctx,
8d80659e504ffb34bb0c6a633184fece35751b18Timo Sirainen bool (*init)(struct imap_fetch_init_context *));
d22301419109ed4a38351715e6760011421dadecTimo Sirainenvoid imap_fetch_begin(struct imap_fetch_context *ctx, struct mailbox *box,
bb10ebcf076c959c752f583746d83805d7686df8Timo Sirainenint imap_fetch_send_vanished(struct client *client, struct mailbox *box,
bb10ebcf076c959c752f583746d83805d7686df8Timo Sirainen const struct imap_fetch_qresync_args *qresync_args);
bb10ebcf076c959c752f583746d83805d7686df8Timo Sirainen/* Returns 1 if finished, 0 if more data is needed, -1 if error.
bb10ebcf076c959c752f583746d83805d7686df8Timo Sirainen When 0 is returned, line_partial=TRUE if literal is open and must be
d22301419109ed4a38351715e6760011421dadecTimo Sirainen finished before anything else to client. */
bb10ebcf076c959c752f583746d83805d7686df8Timo Sirainenint imap_fetch_more(struct imap_fetch_context *ctx,
bb10ebcf076c959c752f583746d83805d7686df8Timo Sirainen/* Like imap_fetch_more(), but don't check/update output_lock.
197ad81605dc0f6d2ebc9ad99994db5ca6d76699Timo Sirainen The caller must handle this itself. */
bb10ebcf076c959c752f583746d83805d7686df8Timo Sirainenint imap_fetch_more_no_lock_update(struct imap_fetch_context *ctx);
bb10ebcf076c959c752f583746d83805d7686df8Timo Sirainenint imap_fetch_end(struct imap_fetch_context *ctx);
5363a534097c170ef9cccbdde5ca802f581f5eb7Timo Sirainenint imap_fetch_more(struct imap_fetch_context *ctx,
bb10ebcf076c959c752f583746d83805d7686df8Timo Sirainenbool imap_fetch_flags_init(struct imap_fetch_init_context *ctx);
bb10ebcf076c959c752f583746d83805d7686df8Timo Sirainenbool imap_fetch_modseq_init(struct imap_fetch_init_context *ctx);
bb10ebcf076c959c752f583746d83805d7686df8Timo Sirainenbool imap_fetch_uid_init(struct imap_fetch_init_context *ctx);
bb10ebcf076c959c752f583746d83805d7686df8Timo Sirainenbool imap_fetch_body_section_init(struct imap_fetch_init_context *ctx);
bb10ebcf076c959c752f583746d83805d7686df8Timo Sirainenbool imap_fetch_rfc822_init(struct imap_fetch_init_context *ctx);