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

📄 pop31.h

📁 pop3例子程序
💻 H
字号:
// Pop31.h: interface for the CPop3 class.
//mailto: zmoraa@box43.pl
// 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 "Gniazdo.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_)

⌨️ 快捷键说明

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