|
|
@ -17,27 +17,30 @@ namespace pEpMIME |
|
|
|
// refers to data in a bloblist_t. Does NOT any data!
|
|
|
|
struct Attachment |
|
|
|
{ |
|
|
|
explicit Attachment(const bloblist_t* b, unsigned nr_in_bloblist) |
|
|
|
explicit Attachment(const bloblist_t* b, unsigned nr_in_bloblist, bool has_pEp_msg_attachment) |
|
|
|
: data{b->size ? sv{b->value, b->size} : sv{}} |
|
|
|
, mime_type{b->mime_type} |
|
|
|
, filename{exists(b->filename) ? b->filename : sv{}} |
|
|
|
, dtype{b->disposition} |
|
|
|
, need_te{need_transport_encoding(data)} |
|
|
|
, nr{nr_in_bloblist} |
|
|
|
{ |
|
|
|
if(::pEpMIME::is_inline(b)) |
|
|
|
{ |
|
|
|
dtype = PEP_CONTENT_DISP_INLINE; |
|
|
|
} |
|
|
|
|
|
|
|
if((mime_type=="message/rfc822") && (nr_in_bloblist==0) && has_pEp_msg_attachment) |
|
|
|
{ |
|
|
|
mime_type += "; forwarded=\"no\""; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Attachment(sv _data, sv _mime_type, unsigned nr_in_bloblist) |
|
|
|
Attachment(sv _data, sv _mime_type) |
|
|
|
: data{_data} |
|
|
|
, mime_type{_mime_type} |
|
|
|
, filename{} |
|
|
|
, dtype{ PEP_CONTENT_DISP_OTHER } |
|
|
|
, need_te{ need_transport_encoding(data) } |
|
|
|
, nr{ nr_in_bloblist } |
|
|
|
{ } |
|
|
|
|
|
|
|
|
|
|
@ -49,16 +52,15 @@ namespace pEpMIME |
|
|
|
} |
|
|
|
|
|
|
|
sv data; |
|
|
|
sv mime_type; |
|
|
|
std::string mime_type; |
|
|
|
sv filename; |
|
|
|
content_disposition_type dtype; |
|
|
|
bool need_te; // need transport encoding
|
|
|
|
unsigned nr; |
|
|
|
}; |
|
|
|
|
|
|
|
typedef std::vector<Attachment> SAttachments; |
|
|
|
|
|
|
|
SAttachments parse_attachments(const bloblist_t* att); |
|
|
|
SAttachments parse_attachments(const bloblist_t* att, bool has_pEp_msg_attachment); |
|
|
|
|
|
|
|
inline |
|
|
|
bool all(const Attachment&) { return true; } |
|
|
|