Initial
This commit is contained in:
83
pop/POPCLNT.HPP
Normal file
83
pop/POPCLNT.HPP
Normal file
@@ -0,0 +1,83 @@
|
||||
#ifndef _POP_POPCLIENT_HPP_
|
||||
#define _POP_POPCLIENT_HPP_
|
||||
#ifndef _COMMON_WINDOWS_HPP_
|
||||
#include <common/windows.hpp>
|
||||
#endif
|
||||
#ifndef _SOCKET_SOCKET_HPP_
|
||||
#include <socket/socket.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_BLOCK_HPP_
|
||||
#include <common/block.hpp>
|
||||
#endif
|
||||
|
||||
class String;
|
||||
|
||||
class POPClient
|
||||
{
|
||||
public:
|
||||
POPClient(void);
|
||||
virtual ~POPClient();
|
||||
BOOL open(const String &hostName);
|
||||
void close(void);
|
||||
BOOL isConnected(void)const;
|
||||
BOOL isLoggedIn(void)const;
|
||||
BOOL quit(void);
|
||||
BOOL authenticate(const String &user,const String &password);
|
||||
BOOL retrieve(WORD msgNum,Block<String> &messageLines);
|
||||
BOOL top(Block<String> &messageLines,WORD msgNum,WORD lineCount=10);
|
||||
BOOL dele(WORD msgNum);
|
||||
BOOL rset(void);
|
||||
BOOL noop(void);
|
||||
BOOL stat(WORD &messages,WORD &octets);
|
||||
protected:
|
||||
virtual void message(const String &messageString);
|
||||
virtual void message(Block<String> &messageStrings);
|
||||
private:
|
||||
enum {POPPort=110};
|
||||
enum POPCmds{Quit,User,Pass,Stat,Retr,Rset,Dele,Noop,Top};
|
||||
enum POPStatus{Ok,Error};
|
||||
POPClient(const POPClient &somePOPClient);
|
||||
POPClient &operator=(const POPClient &somePOPClient);
|
||||
void isLoggedIn(BOOL isLoggedIn);
|
||||
WORD putControlData(const String &stringData,WORD waitForResponse=TRUE);
|
||||
BOOL isInNakResponse(Block<String> &responseLines);
|
||||
BOOL isInAckResponse(Block<String> &responseLines);
|
||||
BOOL receive(Block<String> &responseLines);
|
||||
BOOL receiveLines(Block<String> &receiveStrings);
|
||||
WORD getControlData(void);
|
||||
void createCmds(void);
|
||||
void createStats(void);
|
||||
|
||||
Socket mPOPControl;
|
||||
WSASystem mWSASystem;
|
||||
Block<String> mPOPCmds;
|
||||
Block<String> mPOPStatus;
|
||||
BOOL mIsLoggedIn;
|
||||
String mSpace;
|
||||
};
|
||||
|
||||
inline
|
||||
BOOL POPClient::isConnected(void)const
|
||||
{
|
||||
return mPOPControl.isConnected();
|
||||
}
|
||||
|
||||
inline
|
||||
BOOL POPClient::isLoggedIn(void)const
|
||||
{
|
||||
return mIsLoggedIn;
|
||||
}
|
||||
|
||||
inline
|
||||
void POPClient::isLoggedIn(BOOL isLoggedIn)
|
||||
{
|
||||
mIsLoggedIn=isLoggedIn;
|
||||
}
|
||||
|
||||
inline
|
||||
void POPClient::close(void)
|
||||
{
|
||||
mPOPControl.destroy();
|
||||
isLoggedIn(FALSE);
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user