1 /*
2 ** Copyright 2003, Double Precision Inc.
3 **
4 ** See COPYING for distribution information.
5 */
6 
7 #ifndef libmail_imapidle_H
8 #define libmail_imapidle_H
9 
10 #include "libmail_config.h"
11 
12 #include "mail.H"
13 #include "imap.H"
14 
15 #include <time.h>
16 
17 LIBMAIL_START
18 
19 class imapIdleHandler : public imapCommandHandler {
20 
21 	bool idleOnOff;
22 
23 	bool idling;
24 	bool shouldTerminate;
25 	bool terminating;
26 
27 	bool waiting;
28 	struct timeval waitingUntil;
29 
30 	mail::callback *callback;
31 
32 	void terminateIdle(imap &);
33 
34 	const char *getName();
35 	void timedOut(const char *errmsg);
36 
37 
38 	bool getTimeout(imap &, int &);
39 
40 public:
41 	imapIdleHandler(bool idleOnOffArg, mail::callback *callbackArg);
42 	~imapIdleHandler();
43 
44 	void installed(imap &);
45 
46 	bool untaggedMessage(imap &imapAccount, std::string name);
47 
48 	bool taggedMessage(imap &imapAccount, std::string name,
49 			   std::string message,
50 			   bool okfail, std::string errmsg);
51 
52 	bool continuationRequest(imap &imapAccount,
53 				 std::string request);
54 
55 	void anotherHandlerInstalled(imap &imapAccount);
56 };
57 
58 
59 LIBMAIL_END
60 #endif
61