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