aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/imap/MCIMAPPart.h
blob: 1a34da21759017dc1913ccc10d6189572f5f2eb2 (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
#ifndef MAILCORE_MCIMAPPART_H

#define MAILCORE_MCIMAPPART_H

#include <MailCore/MCBaseTypes.h>
#include <MailCore/MCAbstractPart.h>

#ifdef __cplusplus

namespace mailcore {
    
    class IMAPMessagePart;
    class IMAPMultipart;
    
    class MAILCORE_EXPORT IMAPPart : public AbstractPart {
    public:
        IMAPPart();
        virtual ~IMAPPart();
        
        virtual void setPartID(String * partID);
        virtual String * partID();
        
        virtual void setSize(unsigned int size);
        virtual unsigned int size();
        
        virtual unsigned int decodedSize();
        
        virtual void setEncoding(Encoding encoding);
        virtual Encoding encoding();
        
    public: // subclass behavior
        IMAPPart(IMAPPart * other);
        virtual Object * copy();
        virtual HashMap * serializable();
        virtual void importSerializable(HashMap * serializable);
        
    public: // private
        static AbstractPart * attachmentWithIMAPBody(struct mailimap_body * body);
        
        virtual void importIMAPFields(struct mailimap_body_fields * fields,
                                      struct mailimap_body_ext_1part * extension);
        
    private:
        String * mPartID;
        Encoding mEncoding;
        unsigned int mSize;
        void init();
        static AbstractPart * attachmentWithIMAPBodyInternal(struct mailimap_body * body, String * partID);
        static AbstractPart * attachmentWithIMAPBody1Part(struct mailimap_body_type_1part * body_1part,
                                                          String * partID);
        static IMAPMessagePart * attachmentWithIMAPBody1PartMessage(struct mailimap_body_type_msg * message,
                                                                    struct mailimap_body_ext_1part * extension,
                                                                    String * partID);
        static IMAPPart * attachmentWithIMAPBody1PartBasic(struct mailimap_body_type_basic * basic,
                                                           struct mailimap_body_ext_1part * extension);
        static IMAPPart * attachmentWithIMAPBody1PartText(struct mailimap_body_type_text * text,
                                                          struct mailimap_body_ext_1part * extension);
        static IMAPMultipart * attachmentWithIMAPBodyMultipart(struct mailimap_body_type_mpart * body_mpart,
                                                               String * partID);
    };
    
}

#endif

#endif