summaryrefslogtreecommitdiff
path: root/protocols/YAMN/src/proto/pop3/pop3comm.h
blob: a08b2490174bc5d86a0c1933514daa3f143ca371 (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
#ifndef __POP3COMM_H
#define __POP3COMM_H

#define	POP3_FILEVERSION	1	//Version of aditional information stored in book file

struct CPOP3Account : public CAccount
{
	// We can use SCOUNTER structure, because this is internal plugin.
	// This SO is used to determine if any POP3 account is in "write access" mode
	static SCOUNTER AccountWriterSO;

	// It is usefull to have client structure in account. With this structure we have access to account's socket.
	// This is related to InternetQueries and UseInternetFree
	// This member should be synchronized with UseInternetFree
	class CPop3Client Client;

	// This member is usefull for MIME headers. It is default codepage, if no other codepage found
	uint16_t CP;				//access only through AccountAccessSO

	// In this memeber last error code is stored
	uint32_t SystemError;			//access through UseInternetFree

	// We use only counter from this object and it is # of threads waiting to work on internet.
	// We use event UseInternet to access critical sections.
	// It is usefull in 2 ways: we have mutual exclusion that only one thread works with account on internet.
	// Thread, which has done its work with account on internet can close socket, but it is not needed, when any other
	// thread wants to work (e.g. we have deleted mails, but when deleting, another thread wants to check new mail, so
	// we delete all needed mails and check if there's thread that wants to work. If yes, we do not need to quit session,
	// we leave socket open, and leave internet. Another thread then start checking and does not connect, does not send
	// user and password... because socket is open- it continues)
	SCOUNTER InternetQueries;
	HANDLE UseInternetFree;

	CPOP3Account();
	~CPOP3Account();
};

struct POP3_ERRORCODE
{
	BOOL SSL;
	uint32_t AppError;
	uint32_t POP3Error;
	uint32_t NetError;
	uint32_t SystemError;
};

enum
{
	EACC_QUEUEALLOC=1,	//memory allocation
	EACC_STOPPED,		//stop account
};

#define	NO_MAIL_FOR_DELETE	1

#endif