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
|
- (void)connection: (XMPPConnection*)conn
|
||||||
didReceiveMessage: (XMPPMessage*)msg;
|
didReceiveMessage: (XMPPMessage*)msg;
|
||||||
- (void)connectionWasClosed: (XMPPConnection*)conn;
|
- (void)connectionWasClosed: (XMPPConnection*)conn;
|
||||||
|
- (void)connectionWillUpgradeToTLS: (XMPPConnection*)conn;
|
||||||
|
- (void)connectionDidUpgradeToTLS: (XMPPConnection*)conn;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -346,11 +346,20 @@
|
||||||
if ([[elem namespace] isEqual: XMPP_NS_STARTTLS]) {
|
if ([[elem namespace] isEqual: XMPP_NS_STARTTLS]) {
|
||||||
if ([[elem name] isEqual: @"proceed"]) {
|
if ([[elem name] isEqual: @"proceed"]) {
|
||||||
/* FIXME: Catch errors here */
|
/* FIXME: Catch errors here */
|
||||||
SSLSocket *newSock = [[SSLSocket alloc]
|
SSLSocket *newSock;
|
||||||
initWithSocket: sock];
|
|
||||||
|
if ([delegate respondsToSelector:
|
||||||
|
@selector(connectionWillUpgradeToTLS:)])
|
||||||
|
[delegate connectionWillUpgradeToTLS: self];
|
||||||
|
|
||||||
|
newSock = [[SSLSocket alloc] initWithSocket: sock];
|
||||||
[sock release];
|
[sock release];
|
||||||
sock = newSock;
|
sock = newSock;
|
||||||
|
|
||||||
|
if ([delegate respondsToSelector:
|
||||||
|
@selector(connectionDidUpgradeToTLS:)])
|
||||||
|
[delegate connectionDidUpgradeToTLS: self];
|
||||||
|
|
||||||
/* Stream restart */
|
/* Stream restart */
|
||||||
[parser setDelegate: self];
|
[parser setDelegate: self];
|
||||||
[self XMPP_startStream];
|
[self XMPP_startStream];
|
||||||
|
@ -754,4 +763,12 @@
|
||||||
- (void)connectionWasClosed: (XMPPConnection*)conn
|
- (void)connectionWasClosed: (XMPPConnection*)conn
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)connectionWillUpgradeToTLS: (XMPPConnection*)conn
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)connectionDidUpgradeToTLS: (XMPPConnection*)conn
|
||||||
|
{
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue