Add two delegates for TLS upgrades.
This way, an OFStreamObserver can be used even with TLS.
This commit is contained in:
parent
05c2784b17
commit
a9443417bc
2 changed files with 21 additions and 2 deletions
|
@ -58,6 +58,8 @@
|
|||
- (void)connection: (XMPPConnection*)conn
|
||||
didReceiveMessage: (XMPPMessage*)msg;
|
||||
- (void)connectionWasClosed: (XMPPConnection*)conn;
|
||||
- (void)connectionWillUpgradeToTLS: (XMPPConnection*)conn;
|
||||
- (void)connectionDidUpgradeToTLS: (XMPPConnection*)conn;
|
||||
@end
|
||||
|
||||
/**
|
||||
|
|
|
@ -346,11 +346,20 @@
|
|||
if ([[elem namespace] isEqual: XMPP_NS_STARTTLS]) {
|
||||
if ([[elem name] isEqual: @"proceed"]) {
|
||||
/* FIXME: Catch errors here */
|
||||
SSLSocket *newSock = [[SSLSocket alloc]
|
||||
initWithSocket: sock];
|
||||
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];
|
||||
|
@ -754,4 +763,12 @@
|
|||
- (void)connectionWasClosed: (XMPPConnection*)conn
|
||||
{
|
||||
}
|
||||
|
||||
- (void)connectionWillUpgradeToTLS: (XMPPConnection*)conn
|
||||
{
|
||||
}
|
||||
|
||||
- (void)connectionDidUpgradeToTLS: (XMPPConnection*)conn
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue