diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-12-13 21:11:02 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-12-13 21:11:02 (GMT) |
commit | 704d14b48f1baaa9b037787451e0239fdc7f0daa (patch) | |
tree | 73fa0664a3f3fca99e83882e0f6f680515d07704 /Swift | |
parent | 27878a6a612af77fdc6f27dacc0201a8da92a1fb (diff) | |
download | swift-contrib-704d14b48f1baaa9b037787451e0239fdc7f0daa.zip swift-contrib-704d14b48f1baaa9b037787451e0239fdc7f0daa.tar.bz2 |
Fixed reconnect for bare JIDs.
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/Controllers/MainController.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index 74e381a..56ebb0c 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -355,6 +355,13 @@ void MainController::handleLoginRequest(const String &username, const String &pa } void MainController::performLoginFromCachedCredentials() { + /* If we logged in with a bare JID, and we have a full bound JID, re-login with the + * bound JID to try and keep dynamically assigned resources */ + JID clientJID = jid_; + if (boundJID_.isValid() && jid_.isBare() && boundJID_.toBare() == jid_) { + clientJID = boundJID_; + } + if (!statusTracker_) { statusTracker_ = new StatusTracker(); } @@ -362,7 +369,7 @@ void MainController::performLoginFromCachedCredentials() { storages_ = storagesFactory_->createStorages(jid_.toBare()); certificateStorage_ = certificateStorageFactory_->createCertificateStorage(jid_.toBare()); certificateTrustChecker_ = new CertificateStorageTrustChecker(certificateStorage_); - client_ = new Swift::Client(eventLoop_, &networkFactories_, jid_, password_, storages_); + client_ = new Swift::Client(eventLoop_, &networkFactories_, clientJID, password_, storages_); client_->setCertificateTrustChecker(certificateTrustChecker_); // FIXME: Remove this line to activate the trust checker //client_->setAlwaysTrustCertificates(); @@ -393,13 +400,8 @@ void MainController::performLoginFromCachedCredentials() { if (rosterController_) { rosterController_->getWindow()->setConnecting(); } - /* If we logged in with a bare JID, and we have a full bound JID, re-login with the - * bound JID to try and keep dynamically assigned resources */ - if (boundJID_.isValid() && jid_.isBare() && boundJID_.toBare() == jid_) { - client_->connect(boundJID_); - } else { - client_->connect(); - } + + client_->connect(); } void MainController::handleDisconnected(const boost::optional<ClientError>& error) { |