summaryrefslogtreecommitdiffstats
path: root/libmail/nntpfetch.H
blob: 73a4f56a587af11b8bb3265dd63d1eff4dc2ff35 (plain)
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
/*
** Copyright 2003, Double Precision Inc.
**
** See COPYING for distribution information.
*/
#ifndef libmail_nntpfetch_H
#define libmail_nntpfetch_H

#include "libmail_config.h"

#include "nntp.H"
#include "nntpgroup.H"

#include <string>

LIBMAIL_START

//
// Fetch message contents.
//

class mail::nntp::FetchTaskBase : public mail::nntp::GroupTask {

protected:
	size_t msgNum;
	std::string uid;
	mail::readMode getType;

	unsigned long byteCount;

	void (mail::nntp::FetchTaskBase::*response_func)(const char *);

public:
	FetchTaskBase(mail::callback *callbackArg, nntp &myserverArg,
		      std::string groupNameArg,
		      size_t msgNumArg,
		      std::string uidArg,
		      mail::readMode getTypeArg);
	~FetchTaskBase();

	void selectedGroup(msgnum_t estimatedCount,
			   msgnum_t loArticleCount,
			   msgnum_t hiArticleCount);
	void processGroup(const char *);

private:
	void processStatusResponse(const char *);

	void processFetchResponse(const char *);

	bool foldedNewline;
	void processFetchFoldedResponse(const char *);

	virtual void fetchedText(std::string)=0;
};

class mail::nntp::FetchTask : public mail::nntp::FetchTaskBase {

	callback::message &textCallback;
public:
	FetchTask(callback::message *textCallbackArg, nntp &myserverArg,
		  std::string groupNameArg,
		  size_t msgNumArg,
		  std::string uidArg,
		  mail::readMode getType);

	~FetchTask();
	void fetchedText(std::string);
};


LIBMAIL_END

#endif