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

📄 email.h

📁 解析email的源代码。 mine协议 解码译码
💻 H
字号:
#include <string>
#include <vector>
using namespace std;

class mail_node;
class mail;
typedef vector<mail_node*> Xmail_nodes;

enum Xcode
{//编码方案
	plain=0,                //code为零时仅能说明:multipart下无法确定content的编码方案,或者text下content没有加密两种情况
	Base64,                 //所以仅当content_type为text,code为plain才能给出正确content
	qp
};

enum Xcontent_type
{//邮件结构
	text=0, 
	multipart
};

enum Xtag
{//文本结构
	nohtml=0,             //当multipart时,必定是nohtml。同plain
	html
};

class mail_node
{
public:
	mail_node();
	//-----------------------------
	//得到邮件属性
	char* nodeload(const char* str);
	string& getContent();
	Xmail_nodes& getMail_nodes();
	void setMail(mail*);
	string& getUncodeContent();
	mail* getMail();
protected:
	mail* Mail;                      //结点属于哪封邮件
	string content;					 //正文部分,排除信头
	Xmail_nodes mail_nodes;          //child nodes
	char* bodyBeg;                   //body开始的指针
	char* bodyEnd;					 //body结束位置的指针
private:
	Xcode getCode();
	Xtag getTag();
	Xcontent_type getContent_type();
private:
	string bound;                    //如果multipart,那么用来记录边界
	Xcontent_type content_type;		 //text or multipart
	Xtag tag;						 // text-->yes        html-->no
	Xcode code;
	string uncodeContent;
};

class mail : public mail_node
{
public:
	mail();
	string getSubject();
	string getFrom();
	string getTo();
	void load(const char* str);
	string& getfile(const char* str);       //根据文件名读入文件并处理提交给load函数使用,处理完内容保存到fulltext中
private:
	string subject;							//邮件主题
	string from;							//发件人
	string to;								//收件人
	string fulltext;				    	 //全文,包括信头
};

void unBase64(string & content, string &uncoded);                   //Base64解码
void DecodeQuoted(string & content, string & uncoded, int size);    //qp解码
string& convertHtml(string& html);
string dealWithHead(string& head);

⌨️ 快捷键说明

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