ObjXMPP  Check-in [150f2fa932]

Overview
Comment:Add a class for handling JIDs.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 150f2fa9327f6571a1a0e97276ad64d55abfff5f0786555ba1624d5c408d8ff8
User & Date: florob@babelmonkeys.de on 2011-02-13 00:36:25
Other Links: manifest | tags
Context
2011-02-13
01:07
Add support for requesting a certain resource check-in: c322888ad7 user: florob@babelmonkeys.de tags: trunk
00:36
Add a class for handling JIDs. check-in: 150f2fa932 user: florob@babelmonkeys.de tags: trunk
2011-02-12
16:58
Use self for XMPPStanza's init check-in: 86a0735116 user: florob@babelmonkeys.de tags: trunk
Changes

Modified Makefile from [70999db70f] to [7c1f7cb9e3].

1
2
3

4
5
6
7
1
2

3
4
5
6
7


-
+




all: tests/tests

tests/tests: tests/test.m src/XMPPConnection.m src/XMPPStanza.m
tests/tests: tests/test.m src/XMPPConnection.m src/XMPPStanza.m src/XMPPJID.m
	objfw-compile -o $@ $^ -lidn -Wall -Werror -Isrc

clean:
	rm -f src/*.o tests/*.o tests/tests

Modified src/XMPPConnection.h from [6a8017ad60] to [b512794cc3].

1

2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
9

+







#import <ObjFW/ObjFW.h>
#import <XMPPJID.h>

@class XMPPConnection;
@class XMPPIQ;
@class XMPPMessage;
@class XMPPPresence;

@protocol XMPPConnectionDelegate
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
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







-
+


















+
+
+
+
+

















+







@interface XMPPConnection: OFObject <OFXMLElementBuilderDelegate>
{
	OFTCPSocket *sock;
	OFXMLParser *parser;
	OFXMLElementBuilder *elementBuilder;

	/**
	 * The username (local part of the JID) to connect with
	 * The username to connect with
	 */
	OFString *username;

	/**
	 * The password to connect with
	 */
	OFString *password;

	/**
	 * The server to connect to
	 */
	OFString *server;

	/**
	 * The resource to connect with
	 */
	OFString *resource;

	/**
	 * The JID bound to this connection (this is determined by the server)
	 */
	XMPPJID *JID;

	/**
	 * The port to connect to
	 */
	short port;

	/**
	 * Whether to use TLS
	 */
	BOOL useTLS;
	id <XMPPConnectionDelegate> delegate;
	OFMutableArray *mechanisms;
}

@property (copy) OFString *username;
@property (copy) OFString *password;
@property (copy) OFString *server;
@property (copy) OFString *resource;
@property (readonly) XMPPJID *JID;
@property (assign) short port;
@property (assign) BOOL useTLS;
@property (retain) id <XMPPConnectionDelegate> delegate;

/**
 * Connects to the XMPP service
 */

Modified src/XMPPConnection.m from [aacb5f2723] to [91413b016c].

9
10
11
12
13
14
15

16
17
18
19
20
21
22
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23







+







#define NS_STREAM @"http://etherx.jabber.org/streams"

@implementation XMPPConnection
@synthesize username;
@synthesize password;
@synthesize server;
@synthesize resource;
@synthesize JID;
@synthesize port;
@synthesize useTLS;
@synthesize delegate;

- init
{
	self = [super init];
214
215
216
217
218
219
220


221

222
223
224
225
226
227
228
229
215
216
217
218
219
220
221
222
223

224

225
226
227
228
229
230
231







+
+
-
+
-








- (void)_handleResourceBind: (XMPPIQ*)iq
{
	OFXMLElement *bindElem = iq.children.firstObject;
	if ([bindElem.name isEqual: @"bind"] &&
	    [bindElem.namespace isEqual: NS_BIND]) {
		OFXMLElement *jidElem = bindElem.children.firstObject;
		JID = [[XMPPJID alloc] initWithString:
			[jidElem.children.firstObject stringValue]];
		of_log(@"Bound to JID: %@", [jidElem.children.firstObject
		of_log(@"Bound to JID: %@", [JID fullJID]);
				stringValue]);
	}
}

- (void)_handleFeatures: (OFXMLElement*)elem
{
	for (OFXMLElement *child in elem.children) {
		if ([[child name] isEqual: @"mechanisms"] &&

Added src/XMPPJID.h version [ba250a7ca4].

Added src/XMPPJID.m version [2fdab65477].