c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen#ifndef IMAPC_CLIENT_PRIVATE_H
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen#define IMAPC_CLIENT_PRIVATE_H
657afb33796f8216c568ad813627da89970760beTimo Sirainen
70905e51a5148bd5613cb04720807177474a2496Timo Sirainen#include "imapc-client.h"
6aafdd81aa1e12c127941c1ebd87e8ee4697ec3eTimo Sirainen
ad49932dae8ba31e07544b66bbc4f4de707a751cTimo Sirainen#define IMAPC_CLIENT_IDLE_SEND_DELAY_MSECS 100
226259ee6fb9830dafc1a5ba1e95bf5a4345b406Timo Sirainen
70905e51a5148bd5613cb04720807177474a2496Timo Sirainenstruct imapc_client_connection {
50782de8a9d5ebe11ee61496b4e695a1d3875230Timo Sirainen struct imapc_connection *conn;
50782de8a9d5ebe11ee61496b4e695a1d3875230Timo Sirainen struct imapc_client *client;
50782de8a9d5ebe11ee61496b4e695a1d3875230Timo Sirainen struct imapc_client_mailbox *box;
50782de8a9d5ebe11ee61496b4e695a1d3875230Timo Sirainen};
50782de8a9d5ebe11ee61496b4e695a1d3875230Timo Sirainen
50782de8a9d5ebe11ee61496b4e695a1d3875230Timo Sirainenstruct imapc_client {
226259ee6fb9830dafc1a5ba1e95bf5a4345b406Timo Sirainen pool_t pool;
6aafdd81aa1e12c127941c1ebd87e8ee4697ec3eTimo Sirainen int refcount;
6aafdd81aa1e12c127941c1ebd87e8ee4697ec3eTimo Sirainen
6aafdd81aa1e12c127941c1ebd87e8ee4697ec3eTimo Sirainen struct imapc_client_settings set;
657afb33796f8216c568ad813627da89970760beTimo Sirainen struct ssl_iostream_context *ssl_ctx;
657afb33796f8216c568ad813627da89970760beTimo Sirainen
6aafdd81aa1e12c127941c1ebd87e8ee4697ec3eTimo Sirainen imapc_untagged_callback_t *untagged_callback;
6aafdd81aa1e12c127941c1ebd87e8ee4697ec3eTimo Sirainen void *untagged_context;
6aafdd81aa1e12c127941c1ebd87e8ee4697ec3eTimo Sirainen
27a44fcfd8d19bffe0f267f20a2b5d3fe7600fddTimo Sirainen imapc_state_change_callback_t *state_change_callback;
5363f51ad46344f4e5952f2fef211a7cf8f95ddcTimo Sirainen void *state_change_context;
9d75363d3fbabc2fbc2d80f06672e3ed8965804aTimo Sirainen
9d75363d3fbabc2fbc2d80f06672e3ed8965804aTimo Sirainen imapc_command_callback_t *login_callback;
fbee9bffb56d882b98146dd0de76a5bcccc2bdc3Timo Sirainen void *login_context;
70905e51a5148bd5613cb04720807177474a2496Timo Sirainen
70905e51a5148bd5613cb04720807177474a2496Timo Sirainen ARRAY(struct imapc_client_connection *) conns;
70905e51a5148bd5613cb04720807177474a2496Timo Sirainen bool logging_out;
70905e51a5148bd5613cb04720807177474a2496Timo Sirainen
9ed2951bd0bb1878a27437d7c00611b2baadd614Timo Sirainen struct ioloop *ioloop;
6ef7e31619edfaa17ed044b45861d106a86191efTimo Sirainen bool stop_on_state_finish;
6ef7e31619edfaa17ed044b45861d106a86191efTimo Sirainen};
6ef7e31619edfaa17ed044b45861d106a86191efTimo Sirainen
50782de8a9d5ebe11ee61496b4e695a1d3875230Timo Sirainenstruct imapc_client_mailbox {
50782de8a9d5ebe11ee61496b4e695a1d3875230Timo Sirainen struct imapc_client *client;
50782de8a9d5ebe11ee61496b4e695a1d3875230Timo Sirainen struct imapc_connection *conn;
50782de8a9d5ebe11ee61496b4e695a1d3875230Timo Sirainen struct imapc_msgmap *msgmap;
50782de8a9d5ebe11ee61496b4e695a1d3875230Timo Sirainen struct timeout *to_send_idle;
a7e2c98560cf54dc656711a237cb07da8a5a9ee4Timo Sirainen
a7e2c98560cf54dc656711a237cb07da8a5a9ee4Timo Sirainen void (*reopen_callback)(void *context);
daa7e7459749ae8f82cd3eed9c44522d81c609a3Timo Sirainen void *reopen_context;
ad49932dae8ba31e07544b66bbc4f4de707a751cTimo Sirainen
ab90f702ceedb7ba445a9a592be0b213b27cbafaStephan Bosch void *untagged_box_context;
ab90f702ceedb7ba445a9a592be0b213b27cbafaStephan Bosch
3b8d05391336c0e4d24c8ddcc962f350409ffbd3Timo Sirainen bool reconnect_ok;
3b8d05391336c0e4d24c8ddcc962f350409ffbd3Timo Sirainen bool reconnecting;
657afb33796f8216c568ad813627da89970760beTimo Sirainen bool closing;
2872c818f9c6704609f4d67d984b033a63e3a108Timo Sirainen};
657afb33796f8216c568ad813627da89970760beTimo Sirainen
66d2db642fe24d555d113ba463e446b038d476efTimo Sirainenextern unsigned int imapc_client_cmd_tag_counter;
66d2db642fe24d555d113ba463e446b038d476efTimo Sirainen
657afb33796f8216c568ad813627da89970760beTimo Sirainenvoid imapc_client_ref(struct imapc_client *client);
657afb33796f8216c568ad813627da89970760beTimo Sirainenvoid imapc_client_unref(struct imapc_client **client);
void imapc_command_set_mailbox(struct imapc_command *cmd,
struct imapc_client_mailbox *box);
void imapc_client_try_stop(struct imapc_client *client);
#endif