xref: /haiku/headers/os/mail/MailContainer.h (revision fa84ff9eb17c6fc1fb438788995504d0d827d791)
1 #ifndef ZOIDBERG_MAIL_CONTAINER_H
2 #define ZOIDBERG_MAIL_CONTAINER_H
3 /* Container - message part container class
4 **
5 ** Copyright 2001 Dr. Zoidberg Enterprises. All rights reserved.
6 */
7 
8 
9 #include <List.h>
10 
11 #include <MailComponent.h>
12 
13 class BPositionIO;
14 
15 class BMailContainer : public BMailComponent {
16 	public:
17 		BMailContainer (uint32 defaultCharSet = B_MAIL_NULL_CONVERSION) :
BMailComponent(defaultCharSet)18 			BMailComponent (defaultCharSet) {};
19 
20 		virtual status_t AddComponent(BMailComponent *component) = 0;
21 		virtual status_t RemoveComponent(BMailComponent *component) = 0;
22 		virtual status_t RemoveComponent(int32 index) = 0;
23 
24 		virtual BMailComponent *GetComponent(int32 index, bool parse_now = false) = 0;
25 		virtual int32 CountComponents() const = 0;
26 
27 	private:
28 		virtual void _ReservedContainer1();
29 		virtual void _ReservedContainer2();
30 		virtual void _ReservedContainer3();
31 		virtual void _ReservedContainer4();
32 };
33 
34 class BMIMEMultipartMailContainer : public BMailContainer {
35 	public:
36 		BMIMEMultipartMailContainer(
37 			const char *boundary = NULL,
38 			const char *this_is_an_MIME_message_text = NULL,
39 			uint32 defaultCharSet = B_MAIL_NULL_CONVERSION);
40 		BMIMEMultipartMailContainer(BMIMEMultipartMailContainer &copy);
41 		virtual ~BMIMEMultipartMailContainer();
42 
43 		void SetBoundary(const char *boundary);
44 		void SetThisIsAnMIMEMessageText(const char *text);
45 
46 		// MailContainer
47 		virtual status_t AddComponent(BMailComponent *component);
48 		virtual status_t RemoveComponent(BMailComponent *component);
49 		virtual status_t RemoveComponent(int32 index);
50 
51 		virtual BMailComponent *GetComponent(int32 index, bool parse_now = false);
52 		virtual int32 CountComponents() const;
53 
54 		// MailComponent
55 		virtual status_t GetDecodedData(BPositionIO *data);
56 		virtual status_t SetDecodedData(BPositionIO *data);
57 
58 		virtual status_t SetToRFC822(BPositionIO *data, size_t length, bool parse_now = false);
59 		virtual status_t RenderToRFC822(BPositionIO *render_to);
60 
61 	private:
62 		virtual void _ReservedMultipart1();
63 		virtual void _ReservedMultipart2();
64 		virtual void _ReservedMultipart3();
65 
66 		const char *_boundary;
67 		const char *_MIME_message_warning;
68 
69 		BPositionIO *_io_data;
70 
71 		BList _components_in_raw;
72 		BList _components_in_code;
73 
74 
75 		uint32 _reserved[5];
76 };
77 
78 #endif	/* ZOIDBERG_MAIL_CONTAINER_H */
79