From 7d19f0d81371d86d530d0e7083a04db914ce6745 Mon Sep 17 00:00:00 2001 From: Kevin Smith Date: Tue, 29 Nov 2011 16:35:50 +0000 Subject: Change MainController to not log back in if there's an error during logout Resolves an issue where sending the stream close triggers an error. diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index d485abc..2f9c42e 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -124,6 +124,7 @@ MainController::MainController( adHocManager_ = NULL; quitRequested_ = false; clientInitialized_ = false; + offlineRequested_ = false; timeBeforeNextReconnect_ = -1; dock_ = dock; @@ -366,8 +367,10 @@ void MainController::handleChangeStatusRequest(StatusShow::Type show, const std: presence->setType(Presence::Unavailable); resetPendingReconnects(); myStatusLooksOnline_ = false; + offlineRequested_ = true; } else { + offlineRequested_ = false; presence->setShow(show); } presence->setStatus(statusText); @@ -501,6 +504,12 @@ void MainController::performLoginFromCachedCredentials() { ClientOptions clientOptions; clientOptions.forgetPassword = eagleMode_; clientOptions.useTLS = eagleMode_ ? ClientOptions::RequireTLS : ClientOptions::UseTLSWhenAvailable; + if (clientJID.getDomain() == "wonderland.lit") { + clientOptions.boshURL = URL("http", "192.168.1.185", 5280, "http-bind/"); + } + else if (clientJID.getDomain() == "prosody.doomsong.co.uk") { + clientOptions.boshURL = URL("http", "192.168.1.130", 5280, "http-bind/"); + } client_->connect(clientOptions); } @@ -570,7 +579,9 @@ void MainController::handleDisconnected(const boost::optional& erro if (eagleMode_) { message = str(format(QT_TRANSLATE_NOOP("", "Disconnected from %1%: %2%. To reconnect, Sign Out and provide your password again.")) % jid_.getDomain() % message); } else { - setReconnectTimer(); + if (!offlineRequested_) { + setReconnectTimer(); + } if (lastDisconnectError_) { message = str(format(QT_TRANSLATE_NOOP("", "Reconnect to %1% failed: %2%. Will retry in %3% seconds.")) % jid_.getDomain() % message % boost::lexical_cast(timeBeforeNextReconnect_)); lastDisconnectError_->conclude(); diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h index 12028d7..013f8bb 100644 --- a/Swift/Controllers/MainController.h +++ b/Swift/Controllers/MainController.h @@ -164,6 +164,7 @@ namespace Swift { StatusTracker* statusTracker_; bool myStatusLooksOnline_; bool quitRequested_; + bool offlineRequested_; static const int SecondsToWaitBeforeForceQuitting; bool eagleMode_; FileTransferOverview* ftOverview_; -- cgit v0.10.2-6-g49f6