summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2011-11-29 16:35:50 (GMT)
committerKevin Smith <git@kismith.co.uk>2011-12-13 08:17:10 (GMT)
commit7d19f0d81371d86d530d0e7083a04db914ce6745 (patch)
tree8ad4647f8f87591e97d3478fd493bdd81425cc83
parentdd721764a3605d14e0a8970e8bf0976657da8e4a (diff)
downloadswift-contrib-7d19f0d81371d86d530d0e7083a04db914ce6745.zip
swift-contrib-7d19f0d81371d86d530d0e7083a04db914ce6745.tar.bz2
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.
-rw-r--r--Swift/Controllers/MainController.cpp13
-rw-r--r--Swift/Controllers/MainController.h1
2 files changed, 13 insertions, 1 deletions
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<ClientError>& 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<std::string>(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_;