2014-11-19 00:25:21 +08:00
|
|
|
#pragma once
|
2017-06-02 14:47:24 +08:00
|
|
|
#include "../acl_cpp_define.hpp"
|
|
|
|
#include "../stdlib/string.hpp"
|
2019-05-09 13:57:51 +08:00
|
|
|
#include "../stdlib/noncopyable.hpp"
|
2014-11-19 00:25:21 +08:00
|
|
|
#include <list>
|
|
|
|
|
2019-05-19 16:54:20 +08:00
|
|
|
#if !defined(ACL_MIME_DISABLE)
|
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
namespace acl {
|
|
|
|
|
|
|
|
typedef struct HEADER
|
|
|
|
{
|
|
|
|
char *name;
|
|
|
|
char *value;
|
|
|
|
} HEADER;
|
|
|
|
|
2019-05-09 13:57:51 +08:00
|
|
|
class ACL_CPP_API mime_head : public noncopyable
|
2014-11-19 00:25:21 +08:00
|
|
|
{
|
|
|
|
public:
|
2019-07-07 13:27:58 +08:00
|
|
|
mime_head(void);
|
|
|
|
~mime_head(void);
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
|
|
const string& get_boundary(void) const;
|
2019-07-07 13:27:58 +08:00
|
|
|
const char* get_ctype(void) const;
|
|
|
|
const char* get_stype(void) const;
|
2014-11-19 00:25:21 +08:00
|
|
|
const string& sender(void) const;
|
|
|
|
const string& from(void) const;
|
|
|
|
const string& replyto(void) const;
|
|
|
|
const string& returnpath(void) const;
|
|
|
|
const string& subject(void) const;
|
|
|
|
const std::list<char*>& to_list(void) const;
|
|
|
|
const std::list<char*>& cc_list(void) const;
|
|
|
|
const std::list<char*>& bcc_list(void) const;
|
|
|
|
const std::list<char*>& rcpt_list(void) const;
|
|
|
|
const std::list<HEADER*>& header_list(void) const;
|
|
|
|
const char* header_value(const char* name) const;
|
|
|
|
int header_values(const char* name, std::list<const char*>* values) const;
|
|
|
|
|
|
|
|
mime_head& set_sender(const char*);
|
|
|
|
mime_head& set_from(const char*);
|
|
|
|
mime_head& set_replyto(const char*);
|
|
|
|
mime_head& set_returnpath(const char*);
|
|
|
|
mime_head& set_subject(const char*);
|
|
|
|
mime_head& add_to(const char*);
|
|
|
|
mime_head& add_cc(const char*);
|
|
|
|
mime_head& add_bcc(const char*);
|
|
|
|
mime_head& add_rcpt(const char*);
|
|
|
|
mime_head& add_header(const char*, const char*);
|
2016-01-17 13:35:12 +08:00
|
|
|
mime_head& set_type(const char*, const char*);
|
2014-11-19 00:25:21 +08:00
|
|
|
mime_head& set_boundary(const char*);
|
|
|
|
|
|
|
|
void build_head(string& buf, bool clean);
|
|
|
|
|
|
|
|
mime_head& reset(void);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
private:
|
|
|
|
string* m_boundary;
|
|
|
|
std::list<char*>* m_rcpts;
|
|
|
|
std::list<char*>* m_tos;
|
|
|
|
std::list<char*>* m_ccs;
|
|
|
|
std::list<char*>* m_bccs;
|
|
|
|
std::list<HEADER*>* m_headers;
|
|
|
|
string* m_sender;
|
|
|
|
string* m_from;
|
|
|
|
string* m_replyto;
|
|
|
|
string* m_returnpath;
|
|
|
|
string* m_subject;
|
|
|
|
|
2016-01-17 13:35:12 +08:00
|
|
|
string m_ctype;
|
|
|
|
string m_stype;
|
2014-11-19 00:25:21 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace acl
|
2019-05-19 16:54:20 +08:00
|
|
|
|
|
|
|
#endif // !defined(ACL_MIME_DISABLE)
|