8#ifndef PSTSDK_PST_MESSAGE_H
9#define PSTSDK_PST_MESSAGE_H
13#include <boost/iterator/transform_iterator.hpp>
101#ifndef BOOST_NO_RVALUE_REFERENCES
118 std::vector<byte> data =
attach.get_bytes();
119 out.write(
reinterpret_cast<char*
>(&data[0]), data.size());
134#ifndef BOOST_NO_RVALUE_REFERENCES
147 : m_node(
other.m_node) { }
176 {
return m_row.
read_prop<std::wstring>(0x39fe); }
242#ifndef BOOST_NO_RVALUE_REFERENCES
244 : m_bag(std::
move(
other.m_bag)), m_attachment_table(std::
move(
other.m_attachment_table)), m_recipient_table(std::
move(
other.m_recipient_table)) { }
291 {
return m_bag.
size(0x1000); }
299 {
return m_bag.
read_prop<std::wstring>(0x1013); }
314 {
return m_bag.
size(0x1013); }
369 mutable std::shared_ptr<table> m_attachment_table;
370 mutable std::shared_ptr<table> m_recipient_table;
379 {
return message(m_db->lookup_node(
row.get_row_id())); }
414 throw std::bad_cast();
416 std::vector<byte>
buffer = get_bytes();
425 if(
other.m_attachment_table)
426 m_attachment_table.reset(
new table(*
other.m_attachment_table));
427 if(
other.m_recipient_table)
428 m_recipient_table.reset(
new table(*
other.m_recipient_table));
433 if(!m_attachment_table)
436 return *m_attachment_table;
441 if(!m_recipient_table)
444 return *m_recipient_table;
449 return const_cast<table&
>(
const_cast<const message*
>(
this)->get_attachment_table());
454 return const_cast<table&
>(
const_cast<const message*
>(
this)->get_recipient_table());
462 count = get_attachment_table().
size();
474 count = get_recipient_table().size();
Encapsulates an attachment to a message.
message open_as_message() const
Interpret this attachment as a message.
std::vector< byte > get_bytes() const
Get the attachment data, as a blob.
const property_bag & get_property_bag() const
Get the property bag backing this attachment.
size_t size() const
Read the size of this attachment.
bool is_message() const
Returns if this attachment is actually an embedded message.
std::wstring get_filename() const
Get the filename of this attachment.
hnid_stream_device open_byte_stream()
Open a stream of the attachment data.
size_t content_size() const
Read the size of the content in this attachment.
property_bag & get_property_bag()
Get the property bag backing this attachment.
heap_id get_id() const
Return the heap_id of this bth_node.
Contains references to other bth_node allocations.
T read_prop(prop_id id) const
Read a property as a given type.
An abstraction of a table row.
bool prop_exists(prop_id id) const
Indicates the existance of a given property on this object.
Defines a stream device which can wrap one of the two prop sources.
Represents a message in a PST file.
size_t body_size() const
Size of the body, in bytes.
table & get_attachment_table()
Get the attachment table of this message.
size_t get_recipient_count() const
Get the number of recipients on this message.
std::wstring get_body() const
Get the body of this message.
std::wstring get_subject() const
Get the subject of this message.
boost::transform_iterator< attachment_transform, const_table_row_iter > attachment_iterator
Attachment iterator type; a transform iterator over a table row iterator.
bool has_html_body() const
Checks to see if this message has a HTML body.
recipient_iterator recipient_end() const
Get the end recipient iterator.
bool has_body() const
Checks to see if this message has a body.
boost::transform_iterator< recipient_transform, const_table_row_iter > recipient_iterator
Recipient iterator type; a transform iterator over a table row iterator.
recipient_iterator recipient_begin() const
Get an iterator to the first recipient of this message.
std::wstring get_html_body() const
Get the HTML body of this message.
size_t html_body_size() const
Size of the HTML body, in bytes.
hnid_stream_device open_html_body_stream()
Get the HTML body of this message.
attachment_iterator attachment_begin() const
Get an iterator to the first message on this message.
bool has_subject() const
Check to see if a subject is set on this message.
property_bag & get_property_bag()
Get the property bag backing this message.
hnid_stream_device open_body_stream()
Get the body of this message.
message(const node &n)
Construct a message object.
table & get_recipient_table()
Get the recipient table of this message.
node_id get_id() const
Get the node_id of this message.
const property_bag & get_property_bag() const
Get the property bag backing this message.
size_t get_attachment_count() const
Get the number of attachments on this message.
attachment_iterator attachment_end() const
Get the end attachment iterator.
An in memory representation of the "node" concept in a PST data file.
node lookup(node_id id) const
Lookup a subnode by node id.
Property Context (PC) Implementation.
prop_type get_prop_type(prop_id id) const
Get the property type of a given prop_id.
const node & get_node() const
Get the node underlying this property_bag.
bool prop_exists(prop_id id) const
Indicates the existance of a given property on this object.
hnid_stream_device open_prop_stream(prop_id id)
Creates a stream device over a property on this object.
size_t size(prop_id id) const
Returns the total size of a variable length property.
A recipient of a message.
std::wstring get_email_address() const
Get the email address of the recipient.
std::wstring get_account_name() const
Get the name of the recipients account.
recipient_type get_type() const
Get the type of this recipient.
std::wstring get_name() const
Get the display name of this recipient.
std::wstring get_address_type() const
Get the address type of the recipient.
const const_table_row & get_property_row() const
Get the property row underying this recipient object.
const_table_row & get_property_row()
Get the property row underying this recipient object.
bool has_email_address() const
Checks to see if this recipient has an email address.
bool has_account_name() const
Checks to see if this recipient has an account name.
The actual table object that clients reference.
size_t size() const
Get the number of rows in this table.
const byte message_subject_prefix_lead_byte
A sentinel byte which indicates the message subject contains a prefix.
recipient_type
The different recipient types as defined by MAPI.
Contains the definition of all in memory representations of disk structures.
std::shared_ptr< db_context > shared_db_ptr
Node and Block definitions.
Primitive structures defined by MS-PST and MAPI.
Property Bag (or Property Context, or PC) implementation.
An in memory, database format agnostic version of disk::nbt_leaf_entry.
Table (or Table Context, or TC) implementation.