home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 2003 April
/
VPR0304.ISO
/
AIBO
/
AiboBiff2
/
MailChecker
/
MailChecker.h
< prev
next >
Wrap
C/C++ Source or Header
|
2002-12-20
|
2KB
|
76 lines
#ifndef MailChecker_h_DEFINED
#define MailChecker_h_DEFINED
#include <OPENR/OObject.h>
#include <OPENR/OSubject.h>
#include <OPENR/OObserver.h>
#include "TCPConnection.h"
#include "MailCheckerConfig.h"
#include "def.h"
#include <list>
using namespace std;
enum POP3State {
POP3_IDLE,
POP3_CONNECTED,
POP3_USER,
POP3_PASS,
POP3_STAT,
POP3_UIDL,
POP3_QUIT,
POP3_CLOSE
};
class MailChecker: public OObject {
public:
MailChecker();
virtual ~MailChecker() {}
OSubject* subject[numOfSubject];
OObserver* observer[numOfObserver];
virtual OStatus DoInit (const OSystemEvent& event);
virtual OStatus DoStart (const OSystemEvent& event);
virtual OStatus DoStop (const OSystemEvent& event);
virtual OStatus DoDestroy(const OSystemEvent& event);
void ReadyNewMail(const OReadyEvent& event);
void NotifyMailCheck(const ONotifyEvent& event);
void ConnectCont(void* msg);
void SendCont (void* msg);
void ReceiveCont(void* msg);
void CloseCont (void* msg);
private:
OStatus Connect(int index);
OStatus Send (int index);
OStatus Receive(int index);
OStatus Close (int index);
OStatus InitTCPConnection(int index);
void SetSendData(int index);
void SetReceiveData(int index);
antStackRef ipstackRef;
TCPConnection connection[MCHECK_CONNECTION_MAX];
private:
int CheckStat(const char* resp);
void CheckNewMail(const char* resp);
void GetUIDL(const char* resp, list<string>& li);
int CheckUIDL(list<string>& liold, list<string>& linew);
void printRecvData(const char* src);
char serverip[40];
int serverport;
char username[40];
char password[40];
POP3State pop3State;
list<string> listUID;
};
#endif // MailChecker_h_DEFINED