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_PIN_MESSAGE_H__
00024 #define __BARRY_RECORD_PIN_MESSAGE_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 namespace Barry {
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 class BXEXPORT PINMessage
00045 {
00046 public:
00047 uint8_t RecType;
00048 uint32_t RecordId;
00049
00050 EmailAddress From;
00051 EmailAddress To;
00052 EmailAddress Cc;
00053 EmailAddress Bcc;
00054 std::string Subject;
00055 std::string Body;
00056 uint32_t MessageRecordId;
00057
00058
00059
00060
00061
00062
00063 uint32_t MessageReplyTo;
00064 time_t MessageDateSent;
00065 time_t MessageDateReceived;
00066
00067
00068 bool MessageTruncated;
00069 bool MessageRead;
00070 bool MessageReply;
00071 bool MessageSaved;
00072 bool MessageSavedDeleted;
00073
00074 enum MessagePriorityType {
00075 LowPriority = 0,
00076 NormalPriority,
00077 HighPriority,
00078 UnknownPriority
00079 };
00080 MessagePriorityType MessagePriority;
00081
00082 enum MessageSensitivityType {
00083 NormalSensitivity = 0,
00084 Personal,
00085 Private,
00086 Confidential,
00087 UnknownSensitivity
00088 };
00089 MessageSensitivityType MessageSensitivity;
00090
00091 std::vector<UnknownField> Unknowns;
00092
00093 public:
00094 const unsigned char* ParseField(const unsigned char *begin,
00095 const unsigned char *end);
00096
00097 public:
00098 PINMessage();
00099 ~PINMessage();
00100
00101
00102 uint8_t GetRecType() const { return RecType; }
00103 uint32_t GetUniqueId() const { return RecordId; }
00104 void SetIds(uint8_t Type, uint32_t Id) { RecType = Type; RecordId = Id; }
00105 void ParseHeader(const Data &data, size_t &offset);
00106 void ParseFields(const Data &data, size_t &offset);
00107 void BuildHeader(Data &data, size_t &offset) const;
00108 void BuildFields(Data &data, size_t &offset) const;
00109
00110 void Clear();
00111
00112 void Dump(std::ostream &os) const;
00113
00114
00115 bool operator<(const PINMessage &other) const { return Subject < other.Subject; }
00116
00117
00118 static const char * GetDBName() { return "PIN Messages"; }
00119 static uint8_t GetDefaultRecType() { return 0; }
00120 };
00121
00122 BXEXPORT inline std::ostream& operator<<(std::ostream &os, const PINMessage &msg) {
00123 msg.Dump(os);
00124 return os;
00125 }
00126
00127
00128
00129 }
00130
00131 #endif // __BARRY_RECORD_PIN_MESSAGE_H__
00132
00133