XMPPURI.h
1.97 KB
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
//
// XMPPURI.h
// XMPPFramework
//
// Created by Christopher Ballinger on 5/15/15.
// Copyright (c) 2015 Chris Ballinger. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "XMPPJID.h"
/**
* For parsing and creating XMPP URIs RFC5122/XEP-0147
* e.g. xmpp:username@domain.com?subscribe
* http://www.xmpp.org/extensions/xep-0147.html
*/
@interface XMPPURI : NSObject
/**
* User JID. e.g. romeo@montague.net
* Example: xmpp:romeo@montague.net
*/
@property (nonatomic, strong, readonly) XMPPJID *jid;
/**
* Account JID. (Optional)
* Used to specify an account with which to perform an action.
* For example 'guest@example.com' would be the authority portion of
* xmpp://guest@example.com/support@example.com?message
* so the application would show a dialog with an outgoing message
* to support@example.com from the user's account guest@example.com.
*/
@property (nonatomic, strong, readonly) XMPPJID *accountJID;
/**
* XMPP query action. e.g. subscribe
* For example, the query action below would be 'subscribe'
* xmpp:romeo@montague.net?subscribe
* For full list: http://xmpp.org/registrar/querytypes.html
*/
@property (nonatomic, strong, readonly) NSString *queryAction;
/**
* XMPP query parameters. e.g. subject=Test
*
* For example the query parameters for
* xmpp:romeo@montague.net?message;subject=Test%20Message;body=Here%27s%20a%20test%20message
* would be
* {"subject": "Test Message",
* "body": "Here's a test message"}
*/
@property (nonatomic, strong, readonly) NSDictionary *queryParameters;
/**
* Generates URI string from jid, queryAction, and queryParameters
* e.g. xmpp:romeo@montague.net?subscribe
*/
- (NSString*) uriString;
// Parsing XMPP URIs
- (instancetype) initWithURL:(NSURL*)url;
- (instancetype) initWithURIString:(NSString*)uriString;
// Creating XMPP URIs
- (instancetype) initWithJID:(XMPPJID*)jid
queryAction:(NSString*)queryAction
queryParameters:(NSDictionary*)queryParameters;
@end