common.h revision 80bade1fe92cfb591a43da66e109a4cde2ec7d9b
5f5870385cff47efd2f58e7892f251cf13761528Timo Sirainen#ifndef __COMMON_H
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen#define __COMMON_H
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen#include "lib.h"
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen#include "client.h"
cbc61fcb33b370d049c16a3c44568b4deb4e2b33Timo Sirainen
a1607f6001a9949e1cf9d49eb0aa936dbb4c77ffTimo Sirainen/* Disconnect client after idling this many seconds */
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen#define CLIENT_IDLE_TIMEOUT (60*30)
00d58fcfe8191d6ce7efa801d289a5c0fe88d1aeTimo Sirainen
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen/* If we can't send anything to client for this long, disconnect the client */
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen#define CLIENT_OUTPUT_TIMEOUT (5*60)
f6d57a2c182f63cd52819f0abb3c3d9f828afe19Timo Sirainen
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen/* Stop buffering more data into output stream after this many bytes */
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen#define CLIENT_OUTPUT_OPTIMAL_SIZE 2048
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen/* Disconnect client when it sends too many bad commands in a row */
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen#define CLIENT_MAX_BAD_COMMANDS 20
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen/* RFC-2683 recommends at least 8000 bytes. Some clients however don't
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen break large message sets to multiple commands, so we're pretty liberal
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen by default. */
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen#define DEFAULT_IMAP_MAX_LINE_LENGTH 65536
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen#define DEFAULT_MAX_KEYWORD_LENGTH 50
0df9428baed48afaff90b4d4f03792d2fd756a43Timo Sirainen
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainenenum client_workarounds {
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen WORKAROUND_OE6_FETCH_NO_NEWMAIL = 0x01,
f6d57a2c182f63cd52819f0abb3c3d9f828afe19Timo Sirainen WORKAROUND_OUTLOOK_IDLE = 0x02,
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen WORKAROUND_NETSCAPE_EOH = 0x04,
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen WORKAROUND_TB_NEGATIVE_FETCH = 0x08
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen};
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainenextern struct ioloop *ioloop;
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainenextern unsigned int max_keyword_length;
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainenextern unsigned int imap_max_line_length;
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainenextern enum client_workarounds client_workarounds;
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen
cbc61fcb33b370d049c16a3c44568b4deb4e2b33Timo Sirainenextern string_t *capability_string;
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainen
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainenextern void (*hook_mail_storage_created)(struct mail_storage **storage);
cf7164ece50797a67fc4bfb5889022ac93a36a8aTimo Sirainenextern void (*hook_client_created)(struct client **client);
4462bd7b4c7ef3de006f060e155a90e5de7cae21Timo Sirainen
f6c1297c26b355c4aec2a08978f51ec3efecb351Timo Sirainen#endif
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen