diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-10-01 14:08:08 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-10-01 14:08:08 (GMT) |
commit | 1d23fbe7acbfed25578958fb24aa75416f2ab737 (patch) | |
tree | 792e9f641900c263bc974f69debdf0494dfe4d9a /Swift/Controllers | |
parent | 90055ade3899ffa1d0ee700d218a259b39052270 (diff) | |
download | swift-contrib-1d23fbe7acbfed25578958fb24aa75416f2ab737.zip swift-contrib-1d23fbe7acbfed25578958fb24aa75416f2ab737.tar.bz2 |
Reuse server-generated resources.
Once a new method has been implemented in Client, this will re-use
a server-generated resource for re-connections within the same
Swift session. This provides a stable resource for the session,
preventing MUC ghosts and similar artifacts due to server or network
failures, without disclosing additional information like hostnames
in the resource.
Resolves: #563
Diffstat (limited to 'Swift/Controllers')
-rw-r--r-- | Swift/Controllers/MainController.cpp | 7 | ||||
-rw-r--r-- | Swift/Controllers/MainController.h | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index fdfab98..7ff3ed0 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -247,6 +247,7 @@ void MainController::resetCurrentError() { } void MainController::handleConnected() { + boundJID_ = client_->getBoundJID(); loginWindow_->setIsLoggingIn(false); resetCurrentError(); resetPendingReconnects(); @@ -419,7 +420,11 @@ void MainController::performLoginFromCachedCredentials() { /* In case we're in the middle of another login, make sure they don't overlap */ client_->disconnect(); } - client_->connect(); + if (boundJID_.isValid() && jid_.isBare()) { + client_->connect(boundJID_); + } else { + client_->connect(); + } } void MainController::handleError(const ClientError& error) { diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h index c0885b6..ed2cee2 100644 --- a/Swift/Controllers/MainController.h +++ b/Swift/Controllers/MainController.h @@ -157,6 +157,7 @@ namespace Swift { boost::shared_ptr<DiscoInfo> serverDiscoInfo_; XMPPRoster* xmppRoster_;; JID jid_; + JID boundJID_; PresenceOracle* presenceOracle_; SystemTrayController* systemTrayController_; SoundEventController* soundEventController_; |