client.h revision 8e4e0f49d4221d506d9bf7fe6ce224fae3e34450
a6ab8f00351265e35b79f3a22b1f5a4978ae5c35Timo Sirainen#ifndef CLIENT_H
a6ab8f00351265e35b79f3a22b1f5a4978ae5c35Timo Sirainen#define CLIENT_H
a6ab8f00351265e35b79f3a22b1f5a4978ae5c35Timo Sirainen
767431e5084a037c4dbefdf30ebfa03c84b1f449Timo Sirainen#include "network.h"
1c633f71ec2060e5bfa500a97f34cd881a958ecdTimo Sirainen#include "master.h"
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen#include "client-common.h"
5fb3f13537dffd15a31e997da133a721c0728af8Timo Sirainen
97437f768d1a3e6134fed1971202803fd250eef2Timo Sirainenstruct imap_client {
a6ab8f00351265e35b79f3a22b1f5a4978ae5c35Timo Sirainen struct client common;
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen time_t created;
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen int refcount;
cf63dc8723b971cc80638fccbf494d961cbafc7fTimo Sirainen
a6ab8f00351265e35b79f3a22b1f5a4978ae5c35Timo Sirainen struct io *io;
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen struct istream *input;
e09c7dc961cb9cab04ec7cc79215c2f6318fbde0Timo Sirainen struct ostream *output;
23878bd03d1de531e3261a25598beec621351910Timo Sirainen struct imap_parser *parser;
23878bd03d1de531e3261a25598beec621351910Timo Sirainen struct timeout *to_idle_disconnect, *to_auth_waiting;
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen struct login_proxy *proxy;
cf63dc8723b971cc80638fccbf494d961cbafc7fTimo Sirainen char *proxy_user, *proxy_password;
cf63dc8723b971cc80638fccbf494d961cbafc7fTimo Sirainen
cf63dc8723b971cc80638fccbf494d961cbafc7fTimo Sirainen unsigned int bad_counter;
cf63dc8723b971cc80638fccbf494d961cbafc7fTimo Sirainen
a6ab8f00351265e35b79f3a22b1f5a4978ae5c35Timo Sirainen const char *cmd_tag, *cmd_name;
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen unsigned int cmd_finished:1;
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen unsigned int proxy_login_sent:1;
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen unsigned int skip_line:1;
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen unsigned int input_blocked:1;
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen unsigned int destroyed:1;
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen unsigned int greeting_sent:1;
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen};
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainenvoid client_destroy(struct imap_client *client, const char *reason);
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainenvoid client_destroy_internal_failure(struct imap_client *client);
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainenvoid client_send_line(struct imap_client *client, const char *line);
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainenvoid client_send_tagline(struct imap_client *client, const char *line);
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainenbool client_read(struct imap_client *client);
7358272563d8ef77366447708ab0e58c0cff4151Timo Sirainenbool client_skip_line(struct imap_client *client);
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainenvoid client_input(struct imap_client *client);
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainenvoid client_ref(struct imap_client *client);
7358272563d8ef77366447708ab0e58c0cff4151Timo Sirainenbool client_unref(struct imap_client *client);
7358272563d8ef77366447708ab0e58c0cff4151Timo Sirainen
97437f768d1a3e6134fed1971202803fd250eef2Timo Sirainenvoid client_set_auth_waiting(struct imap_client *client);
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen
1db62753d9e3b5d71018889c8ef0a3722a307455Timo Sirainen#endif
a6ab8f00351265e35b79f3a22b1f5a4978ae5c35Timo Sirainen