diff options
| author | Sam Varshavchik | 2013-08-19 16:39:41 -0400 | 
|---|---|---|
| committer | Sam Varshavchik | 2013-08-25 14:43:51 -0400 | 
| commit | 9c45d9ad13fdf439d44d7443ae75da15ea0223ed (patch) | |
| tree | 7a81a04cb51efb078ee350859a64be2ebc6b8813 /libmail/imapfolder.H | |
| parent | a9520698b770168d1f33d6301463bb70a19655ec (diff) | |
| download | courier-libs-9c45d9ad13fdf439d44d7443ae75da15ea0223ed.tar.bz2 | |
Initial checkin
Imported from subversion report, converted to git. Updated all paths in
scripts and makefiles, reflecting the new directory hierarchy.
Diffstat (limited to 'libmail/imapfolder.H')
| -rw-r--r-- | libmail/imapfolder.H | 140 | 
1 files changed, 140 insertions, 0 deletions
| diff --git a/libmail/imapfolder.H b/libmail/imapfolder.H new file mode 100644 index 0000000..4851fd2 --- /dev/null +++ b/libmail/imapfolder.H @@ -0,0 +1,140 @@ +/* +** Copyright 2002, Double Precision Inc. +** +** See COPYING for distribution information. +*/ +#ifndef libmail_imapfolder_H +#define libmail_imapfolder_H + +#include "libmail_config.h" +#include "maildir/maildirkeywords.h" +#include "mail.H" +#include "imap.H" +#include <vector> + +LIBMAIL_START + +class imap; + +class imapFOLDERinfo { + +public: +	mail::callback::folder &folderCallback; + +	imapFOLDERinfo(std::string pathArg, +		       mail::callback::folder &folderCallbackArg); +	virtual ~imapFOLDERinfo(); + +	class indexInfo : public mail::messageInfo { +	public: +		mail::keywords::Message keywords; + +		indexInfo(); +		~indexInfo(); +	}; + +	std::vector<indexInfo> index; +	size_t exists; +	// May be less than index.length(), when +	// synchronization is in progress + +	bool closeInProgress; + +	std::string path; + +	virtual void opened(); // Used by SMAP +	virtual void existsMore(mail::imap &, size_t)=0; +	virtual void resetMailCheckTimer()=0; +	virtual void setUid(size_t, std::string); +}; + + +///////////////////////////////////////////////////////////////////////// +// +// A currently-SELECTED folder. +// +// This object handles all kinds of messages from the IMAP server when a +// folder is open. +// + +class imapFOLDER : public imapCommandHandler, public imapFOLDERinfo { + +	int mailCheckInterval; + +public: + +	class existsCallback : public mail::callback { + +		void reportProgress(size_t bytesCompleted, +				    size_t bytesEstimatedTotal, + +				    size_t messagesCompleted, +				    size_t messagesEstimatedTotal); // TODO + +	public: +		existsCallback(); +		~existsCallback(); +		class imapFOLDER *me; + +	private: +		void success(std::string message); +		void fail(std::string message); +	} *existsNotify; + +	std::string uidv; + +	imapFOLDER(std::string pathArg, std::string uidvArg, size_t existsArg, +		   mail::callback::folder &folderCallback, +		   mail::imap &myserver); + +	~imapFOLDER(); + +	static const char name[]; + +	void installed(imap &imapAccount); +private: +	const char *getName(); +	void timedOut(const char *); +	virtual int getTimeout(imap &); + +	bool untaggedMessage(imap &imapAccount, std::string name); +	bool taggedMessage(imap &imapAccount, std::string name, +			   std::string message, +			   bool okfail, std::string errmsg); + +	void existsMore(mail::imap &, size_t); +	void resetMailCheckTimer(); +	void setUid(size_t, std::string); +}; + +// The SMAP version + +class smapFOLDER : public imapFOLDERinfo, public imapHandler { + +	int mailCheckInterval; + +	void installed(imap &); +	int process(imap &imapAccount, std::string &buffer); +	const char *getName(); +	void timedOut(const char *errmsg); + +	int getTimeout(mail::imap &imapAccount); + +	bool openedFlag; + +public: +	static const char name[]; + +	smapFOLDER(std::string pathArg, +		   mail::callback::folder &folderCallbackArg, +		   mail::imap &myserver); +	~smapFOLDER(); + +	void existsMore(mail::imap &imapAccount, size_t n); +	void resetMailCheckTimer(); +	void opened(); +}; + +LIBMAIL_END + +#endif | 
