Reduced minimum password retry level from 6 to 3
[barry/pauldeden.git] / src / r_saved_message.h
blob9f310f7bdea862408e555545a08b936a2821aba1
1 ///
2 /// \file r_save_message.h
3 /// Blackberry database record parser class for saved email
4 /// message records.
5 ///
7 /*
8 Copyright (C) 2005-2008, Net Direct Inc. (http://www.netdirect.ca/)
9 Copyright (C) 2007, Brian Edginton (edge@edginton.net)
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 See the GNU General Public License in the COPYING file at the
21 root directory of this project for more details.
24 #ifndef __BARRY_RECORD_SAVED_MESSAGE_H__
25 #define __BARRY_RECORD_SAVED_MESSAGE_H__
27 #include "dll.h"
28 #include "record.h"
29 #include <iosfwd>
30 #include <string>
31 #include <vector>
32 #include <map>
33 #include <stdint.h>
35 namespace Barry {
38 // NOTE: All classes here must be container-safe! Perhaps add sorting
39 // operators in the future.
42 /// \addtogroup RecordParserClasses
43 /// @{
45 class BXEXPORT SavedMessage
47 public:
48 uint8_t RecType;
49 uint32_t RecordId;
51 EmailAddress From;
52 EmailAddress To;
53 EmailAddress Cc;
54 EmailAddress Bcc;
55 EmailAddress Sender;
56 EmailAddress ReplyTo;
57 std::string Subject;
58 std::string Body;
59 std::string Attachment;
60 uint32_t MessageRecordId;
61 uint32_t MessageReplyTo;
62 time_t MessageDateSent;
63 time_t MessageDateReceived;
65 // Message Flags
66 bool MessageTruncated;
67 bool MessageRead;
68 bool MessageReply;
69 bool MessageSaved;
70 bool MessageSavedDeleted;
72 enum MessagePriorityType {
73 LowPriority = 0,
74 NormalPriority,
75 HighPriority,
76 UnknownPriority
78 MessagePriorityType MessagePriority;
80 enum MessageSensitivityType {
81 NormalSensitivity = 0,
82 Personal,
83 Private,
84 Confidential,
85 UnknownSensitivity
87 MessageSensitivityType MessageSensitivity;
89 std::vector<UnknownField> Unknowns;
91 public:
92 const unsigned char* ParseField(const unsigned char *begin,
93 const unsigned char *end);
95 public:
96 SavedMessage();
97 ~SavedMessage();
99 // Parser / Builder API (see parser.h / builder.h)
100 uint8_t GetRecType() const { return RecType; }
101 uint32_t GetUniqueId() const { return RecordId; }
102 void SetIds(uint8_t Type, uint32_t Id) { RecType = Type; RecordId = Id; }
103 void ParseHeader(const Data &data, size_t &offset);
104 void ParseFields(const Data &data, size_t &offset);
105 void BuildHeader(Data &data, size_t &offset) const;
106 void BuildFields(Data &data, size_t &offset) const;
107 void Clear();
108 void Dump(std::ostream &os) const;
110 // sorting
111 bool operator<(const SavedMessage &other) const { return Subject < other.Subject; }
113 // database name
114 static const char * GetDBName() { return "Saved Email Messages"; }
115 static uint8_t GetDefaultRecType() { return 3; }
118 BXEXPORT inline std::ostream& operator<<(std::ostream &os, const SavedMessage &msg) {
119 msg.Dump(os);
120 return os;
123 /// @}
125 } // namespace Barry
127 #endif // __BARRY_RECORD_SAVED_MESSAGE_H__