| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
 | /*
** Copyright 2002-2004, Double Precision Inc.
**
** See COPYING for distribution information.
*/
#ifndef libmail_imaplisthandler_H
#define libmail_imaplisthandler_H
#include "libmail_config.h"
#include "imaphandler.H"
#include "imapfolders.H"
#include "imapparsefmt.H"
#include <vector>
///////////////////////////////////////////////////////////////////////////
//
// A list command.
LIBMAIL_START
class imapListHandler : public imapCommandHandler {
	mail::callback::folderList &callback1;
	mail::callback &callback2;
	std::string hier;
	bool oneFolderOnly;
	bool fallbackOneFolderOnly;
	// True if this LIST command is invoked to determine the folder
	// hierarchy separator.  Otherwise, the LIST command is invoked
	// to obtain a list of subfolders.
	std::vector <imapFolder> folders;
public:
	imapListHandler(mail::callback::folderList &myCallback,
			      mail::callback &myCallback2,
			      std::string myHier, bool oneFolderOnlyArg);
	~imapListHandler();
	const char *getName();
	void timedOut(const char *errmsg);
	void installed(imap &imapAccount);
private:
	bool untaggedMessage(imap &imapAccount, std::string name);
	bool taggedMessage(imap &imapAccount, std::string name, std::string message,
			   bool okfail, std::string errmsg);
};
// Untagged LIST parser
class imapLIST : public imapHandlerStructured {
	std::vector <imapFolder> &folderList;
	size_t pfixLength;
	bool oneNameOnly;
	void (imapLIST::*next_func)(imap &, Token);
	bool hasChildren, hasNoChildren, marked, unmarked, noSelect;
	std::string hiersep;
protected:
	imapparsefmt xattributes;
public:
	imapLIST(std::vector<imapFolder> &mylist, size_t pfixLengthArg,
		       bool oneNameOnlyArg=false);
	~imapLIST();
	void installed(imap &imapAccount);
private:
	const char *getName();
	void timedOut(const char *errmsg);
	void process(imap &imapAccount, Token t);
	void start_attribute_list(imap &imapAccount, Token t);
	void get_attribute(imap &imapAccount, Token t);
	void get_hiersep(imap &imapAccount, Token t);
	void get_name(imap &imapAccount, Token t);
	void get_xattr_start(imap &imapAccount, Token t);
	void get_xattr_do(imap &imapAccount, Token t);
	virtual void processExtendedAttributes(imapFolder &);
};
LIBMAIL_END
#endif
 |