aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objc/abstract/MCOMessageHeader.h
blob: e68cf33c85196399428310aff3f16e0f29d5ef4a (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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//
//  MCOMessageHeader.h
//  mailcore2
//
//  Created by DINH Viêt Hoà on 3/10/13.
//  Copyright (c) 2013 MailCore. All rights reserved.
//

#ifndef MAILCORE_MCOMESSAGEHEADER_H

#define MAILCORE_MCOMESSAGEHEADER_H

#import <Foundation/Foundation.h>

/** This class implements common fields of a message header.*/

@class MCOAddress;

@interface MCOMessageHeader : NSObject <NSCopying, NSCoding>

/** Message-ID field.*/
@property (nonatomic, copy) NSString * messageID;

/** Message-ID auto-generated flag.*/
@property (nonatomic, readonly, getter=isMessageIDAutoGenerated) BOOL messageIDAutoGenerated;

/** References field. It's an array of message-ids.*/
@property (nonatomic, copy) NSArray * /* NSString */ references;

/** In-Reply-To field. It's an array of message-ids.*/
@property (nonatomic, copy) NSArray * /* NSString */ inReplyTo;

/** Date field: sent date of the message.*/
@property (nonatomic, strong) NSDate * date;

/** Received date: received date of the message.*/
@property (nonatomic, strong) NSDate * receivedDate;

/** Sender field.*/
@property (nonatomic, copy) MCOAddress * sender;

/** From field: address of the sender of the message.*/
@property (nonatomic, copy) MCOAddress * from;

/** To field: recipient of the message. It's an array of MCOAddress.*/
@property (nonatomic, copy) NSArray * /* MCOAddress */ to;

/** Cc field: cc recipient of the message. It's an array of MCOAddress.*/
@property (nonatomic, copy) NSArray * /* MCOAddress */ cc;

/** Bcc field: bcc recipient of the message. It's an array of MCOAddress.*/
@property (nonatomic, copy) NSArray * /* MCOAddress */ bcc;

/** Reply-To field. It's an array of MCOAddress.*/
@property (nonatomic, copy) NSArray * /* MCOAddress */ replyTo;

/** Subject of the message.*/
@property (nonatomic, copy) NSString * subject;

/** Email user agent name: X-Mailer header.*/
@property (nonatomic, copy) NSString * userAgent;

/** Returns a header created from RFC 822 data.*/
+ (MCOMessageHeader *) headerWithData:(NSData *)data;

/** Initialize a header with RFC 822 data.*/
- (instancetype) initWithData:(NSData *)data;

/** Adds a custom header.*/
- (void) setExtraHeaderValue:(NSString *)value forName:(NSString *)name;

/** Remove a given custom header.*/
- (void) removeExtraHeaderForName:(NSString *)name;

/** Returns the value of a given custom header.*/
- (NSString *) extraHeaderValueForName:(NSString *)name;

/** Returns an array with the names of all custom headers.*/
- (NSArray * /* NSString */) allExtraHeadersNames;

/** Extracted subject (also remove square brackets).*/
- (NSString *) extractedSubject;

/** Extracted subject (don't remove square brackets).*/
- (NSString *) partialExtractedSubject;

/** Fill the header using the given RFC 822 data.*/
- (void) importHeadersData:(NSData *)data;

/** Returns a header that can be used as a base for a reply message.*/
- (MCOMessageHeader *) replyHeaderWithExcludedRecipients:(NSArray * /* MCOAddress */)excludedRecipients;

/** Returns a header that can be used as a base for a reply all message.*/
- (MCOMessageHeader *) replyAllHeaderWithExcludedRecipients:(NSArray * /* MCOAddress */)excludedRecipients;

/** Returns a header that can be used as a base for a forward message.*/
- (MCOMessageHeader *) forwardHeader;

@end

#endif