ObjXMPP  Check-in [44237d2647]

Overview
Comment:Make it possible to require TLS.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 44237d2647d92329b485bcb2105ea0fe9533cc3ab84b6d7bc3c75bdf40104695
User & Date: js on 2011-09-14 20:09:46
Other Links: manifest | tags
Context
2011-09-16
13:11
Fix salt generation code check-in: 88dd1b11ee user: florob@babelmonkeys.de tags: trunk
2011-09-14
20:09
Make it possible to require TLS. check-in: 44237d2647 user: js tags: trunk
2011-09-12
20:08
Update to recent ObjFW changes. check-in: fb7805c61b user: js tags: trunk
Changes

Modified src/XMPPConnection.h from [10b4b0b8c1] to [33bac8f070].

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
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







-
+












+







	OFXMLElementBuilder *elementBuilder, *oldElementBuilder;
	OFString *username, *password, *server, *domain, *resource;
	XMPPJID *JID;
	uint16_t port;
	id <XMPPConnectionDelegate, OFObject> delegate;
	XMPPAuthenticator *authModule;
	BOOL needsSession;
	BOOL encrypted;
	BOOL encryptionRequired, encrypted;
	unsigned int lastID;
	OFString *bindID, *sessionID;
	XMPPRoster *roster;
}

#ifdef OF_HAVE_PROPERTIES
@property (copy) OFString *username, *password, *server, *domain, *resource;
@property (copy, readonly) XMPPJID *JID;
@property (assign) uint16_t port;
@property (retain) id <XMPPConnectionDelegate> delegate;
@property (readonly, retain) XMPPRoster *roster;
@property (readonly, retain, getter=socket) OFTCPSocket *sock;
@property (assign) BOOL encryptionRequired;
@property (readonly) BOOL encrypted;
#endif

/**
 * \return A new autoreleased XMPPConnection
 */
+ connection;
117
118
119
120
121
122
123












124
125
126
127
128
129
130
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143







+
+
+
+
+
+
+
+
+
+
+
+







	 withLength: (size_t)length;

/**
 * \return The socket used by the XMPPConnection
 */
- (OFTCPSocket*)socket;

/**
 * \return Whether encryption is encrypted
 */
- (BOOL)encryptionRequired;

/**
 * Sets whether encryption is required.
 *
 * \param required Whether encryption is required
 */
- (void)setEncryptionRequired: (BOOL)required;

/**
 * \return Whether the connection is encrypted
 */
- (BOOL)encrypted;

/**
 * Sends an OFXMLElement, usually an XMPPStanza.

Modified src/XMPPConnection.m from [6deb2fd84f] to [0cbf475a00].

324
325
326
327
328
329
330










331
332
333
334
335
336
337
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347







+
+
+
+
+
+
+
+
+
+







	oldElementBuilder = nil;
}

- (OFTCPSocket*)socket
{
	return [[sock retain] autorelease];
}

- (BOOL)encryptionRequired
{
	return encryptionRequired;
}

- (void)setEncryptionRequired: (BOOL)required
{
	encryptionRequired = required;
}

- (BOOL)encrypted
{
	return encrypted;
}

- (void)sendStanza: (OFXMLElement*)element
707
708
709
710
711
712
713




714
715
716
717
718
719
720
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734







+
+
+
+







	if (starttls != nil) {
		[self sendStanza:
		    [OFXMLElement elementWithName: @"starttls"
					namespace: XMPP_NS_STARTTLS]];
		return;
	}

	if (encryptionRequired && !encrypted)
		/* TODO: Find/create an exception to throw here */
		@throw [OFException newWithClass: isa];

	if (mechs != nil) {
		OFEnumerator *enumerator;
		OFXMLElement *mech;

		enumerator = [[mechs children] objectEnumerator];
		while ((mech = [enumerator nextObject]) != nil)
			[mechanisms addObject: [mech stringValue]];