Index: src/XMPPConnection.h ================================================================== --- src/XMPPConnection.h +++ src/XMPPConnection.h @@ -56,10 +56,12 @@ - (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. */ Index: src/XMPPConnection.m ================================================================== --- src/XMPPConnection.m +++ src/XMPPConnection.m @@ -344,15 +344,24 @@ } 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]; return; } @@ -752,6 +761,14 @@ } - (void)connectionWasClosed: (XMPPConnection*)conn { } + +- (void)connectionWillUpgradeToTLS: (XMPPConnection*)conn +{ +} + +- (void)connectionDidUpgradeToTLS: (XMPPConnection*)conn +{ +} @end