aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objc/abstract/MCOAddress.h
blob: 6c3284e82d557afa72748cb6c19ded287523667d (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
//
//  MCOAddress.h
//  mailcore2
//
//  Created by DINH Viêt Hoà on 3/10/13.
//  Copyright (c) 2013 MailCore. All rights reserved.
//

#ifndef MAILCORE_MCOADDRESS_H

#define MAILCORE_MCOADDRESS_H

#import <Foundation/Foundation.h>

@interface MCOAddress : NSObject <NSCopying, NSCoding>

/** Creates an address with a display name and a mailbox.

    Example: [MCOAddress addressWithDisplayName:@"DINH Viêt Hoà" mailbox:@"hoa@etpan.org"] */
+ (MCOAddress *) addressWithDisplayName:(NSString *)displayName
                                mailbox:(NSString *)mailbox;

/** Creates an address with only a mailbox.

    Example: [MCOAddress addressWithMailbox:@"hoa@etpan.org"]*/
+ (MCOAddress *) addressWithMailbox:(NSString *)mailbox;

/** Creates an address with a RFC822 string.

    Example: [MCOAddress addressWithRFC822String:@"DINH Vi=C3=AAt Ho=C3=A0 <hoa@etpan.org>"]*/
+ (MCOAddress *) addressWithRFC822String:(NSString *)RFC822String;

/** Creates an address with a non-MIME-encoded RFC822 string.

    Example: [MCOAddress addressWithNonEncodedRFC822String:@"DINH Viêt Hoà <hoa@etpan.org>"]*/
+ (MCOAddress *) addressWithNonEncodedRFC822String:(NSString *)nonEncodedRFC822String;

/** 
 Returns an NSArray of MCOAddress objects that contain the parsed
 forms of the RFC822 encoded addresses.

 For example: @[ @"DINH Vi=C3=AAt Ho=C3=A0 <hoa@etpan.org>" ]*/
+ (NSArray *) addressesWithRFC822String:(NSString *)string;

/** 
 Returns an NSArray of MCOAddress objects that contain the parsed
 forms of non-encoded RFC822 addresses.

 For example: @[ "DINH Viêt Hoà <hoa@etpan.org>" ]*/
+ (NSArray *) addressesWithNonEncodedRFC822String:(NSString *)string;


/** Returns the display name of the address.*/
@property (nonatomic, copy) NSString * displayName;

/** Returns the mailbox of the address.*/
@property (nonatomic, copy) NSString * mailbox;

/** Returns the RFC822 encoding of the address.

    For example: "DINH Vi=C3=AAt Ho=C3=A0 <hoa@etpan.org>"*/
- (NSString *) RFC822String;

/** Returns the non-MIME-encoded RFC822 encoding of the address.

    For example: "DINH Viêt Hoà <hoa@etpan.org>"*/
- (NSString *) nonEncodedRFC822String;

@end

@interface NSArray (MCOAddress)

/** Returns the RFC822 encoding of the addresses.*/
- (NSString *) mco_RFC822StringForAddresses;

/** Returns the non-MIME-encoded RFC822 of the addresses.*/
- (NSString *) mco_nonEncodedRFC822StringForAddresses;

@end

#endif