ObjXMPP  Check-in [1faf025f1a]

Overview
Comment:Add two delegates for TLS upgrades.
This way, an OFStreamObserver can be used even with TLS.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 1faf025f1a932ce4a1bab21d53ba3a5cdcb2e322b2faaad40e8abdf152543dd2
User & Date: js on 2011-04-03 11:48:59
Other Links: manifest | tags
Context
2011-04-03
22:48
Handle roster pushs check-in: f6c4d76bfa user: florob@babelmonkeys.de tags: trunk
11:48
Add two delegates for TLS upgrades.
This way, an OFStreamObserver can be used even with TLS.
check-in: 1faf025f1a user: js tags: trunk
2011-04-02
14:07
Don't leak the old socket when using STARTTLS. check-in: c59cefc261 user: js tags: trunk
Changes

Modified src/XMPPConnection.h from [63ae59d595] to [6b484a50e7].

54
55
56
57
58
59
60


61
62
63
64
65
66
67
- (BOOL)connection: (XMPPConnection*)conn
      didReceiveIQ: (XMPPIQ*)iq;
-   (void)connection: (XMPPConnection*)conn
  didReceivePresence: (XMPPPresence*)pres;
-  (void)connection: (XMPPConnection*)conn
  didReceiveMessage: (XMPPMessage*)msg;
- (void)connectionWasClosed: (XMPPConnection*)conn;


@end

/**
 * \brief A class which abstracts a connection to an XMPP service.
 */
@interface XMPPConnection: OFObject
#ifdef OF_HAVE_OPTONAL_PROTOCOLS







>
>







54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
- (BOOL)connection: (XMPPConnection*)conn
      didReceiveIQ: (XMPPIQ*)iq;
-   (void)connection: (XMPPConnection*)conn
  didReceivePresence: (XMPPPresence*)pres;
-  (void)connection: (XMPPConnection*)conn
  didReceiveMessage: (XMPPMessage*)msg;
- (void)connectionWasClosed: (XMPPConnection*)conn;
- (void)connectionWillUpgradeToTLS: (XMPPConnection*)conn;
- (void)connectionDidUpgradeToTLS: (XMPPConnection*)conn;
@end

/**
 * \brief A class which abstracts a connection to an XMPP service.
 */
@interface XMPPConnection: OFObject
#ifdef OF_HAVE_OPTONAL_PROTOCOLS

Modified src/XMPPConnection.m from [bba441d31e] to [a3a4d92ecf].

342
343
344
345
346
347
348
349





350
351
352
353




354
355
356
357
358
359
360

		assert(0);
	}

	if ([[elem namespace] isEqual: XMPP_NS_STARTTLS]) {
		if ([[elem name] isEqual: @"proceed"]) {
			/* FIXME: Catch errors here */
			SSLSocket *newSock = [[SSLSocket alloc]





			    initWithSocket: sock];
			[sock release];
			sock = newSock;





			/* Stream restart */
			[parser setDelegate: self];
			[self XMPP_startStream];
			return;
		}

		if ([[elem name] isEqual: @"failure"])







|
>
>
>
>
>
|



>
>
>
>







342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369

		assert(0);
	}

	if ([[elem namespace] isEqual: XMPP_NS_STARTTLS]) {
		if ([[elem name] isEqual: @"proceed"]) {
			/* FIXME: Catch errors here */
			SSLSocket *newSock;

			if ([delegate respondsToSelector:
			    @selector(connectionWillUpgradeToTLS:)])
				[delegate connectionWillUpgradeToTLS: self];

			newSock = [[SSLSocket alloc] initWithSocket: sock];
			[sock release];
			sock = newSock;

			if ([delegate respondsToSelector:
			    @selector(connectionDidUpgradeToTLS:)])
				[delegate connectionDidUpgradeToTLS: self];

			/* Stream restart */
			[parser setDelegate: self];
			[self XMPP_startStream];
			return;
		}

		if ([[elem name] isEqual: @"failure"])
750
751
752
753
754
755
756








757
  didReceiveMessage: (XMPPMessage*)msg
{
}

- (void)connectionWasClosed: (XMPPConnection*)conn
{
}








@end







>
>
>
>
>
>
>
>

759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
  didReceiveMessage: (XMPPMessage*)msg
{
}

- (void)connectionWasClosed: (XMPPConnection*)conn
{
}

- (void)connectionWillUpgradeToTLS: (XMPPConnection*)conn
{
}

- (void)connectionDidUpgradeToTLS: (XMPPConnection*)conn
{
}
@end