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