File: smap.H

package info (click to toggle)
cone 0.89-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 25,628 kB
  • ctags: 14,171
  • sloc: ansic: 85,400; cpp: 82,903; sh: 11,713; makefile: 1,732; perl: 832; yacc: 291; sed: 16
file content (86 lines) | stat: -rw-r--r-- 2,038 bytes parent folder | download
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
/*
** Copyright 2003, Double Precision Inc.
**
** See COPYING for distribution information.
*/
#ifndef libmail_smap_H
#define libmail_smap_H

#include "libmail_config.h"
#include	"mail.H"
#include	"imap.H"

#include	<vector>

LIBMAIL_START

class smapHandler : public imapHandler {

protected:
	mail::callback *defaultCB;

	void timedOut(const char *errmsg);

	bool doDestroy;

public:
	smapHandler(int timeoutValArg=0);
	virtual ~smapHandler();

	int process(imap &imapAccount, std::string &buffer);

	int singleLineProcess(imap &imapAccount, std::string &buffer);
	int multiLineProcessDotStuffed(imap &, std::string &);
	int multiLineProcessBinary(imap &, std::string &);

	virtual bool processLine(imap &imapAccount,
				 std::vector<const char *> &words);

	virtual void beginProcessData(imap &imapAccount,
				      std::vector<const char *> &words,
				      unsigned long estimatedSize);
	virtual void processData(imap &imapAccount,
				 std::string data);
	virtual void endData(imap &imapAccount);

	virtual bool ok(std::string);
	virtual bool fail(std::string);

	virtual void existsOrExpungeSeen();
	// Some subclasses want to know if an EXISTS or EXPUNGE was received

	virtual void fetchedMessageSize(size_t msgNum,
					unsigned long bytes);

	virtual void fetchedInternalDate(size_t msgNum,
					 time_t internalDate);
	virtual void fetchedIndexInfo();

	virtual void messagesRemoved(std::vector< std::pair<size_t, size_t> >
				     &removedList);
	virtual void messageChanged(size_t msgNum);

	static std::string words2path(std::vector<const char *> &);

	static void path2words(std::string, std::vector<std::string> &);

	static void commaSplit(std::string, std::vector<std::string> &);

	void reportProgress(size_t bytesCompleted,
			    size_t bytesEstimatedTotal,

			    size_t messagesCompleted,
			    size_t messagesEstimatedTotal)
	{
		if (defaultCB)
			defaultCB->reportProgress(bytesCompleted,
						  bytesEstimatedTotal,
						  messagesCompleted,
						  messagesEstimatedTotal);
	}

};

LIBMAIL_END

#endif