Skip to content

Commit

Permalink
Add new Attachment constructor, taking directly a GMimeDataWrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime Coste committed Feb 23, 2011
1 parent 863d435 commit 6a2e208
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/message_part.cc
Expand Up @@ -131,6 +131,14 @@ Attachment::Attachment(GMimePart * part)
filesize = g_mime_stream_length(g_mime_data_wrapper_get_stream(data));
}

Attachment::Attachment(GMimeDataWrapper * data, const std::string & filename,
const std::string& contentType, int filesize)
: MessagePart(std::string()), filename(filename), contentType(contentType),
filesize(filesize), data(data)
{
g_object_ref(data);
}

Attachment::~Attachment()
{
g_object_unref(data);
Expand Down
2 changes: 2 additions & 0 deletions src/message_part.hh
Expand Up @@ -50,6 +50,8 @@ struct TextPart : public MessagePart
struct Attachment : public MessagePart
{
Attachment(GMimePart * part);
Attachment(GMimeDataWrapper * data, const std::string & filename,
const std::string& contentType, int filesize);
~Attachment();

virtual void accept(MessagePartVisitor & visitor);
Expand Down

0 comments on commit 6a2e208

Please sign in to comment.