Permalink
Browse files

Allow a connection to keep track of its last connected JID

* Ask the delegate for the JID first to get more up to date
  • Loading branch information...
1 parent 48c3c12 commit b42264a79d9527444937351b5c117cadea77f2ec @benlangfeld committed Jan 16, 2011
Showing with 11 additions and 1 deletion.
  1. +11 −1 TNStropheConnection.j
View
@@ -75,7 +75,6 @@
id _delegate @accessors(getter=delegate);
int _connectionTimeout @accessors(property=connectionTimeout);
int _maxConnections @accessors(property=maxConnections);
- TNStropheJID _JID @accessors(property=JID);
CPArray _registeredHandlers;
CPArray _registeredTimedHandlers;
@@ -84,6 +83,7 @@
CPString _userPresenceStatus;
CPTimer _giveUpTimer;
id _connection;
+ TNStropheJID _JID;
}
#pragma mark -
@@ -136,13 +136,23 @@
#pragma mark -
#pragma mark Connection
+- (TNStropheJID)JID
+{
+ if ([_delegate respondsToSelector:@selector(JID)])
+ return [_delegate JID];
+ else
+ return _JID;
+}
+
/*! connect to the XMPP Bosh Service. on different events, messages are sent to delegate and notification are sent
*/
- (void)connectWithJID:(TNStropheJID)aJID andPassword:(CPString)aPassword
{
if (_currentStatus !== Strophe.Status.DISCONNECTED)
return;
+ _JID = aJID;
+
_connection.connect([aJID full], aPassword, function (status, errorCond)
{
var selector,

0 comments on commit b42264a

Please sign in to comment.