Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Forward connection status delegate methods from on to client's delega…

…te with client object
  • Loading branch information...
commit 46fb9228e262259e06b68efb63445276c774f886 1 parent 5231d02
@benlangfeld authored
Showing with 41 additions and 2 deletions.
  1. +41 −2 TNStropheClient.j
View
43 TNStropheClient.j
@@ -136,6 +136,12 @@
[_connection disconnect];
}
+- (void)onStropheConnecting:(id)aConnection
+{
+ if ([_delegate respondsToSelector:@selector(onStropheConnecting:)])
+ [_delegate onStropheConnecting:self];
+}
+
- (void)onStropheConnected:(TNStropheConnection)aConnection
{
/*! Upon authenticating with a server and binding a resource (thus becoming a connected resource as
@@ -146,6 +152,22 @@
[self _sendInitialPresence];
[self _sendCAPS];
+
+ if ([_delegate respondsToSelector:@selector(onStropheConnected:)])
+ [_delegate onStropheConnected:self];
+}
+
+- (void)onStropheConnectFail:(id)aConnection
+{
+ [_roster clear];
+ if ([_delegate respondsToSelector:@selector(onStropheConnectFail:)])
+ [_delegate onStropheConnectFail:self];
+}
+
+- (void)onStropheDisconnecting:(id)aConnection
+{
+ if ([_delegate respondsToSelector:@selector(onStropheDisconnecting:)])
+ [_delegate onStropheDisconnecting:self];
}
- (void)onStropheDisconnected:(TNStropheConnection)aConnection
@@ -153,16 +175,33 @@
_userPresenceShow = TNStropheContactStatusOffline;
_userPresenceStatus = @"";
[_roster clear];
+ if ([_delegate respondsToSelector:@selector(onStropheDisconnected:)])
+ [_delegate onStropheDisconnected:self];
}
-- (void)onStropheConnectFail:(id)aConnection
+- (void)onStropheAuthenticating:(id)aConnection
{
- [_roster clear];
+ if ([_delegate respondsToSelector:@selector(onStropheAuthenticating:)])
+ [_delegate onStropheAuthenticating:self];
+}
+
+- (void)onStropheAuthFail:(id)aConnection
+{
+ if ([_delegate respondsToSelector:@selector(onStropheAuthFail:)])
+ [_delegate onStropheAuthFail:self];
}
- (void)onStropheError:(id)aConnection
{
[_roster clear];
+ if ([_delegate respondsToSelector:@selector(onStropheError:)])
+ [_delegate onStropheError:self];
+}
+
+- (void)connection:(id)aConnection errorCondition:(CPString)anErrorCondition
+{
+ if ([_delegate respondsToSelector:@selector(client:errorCondition:)])
+ [_delegate client:self errorCondition:anErrorCondition];
}
Please sign in to comment.
Something went wrong with that request. Please try again.