aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/rfc822/MCMessageBuilder.h
blob: 6981e2952cc85ef4ad5ccd42601514e8b9613c97 (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
#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 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 String * htmlRendering(HTMLRendererTemplateCallback * htmlCallback = NULL);
        virtual String * htmlBodyRendering();
        
        virtual String * plainTextRendering();
        virtual String * plainTextBodyRendering(bool stripWhitespace);
        
    public: // subclass behavior
		MessageBuilder(MessageBuilder * other);
		virtual String * description();
		virtual Object * copy();
        
	private:
		String * mHTMLBody;
		String * mTextBody;
		Array * /* Attachment */ mAttachments;
		Array * /* Attachment */ mRelatedAttachments;
		String * mBoundaryPrefix;
		void init();
		Data * dataAndFilterBcc(bool filterBcc);
	};
	
};

#endif

#endif