⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inetserverdlg.h

📁 email client and support pop3、smtp、imap protocol.
💻 H
字号:
// InetServerDlg.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CInetServerDlg dialog
#include "afxtempl.h" //for CArray
#include "D_Pop3.h"
#include "D_Service.h"

#define MAXMESSAGELENGTH 255

class CClientSocket;
class CListeningSocket;


class MailUserInfo
{
public:
	CString Flags;
	CString Username;
	CString Password;
	CString Comment;
};


class SMTPForwardInfo
{
public:
	CString Fname;
	CString FnameCTL;
	CString Sender;
	CString Rcpt;
	int sendnr;
	int error;
	time_t timestamp;
	BOOL islocal;
};



class MapiUserInfo
{
public:
    CString Popuser;
    CString Mapiuser;
    CString Mapiaddres;
};

class MyAkaInfo
{
public:
	CString Text;
};


class SocketInfo
{
public:

	SocketInfo::SocketInfo()
	{
		showlog = FALSE;
		status2 = 0;
		status = 0;
		typ = 0;
		openf= 0;
		Temp = "";
		Username = "unknown";
		dontwrite = FALSE;
	}


	CClientSocket* pSock;
	CString ip;
	CString Temp;
	CString Username;
	CString info1;
	CString info2;
	CString info3;
	CString info4;
	CString Sender;
	CString Fname;
	CString FnameCTL;
	int status2;
	int status;
	int typ;
	int openf;
	char crstr[6];
	BOOL showlog;

	BOOL dontwrite;
	FILE *mail;
	/*Typ   Port:
	pop3port	3
	smtpport	4
	daytimeport	8
	telnet      9
	*/
};
class DeleteInfo
{
public:
	CString Filename;
	CClientSocket* pSocket;
};

class CInetServerDlg : public CDialog
{
	// Construction
public:
	unsigned long SMTPThreadID;
	
	void AddToLogAll(CString expr);
	LRESULT OnWebClose(WPARAM uID, LPARAM lEvent);

	BOOL FileExist(CString filename);
	CInetServerDlg(CWnd* pParent = NULL);	// standard constructor
	void ProcessPendingAccept();
	void ProcessPendingRead(CClientSocket* pSocket);
	void ProcessPendingConnect(CClientSocket* pSocket);
	CArray<SocketInfo,SocketInfo> SocketList;
	CArray<DeleteInfo,DeleteInfo> DeleteList;
	CArray<MailUserInfo,MailUserInfo> MailUserList;
	CArray<MyAkaInfo,MyAkaInfo> MyAkaList;
    CArray<MapiUserInfo,MapiUserInfo> MapiUserList; //- MAPI stores pop3user & mapiuser link
	void LogError (CString expr);
	
	
	CListeningSocket* m_pSocketWebMail;
	CListeningSocket* m_pSocketPop3;
	CListeningSocket* m_pSocketSmtp;
	CListeningSocket* m_pSocketDayTime;
	CListeningSocket* m_pSocketTelnet;

	BOOL MatchFlag(CString Username,char flag);

	HANDLE smtpthread;

	

	bool MAPILoadSuccess;

	int pop3port;
	int smtpport;
	int daytimeport;
	int telnetport;
	int webmailport;
	
	
	int pop3allowed;
	int smtpallowed;
	int daytimeallowed;
	int telnetallowed;
	int webmailallowed;
	
	
	
	
	void ReadCfg();
	void AddLog (CString expr);
	LRESULT OnAddLog(WPARAM uID, LPARAM lEvent);
	
	void ReadPop3(CClientSocket* pSocket,int i);
	void ReadSmtp(CClientSocket* pSocket,int i);
	void ReadTelnet(CClientSocket* pSocket,int i);
	void ReadWebMail(CClientSocket* pSocket,int i);

	void CloseWebMail(CClientSocket* pSocket,int i);

	void ProcessNewMail(CString CTL, CString Fname,CString Sender);
	void ProcessDelete();
	void ChngList();
	void ReadMailConfig(int type);
	void SavePOP3Users();

	void ProcessPOP32CMC(CString Fname);
	LRESULT OnTrayNotification(WPARAM uID, LPARAM lEvent);


	//InetServ OK and ERROR messages (since version 2.3.4)
	
	char pop3_msg00[MAXMESSAGELENGTH]; //+OK inetserv ready. %s
	char pop3_msg01[MAXMESSAGELENGTH]; //+OK HELO
	char pop3_msg02[MAXMESSAGELENGTH]; //-ERR unknown message
	char pop3_msg03[MAXMESSAGELENGTH]; //+OK user accepted
	char pop3_msg04[MAXMESSAGELENGTH]; //-ERR invalid username
	char pop3_msg05[MAXMESSAGELENGTH]; //welcome user!
	char pop3_msg06[MAXMESSAGELENGTH]; //wrong password for this user, try again!
	char pop3_msg07[MAXMESSAGELENGTH]; //OK closing connection
	char pop3_msg08[MAXMESSAGELENGTH]; // message not found
	char pop3_msg09[MAXMESSAGELENGTH]; // ok, rset
	char pop3_msg10[MAXMESSAGELENGTH]; // -ERR no data found
	char pop3_msg11[MAXMESSAGELENGTH]; // -ERR nothing to delete
	char pop3_msg12[MAXMESSAGELENGTH]; // +OK Message deleted
	char pop3_msg13[MAXMESSAGELENGTH]; // -ERR unknown command


	// Dialog Data
	//{{AFX_DATA(CInetServerDlg)
	enum { IDD = IDD_INETSERVER_DIALOG };
	CEdit	mc_log;
	CListBox	mc_list1;
	CString	m_log;
	//}}AFX_DATA
	
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CInetServerDlg)
protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
	//}}AFX_VIRTUAL
	
	// Implementation
protected:
	HICON m_hIcon;
	
	// Generated message map functions
	//{{AFX_MSG(CInetServerDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnPop3();
	afx_msg void OnService();
	afx_msg void OnAbout();
	afx_msg void OnDestroy();
	afx_msg void OnMapisetup();
	afx_msg void OnTimer(UINT nIDEvent);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()



};

class CListeningSocket : public CAsyncSocket
{
	DECLARE_DYNAMIC(CListeningSocket);
private:
	CListeningSocket(const CListeningSocket& rSrc);         // no implementation
	void operator=(const CListeningSocket& rSrc);  // no implementation
	
	// Construction
public:
	CListeningSocket(CInetServerDlg* pDoc);
	
	// Attributes
public:
	CInetServerDlg* m_pDoc;
	
	// Overridable callbacks
protected:
	virtual void OnAccept(int nErrorCode);
	
	
	// Implementation
public:
	virtual ~CListeningSocket();
	
};


class CClientSocket : public CAsyncSocket
{
	DECLARE_DYNAMIC(CClientSocket);
private:
	CClientSocket(const CClientSocket& rSrc);         // no implementation
	void operator=(const CClientSocket& rSrc);  // no implementation
	
	// Construction
public:
	CClientSocket(CInetServerDlg* m_pDoc);
	virtual int Send(const void* lpBuf, int nBufLen, int nFlags = 0);
	
	// Attributes
public:
	int m_nMsgCount;
	CInetServerDlg* m_pDoc;
	
	// Overridable callbacks
protected:
	virtual void OnReceive(int nErrorCode);
	virtual void OnClose( int nErrorCode );
	virtual void OnConnect(int nErrorCode);
	// Implementation
public:
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -