r_message_base.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __BARRY_RECORD_MESSAGE_BASE_H__
00024 #define __BARRY_RECORD_MESSAGE_BASE_H__
00025
00026 #include "dll.h"
00027 #include "record.h"
00028 #include <iosfwd>
00029 #include <string>
00030 #include <vector>
00031 #include <map>
00032 #include <stdint.h>
00033
00034
00035 namespace Barry {
00036
00037
00038 class IConverter;
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 class BXEXPORT MessageBase
00049 {
00050 public:
00051 uint8_t RecType;
00052 uint32_t RecordId;
00053
00054 EmailAddressList From;
00055 EmailAddressList To;
00056 EmailAddressList Cc;
00057 EmailAddressList Bcc;
00058 EmailAddressList Sender;
00059 EmailAddressList ReplyTo;
00060 std::string Subject;
00061 std::string Body;
00062 std::string Attachment;
00063
00064 uint32_t MessageRecordId;
00065
00066
00067
00068
00069
00070
00071 uint32_t MessageReplyTo;
00072 time_t MessageDateSent;
00073 time_t MessageDateReceived;
00074
00075
00076 bool MessageTruncated;
00077 bool MessageRead;
00078 bool MessageReply;
00079 bool MessageSaved;
00080 bool MessageSavedDeleted;
00081
00082 enum MessagePriorityType {
00083 LowPriority = 0,
00084 NormalPriority,
00085 HighPriority,
00086 UnknownPriority
00087 };
00088 MessagePriorityType MessagePriority;
00089
00090 enum MessageSensitivityType {
00091 NormalSensitivity = 0,
00092 Personal,
00093 Private,
00094 Confidential,
00095 UnknownSensitivity
00096 };
00097 MessageSensitivityType MessageSensitivity;
00098
00099 std::vector<UnknownField> Unknowns;
00100
00101 protected:
00102 std::string SimpleFromAddress() const;
00103
00104 public:
00105 const unsigned char* ParseField(const unsigned char *begin,
00106 const unsigned char *end, const IConverter *ic = 0);
00107
00108 public:
00109 MessageBase();
00110 ~MessageBase();
00111
00112
00113 uint8_t GetRecType() const;
00114 uint32_t GetUniqueId() const;
00115 void SetIds(uint8_t Type, uint32_t Id){ RecType = Type; RecordId = Id; }
00116 void ParseHeader(const Data &data, size_t &offset);
00117 void ParseFields(const Data &data, size_t &offset, const IConverter *ic = 0);
00118 void BuildHeader(Data &data, size_t &offset) const;
00119 void BuildFields(Data &data, size_t &offset, const IConverter *ic = 0) const;
00120
00121 void Clear();
00122
00123 void Dump(std::ostream &os) const;
00124
00125
00126 bool operator<(const MessageBase &other) const
00127 {
00128 return Subject < other.Subject;
00129 }
00130 };
00131
00132 BXEXPORT inline std::ostream& operator<<(std::ostream &os, const MessageBase &msg) {
00133 msg.Dump(os);
00134 return os;
00135 }
00136
00137
00138
00139 }
00140
00141 #endif
00142