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
95
96
97
|
#ifndef __POP3COMM_H
#define __POP3COMM_H
#include <windows.h>
#include "pop3.h"
#include "m_protoplugin.h"
//We can use synchro.h because this is internal plugin. If you use external plugin,
//and you want to use SO for your plugin, you can use YAMN's SO.
//All you need is to include synchro.h and use YAMN's exported synchronization functions.
#include "m_synchro.h"
//For mail exported functions defintions
#include "m_mails.h"
#include "../../debug.h"
#define POP3_FILEVERSION 1 //Version of aditional information stored in book file
typedef 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 PSCOUNTER 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
WORD CP; //access only through AccountAccessSO
// In this memeber last error code is stored
DWORD 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)
PSCOUNTER InternetQueries;
HANDLE UseInternetFree;
CPOP3Account();
~CPOP3Account();
} POP3ACCOUNT,*HPOP3ACCOUNT;
typedef struct POP3LayeredError
{
BOOL SSL;
DWORD AppError;
DWORD POP3Error;
DWORD NetError;
DWORD SystemError;
} POP3_ERRORCODE,*PPOP3_ERRORCODE;
struct YAMNExportedFcns
{
YAMN_SETPROTOCOLPLUGINFCNIMPORTFCN SetProtocolPluginFcnImportFcn;
YAMN_WAITTOWRITEFCN WaitToWriteFcn;
YAMN_WRITEDONEFCN WriteDoneFcn;
YAMN_WAITTOREADFCN WaitToReadFcn;
YAMN_READDONEFCN ReadDoneFcn;
YAMN_SCMANAGEFCN SCGetNumberFcn;
YAMN_SCMANAGEFCN SCIncFcn;
YAMN_SCMANAGEFCN SCDecFcn;
YAMN_SETSTATUSFCN SetStatusFcn;
YAMN_GETSTATUSFCN GetStatusFcn;
};
struct MailExportedFcns
{
YAMN_SYNCHROMIMEMSGSFCN SynchroMessagesFcn;
YAMN_TRANSLATEHEADERFCN TranslateHeaderFcn;
YAMN_APPENDQUEUEFCN AppendQueueFcn;
YAMN_DELETEMIMEQUEUEFCN DeleteMessagesToEndFcn;
YAMN_DELETEMIMEMESSAGEFCN DeleteMessageFromQueueFcn;
YAMN_FINDMIMEMESSAGEFCN FindMessageByIDFcn;
YAMN_CREATENEWDELETEQUEUEFCN CreateNewDeleteQueueFcn;
};
enum
{
EACC_QUEUEALLOC=1, //memory allocation
EACC_STOPPED, //stop account
};
#define NO_MAIL_FOR_DELETE 1
#define POP3_DELETEFROMCHECK 1
#endif
|