imap-fetch.h revision f32c6ed9db6f4c535f97a2020401572efc8abf86
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainen/* Returns 1 = ok, 0 = client output buffer full, call again, -1 = error.
de754cb78f75e8b3b994cddafe41c9ed1467c33dTimo Sirainen mail = NULL for deinit. */
f29756821a4c6b12b73e4a2a3e1c230117a43773Timo Sirainentypedef int imap_fetch_handler_t(struct imap_fetch_context *ctx,
2e78f05b11df23ec2731afaf8f19d5b5240cb29fTimo Sirainen /* Returns FALSE and sets ctx->error if arg is invalid */
2e78f05b11df23ec2731afaf8f19d5b5240cb29fTimo Sirainen bool (*init)(struct imap_fetch_init_context *ctx);
b9c76fe9d9ca194816606342da1ddbd9be6bc8abTimo Sirainen const ARRAY_TYPE(uint32_t) *qresync_sample_seqset;
9f627b360ed38fdc54cb02ec5e67246c3f0d5b0fTimo Sirainen const ARRAY_TYPE(uint32_t) *qresync_sample_uidset;
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainen int (*cont_handler)(struct imap_fetch_context *ctx);
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainen /* TRUE if the first FETCH parameter result hasn't yet been sent to
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainen the IMAP client. Note that this doesn't affect buffered content in
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainen cur_str until it gets flushed out. */
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainen /* TRUE if the cur_str prefix has been flushed. More data may still
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainen be added to it. */
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainen ARRAY(struct imap_fetch_context_handler) handlers;
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainenvoid imap_fetch_handlers_register(const struct imap_fetch_handler *handlers,
2598b2f36365b52d9754b9348a5be29569293e46Timo Sirainenvoid imap_fetch_handler_unregister(const char *name);
6303191abcb37164f435ccdc56e9dbddf1288851Timo Sirainenvoid imap_fetch_add_handler(struct imap_fetch_init_context *ctx,
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainen#define imap_fetch_add_handler(ctx, flags, nil_reply, handler, context) \
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainen imap_fetch_add_handler(ctx, flags, nil_reply + \
5a250816ffc4cc5db203f9410ea99b6601c7b91aTimo Sirainenint imap_fetch_att_list_parse(struct client *client, pool_t pool,
1bf5c6c20f3d51f13d3240cfb46e471074c86276Timo Sirainen const char **error_r);
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainenimap_fetch_alloc(struct client *client, pool_t pool, const char *reason);
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainenvoid imap_fetch_free(struct imap_fetch_context **ctx);
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainenbool imap_fetch_init_handler(struct imap_fetch_init_context *init_ctx);
e5acc283bf030b0b5c79ca4e52d315c516a299faPascal Volkvoid imap_fetch_init_nofail_handler(struct imap_fetch_context *ctx,
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainen bool (*init)(struct imap_fetch_init_context *));
2e2a1d720ed53490e8e5c5031e773d395bd5683dTimo Sirainenconst struct imap_fetch_handler *imap_fetch_handler_lookup(const char *name);
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainenvoid imap_fetch_begin(struct imap_fetch_context *ctx, struct mailbox *box,
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainenint imap_fetch_send_vanished(struct client *client, struct mailbox *box,
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainen const struct imap_fetch_qresync_args *qresync_args);
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainen/* Returns 1 if finished, 0 if more data is needed, -1 if error.
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainen When 0 is returned, line_partial=TRUE if literal is open and must be
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainen finished before anything else to client. */
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainenint imap_fetch_more(struct imap_fetch_context *ctx,
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainen/* Like imap_fetch_more(), but don't check/update output_lock.
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainen The caller must handle this itself. */
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainenint imap_fetch_more_no_lock_update(struct imap_fetch_context *ctx);
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainenint imap_fetch_end(struct imap_fetch_context *ctx);
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainenint imap_fetch_more(struct imap_fetch_context *ctx,
e248fe370c4047cee921a91b48edc37944ab0526Timo Sirainenbool imap_fetch_flags_init(struct imap_fetch_init_context *ctx);
b8afdaa1bffe2f27cd4b02bf3bfbd2d297c8e648Timo Sirainenbool imap_fetch_modseq_init(struct imap_fetch_init_context *ctx);
b8afdaa1bffe2f27cd4b02bf3bfbd2d297c8e648Timo Sirainenbool imap_fetch_uid_init(struct imap_fetch_init_context *ctx);
b8afdaa1bffe2f27cd4b02bf3bfbd2d297c8e648Timo Sirainenbool imap_fetch_body_section_init(struct imap_fetch_init_context *ctx);
b8afdaa1bffe2f27cd4b02bf3bfbd2d297c8e648Timo Sirainenbool imap_fetch_rfc822_init(struct imap_fetch_init_context *ctx);