version 0.3.33
[fms.git] / include / freenet / messagexml.h
1 #ifndef _messagexml_\r
2 #define _messagexml_\r
3 \r
4 #include <vector>\r
5 #include <map>\r
6 \r
7 #include "../ifmsxmldocument.h"\r
8 \r
9 class MessageXML:public IFMSXMLDocument\r
10 {\r
11 public:\r
12 \r
13         MessageXML();\r
14 \r
15         virtual std::string GetXML();\r
16         virtual const bool ParseXML(const std::string &xml);\r
17 \r
18         struct fileattachment\r
19         {\r
20                 fileattachment(const std::string &key, const int size):m_key(key),m_size(size)  {}\r
21                 std::string m_key;\r
22                 int m_size;\r
23         };\r
24 \r
25         const std::string GetDate() const                                                               { return m_date; }\r
26         const std::string GetTime() const                                                               { return m_time; }\r
27         const std::string GetSubject() const                                                    { return m_subject; }\r
28         const std::string GetMessageID() const                                                  { return m_messageid; }\r
29         const std::string GetReplyBoard() const                                                 { return m_replyboard; }\r
30         const std::string GetBody() const                                                               { return m_body; }\r
31         const std::vector<std::string> GetBoards() const                                { return m_boards; }\r
32         const std::map<long,std::string> GetInReplyTo() const                   { return m_inreplyto; }\r
33         const std::vector<fileattachment> GetFileAttachments() const    { return m_fileattachments; }\r
34 \r
35         void SetDate(const std::string &date)                                                           { m_date=date; }\r
36         void SetTime(const std::string &time)                                                           { m_time=time; }\r
37         void SetSubject(const std::string &subject)                                                     { m_subject=subject; }\r
38         void SetMessageID(const std::string &messageid)                                         { m_messageid=messageid; }\r
39         void SetReplyBoard(const std::string &replyboard)                                       { m_replyboard=replyboard; }\r
40         void SetBody(const std::string &body)                                                           { m_body=body; }\r
41         void AddBoard(const std::string &board)                                                         { m_boards.push_back(board); }\r
42         void AddInReplyTo(const long index, const std::string &messageid)       { m_inreplyto[index]=messageid; }\r
43         void AddFileAttachment(const std::string &key, const int size)          { m_fileattachments.push_back(fileattachment(key,size)); }\r
44 \r
45 protected:\r
46         void Initialize();\r
47 \r
48         std::string m_date;\r
49         std::string m_time;\r
50         std::string m_subject;\r
51         std::string m_messageid;\r
52         std::vector<std::string> m_boards;\r
53         std::string m_replyboard;\r
54         std::map<long,std::string> m_inreplyto;\r
55         std::vector<fileattachment> m_fileattachments;\r
56         std::string m_body;\r
57 \r
58 };\r
59 \r
60 #endif  // _messagexml_\r