blob: 3d26ac5908b56077a27ece7028d866a274042019 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#ifndef MAILCORE_MCMESSAGEBUILDER_H
#define MAILCORE_MCMESSAGEBUILDER_H
#include <MailCore/MCBaseTypes.h>
#include <MailCore/MCAbstractMessage.h>
#ifdef __cplusplus
namespace mailcore {
class Attachment;
class HTMLRendererTemplateCallback;
class MAILCORE_EXPORT MessageBuilder : public AbstractMessage {
public:
MessageBuilder();
virtual ~MessageBuilder();
virtual void setHTMLBody(String * htmlBody);
virtual String * htmlBody();
virtual void setTextBody(String * textBody);
virtual String * textBody();
virtual void setAttachments(Array * /* Attachment */ attachments);
virtual Array * /* Attachment */ attachments();
virtual void addAttachment(Attachment * attachment);
// attachments (usually images) that are included in HTML.
// a Content-ID should be assigned to these part to be able to reference
// them in the HTML using a cid: URL.
virtual void setRelatedAttachments(Array * /* Attachment */ attachments);
virtual Array * /* Attachment */ relatedAttachments();
virtual void addRelatedAttachment(Attachment * attachment);
// When boundary needs to be prefixed (to go through spam filters).
virtual void setBoundaryPrefix(String * boundaryPrefix);
virtual String * boundaryPrefix();
virtual Data * data();
virtual Data * dataForEncryption();
// Store builded message to file.
virtual ErrorCode writeToFile(String * filename);
virtual String * htmlRendering(HTMLRendererTemplateCallback * htmlCallback = NULL);
virtual String * htmlBodyRendering();
virtual String * plainTextRendering();
virtual String * plainTextBodyRendering(bool stripWhitespace);
virtual Data * openPGPSignedMessageDataWithSignatureData(Data * signature);
virtual Data * openPGPEncryptedMessageDataWithEncryptedData(Data * encryptedData);
public: // subclass behavior
MessageBuilder(MessageBuilder * other);
virtual String * description();
virtual Object * copy();
public: // private
virtual String * nextBoundary();
virtual void resetBoundaries();
virtual void setBoundaries(Array * boundaries);
private:
String * mHTMLBody;
String * mTextBody;
Array * /* Attachment */ mAttachments;
Array * /* Attachment */ mRelatedAttachments;
String * mBoundaryPrefix;
void init();
Data * dataAndFilterBccAndForEncryption(bool filterBcc, bool forEncryption);
struct mailmime * mimeAndFilterBccAndForEncryption(bool filterBcc, bool forEncryption);
Array * mBoundaries;
unsigned int mCurrentBoundaryIndex;
};
};
#endif
#endif
|