Pop3.h
资源名称:POP3SMTP.rar [点击查看]
上传用户:pyhyhg
上传日期:2022-08-11
资源大小:56k
文件大小:2k
源码类别:
Email客户端
开发平台:
Visual C++
- // Pop3.h: interface for the CPop3 class.
- // feel free to e-mail me!
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_POP31_H__1957A2DC_027A_43AF_82B6_789B397147F3__INCLUDED_)
- #define AFX_POP31_H__1957A2DC_027A_43AF_82B6_789B397147F3__INCLUDED_
- #include "Pop3Base4.h"
- #include <vector>
- #include <strstream>
- #include <string>
- using namespace std;
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- //enum type describing actual pop3 state
- typedef enum {FIRST=0,USER,PASS,STAT,LIST,RETR,ENDRETR,DELE,GOON} STATE;
- #define S_GETNUMMSGS 5 //send when user can obtain number of messages
- #define S_GETSIZEMSGS 6 //as above, but size of messages
- #define S_ENDRETR 7 //send when done retrieving
- //simple struct that keeps message data, size, and retrieving size
- typedef struct
- {
- CString text;
- int msgSize, retrSize;
- } MESSAGEPROP;
- class CPop3 : public CBase4Pop3
- {
- public:
- void WriteMsg(int i,CString name); //save msg to a file
- //gets the most important message fields: From, To, Date, Subject, Body
- //from entire message
- CString GetMsgStuff(int i);
- //gets only message body
- CString GetMsgBody(int i);
- //want to delete messages after receiving?
- void DelAfterRead(BOOL del=FALSE);
- //gets only message subject
- CString GetMsgSubject(int i);
- //gets entire message
- CString GetMsg(int i);
- //gets number of received from server msgs
- int GetRetrMsgNum();
- //gest size of all msgs
- int GetSizeMsg();
- //gets number of msgs that are on server
- int GetNumMsg();
- //gets string error
- CString GetError();
- //closes and quits from pop3 server
- void Close();
- //sets username and password
- void SetProp(CString u, CString p);
- //gets last message recievied from server
- void GetLastMsg(CString &);
- //receiving event
- void OnReceive(int err);
- CPop3();
- virtual ~CPop3();
- private:
- //reads line from index in src and appends it to dst
- void ReadLn(int index,CString src, CString &dst);
- //main function
- void ParseMsg();
- CString lastMsg, error;
- STATE state;
- CString user, pass;
- int numMsg, sizeMsg, retrMsg;//分别表示信件数目、大小、已经收到的信件数目
- vector<MESSAGEPROP> msgs; //vector for message stuff
- BOOL delAfterRead;
- int delMsg;
- };
- #endif // !defined(AFX_POP31_H__1957A2DC_027A_43AF_82B6_789B397147F3__INCLUDED_)