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 class BXEXPORT MessageBase
00046 {
00047 public:
00048 uint8_t RecType;
00049 uint32_t RecordId;
00050
00051 EmailAddressList From;
00052 EmailAddressList To;
00053 EmailAddressList Cc;
00054 EmailAddressList Bcc;
00055 EmailAddressList Sender;
00056 EmailAddressList ReplyTo;
00057 std::string Subject;
00058 std::string Body;
00059 std::string Attachment;
00060
00061 uint32_t MessageRecordId;
00062
00063
00064
00065
00066
00067
00068 uint32_t MessageReplyTo;
00069 time_t MessageDateSent;
00070 time_t MessageDateReceived;
00071
00072
00073 bool MessageTruncated;
00074 bool MessageRead;
00075 bool MessageReply;
00076 bool MessageSaved;
00077 bool MessageSavedDeleted;
00078
00079 enum PriorityType {
00080 LowPriority = 0,
00081 NormalPriority,
00082 HighPriority,
00083 UnknownPriority
00084 };
00085 PriorityType Priority;
00086
00087 enum SensitivityType {
00088 NormalSensitivity = 0,
00089 Personal,
00090 Private,
00091 Confidential,
00092 UnknownSensitivity
00093 };
00094 SensitivityType Sensitivity;
00095
00096 std::vector<UnknownField> Unknowns;
00097
00098 protected:
00099 std::string SimpleFromAddress() const;
00100
00101 public:
00102 const unsigned char* ParseField(const unsigned char *begin,
00103 const unsigned char *end, const IConverter *ic = 0);
00104
00105 protected:
00106 MessageBase();
00107 ~MessageBase();
00108
00109 public:
00110
00111 uint8_t GetRecType() const;
00112 uint32_t GetUniqueId() const;
00113 void SetIds(uint8_t Type, uint32_t Id){ RecType = Type; RecordId = Id; }
00114 void ParseHeader(const Data &data, size_t &offset);
00115 void ParseFields(const Data &data, size_t &offset, const IConverter *ic = 0);
00116 void BuildHeader(Data &data, size_t &offset) const;
00117 void BuildFields(Data &data, size_t &offset, const IConverter *ic = 0) const;
00118
00119 void Clear();
00120
00121 void Dump(std::ostream &os) const;
00122
00123
00124 bool operator<(const MessageBase &other) const;
00125 };
00126
00127 BXEXPORT inline std::ostream& operator<<(std::ostream &os, const MessageBase &msg) {
00128 msg.Dump(os);
00129 return os;
00130 }
00131
00132 }
00133
00134 #endif
00135