2 /// \file r_save_message.h
3 /// Blackberry database record parser class for saved email
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__
38 // NOTE: All classes here must be container-safe! Perhaps add sorting
39 // operators in the future.
42 /// \addtogroup RecordParserClasses
45 class BXEXPORT SavedMessage
59 std::string Attachment
;
60 uint32_t MessageRecordId
;
61 uint32_t MessageReplyTo
;
62 time_t MessageDateSent
;
63 time_t MessageDateReceived
;
66 bool MessageTruncated
;
70 bool MessageSavedDeleted
;
72 enum MessagePriorityType
{
78 MessagePriorityType MessagePriority
;
80 enum MessageSensitivityType
{
81 NormalSensitivity
= 0,
87 MessageSensitivityType MessageSensitivity
;
89 std::vector
<UnknownField
> Unknowns
;
92 const unsigned char* ParseField(const unsigned char *begin
,
93 const unsigned char *end
);
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;
108 void Dump(std::ostream
&os
) const;
111 bool operator<(const SavedMessage
&other
) const { return Subject
< other
.Subject
; }
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
) {
127 #endif // __BARRY_RECORD_SAVED_MESSAGE_H__