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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
//
// MCOAbstractPart.h
// mailcore2
//
// Created by DINH Viêt Hoà on 3/10/13.
// Copyright (c) 2013 MailCore. All rights reserved.
//
#ifndef MAILCORE_MCOABSTRACTPART_H
#define MAILCORE_MCOABSTRACTPART_H
#import <Foundation/Foundation.h>
@class MCOAbstractMessage;
typedef NS_ENUM(NSInteger, MCOPartType) {
// Used for a single part.
// The part will be a MCOAbstractPart.
MCOPartTypeSingle,
// Used for a message part (MIME type: message/rfc822).
// The part will be a MCOAbstractMessagePart.
// It's when a message is sent as attachment of an other message.
MCOPartTypeMessage,
// Used for a multipart, multipart/mixed.
// The part will be a MCOAbstractMultipart.
MCOPartTypeMultipartMixed,
// Used for a multipart, multipart/related.
// The part will be a MCOAbstractMultipart.
MCOPartTypeMultipartRelated,
// Used for a multipart, multipart/alternative.
// The part will be a MCOAbstractMultipart.
MCOPartTypeMultipartAlternative,
// Used for a signed message, multipart/signed.
// The part will be a MCOAbstractMultipart.
MCOPartTypeMultipartSigned,
};
@interface MCOAbstractPart : NSObject <NSCopying>
/** Returns type of the part (single / message part / multipart/mixed,
multipart/related, multipart/alternative). See MCOPartType.*/
@property (nonatomic, assign) MCOPartType partType;
/** Returns filename of the part.*/
@property (nonatomic, copy) NSString * filename;
/** Returns MIME type of the part. For example application/data.*/
@property (nonatomic, copy) NSString * mimeType;
/** Returns charset of the part in case it's a text single part.*/
@property (nonatomic, copy) NSString * charset;
/** Returns the unique ID generated for this part.
It's a unique identifier that's created when the object is created manually
or created by the parser.*/
@property (nonatomic, copy) NSString * uniqueID;
/** Returns the value of the Content-ID field of the part.*/
@property (nonatomic, copy) NSString * contentID;
/** Returns the value of the Content-Location field of the part.*/
@property (nonatomic, copy) NSString * contentLocation;
/** Returns the value of the Content-Description field of the part.*/
@property (nonatomic, copy) NSString * contentDescription;
/** Returns whether the part is an explicit inline attachment.*/
@property (nonatomic, assign, getter=isInlineAttachment) BOOL inlineAttachment;
/** Returns the part with the given Content-ID among this part and its subparts.*/
- (MCOAbstractPart *) partForContentID:(NSString *)contentID;
/** Returns the part with the given unique identifier among this part and its subparts.*/
- (MCOAbstractPart *) partForUniqueID:(NSString *)uniqueID;
/** Returns a string representation of the data according to charset.*/
- (NSString *) decodedStringForData:(NSData *)data;
/** Adds a content type parameter.*/
- (void) setContentTypeParameterValue:(NSString *)value forName:(NSString *)name;
/** Remove a given content type parameter.*/
- (void) removeContentTypeParameterForName:(NSString *)name;
/** Returns the value of a given content type parameter.*/
- (NSString *) contentTypeParameterValueForName:(NSString *)name;
/** Returns an array with the names of all content type parameters.*/
- (NSArray * /* NSString */) allContentTypeParametersNames;
@end
#endif
|