diff options
author | Kevin Smith <git@kismith.co.uk> | 2009-11-14 14:33:14 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2009-11-19 20:55:28 (GMT) |
commit | 3da134b970a6f25a5e900bd2a55b03c5242378f0 (patch) | |
tree | 56bac33303058ba210f00bbe151739469e90dad0 | |
parent | 250ede4f32a14f566fbafd634e2024c93677cf19 (diff) | |
download | swift-contrib-3da134b970a6f25a5e900bd2a55b03c5242378f0.zip swift-contrib-3da134b970a6f25a5e900bd2a55b03c5242378f0.tar.bz2 |
Reconnect automatically on error
-rw-r--r-- | Swift/Controllers/MainController.cpp | 8 | ||||
-rw-r--r-- | Swift/Controllers/MainController.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp index c4d34d8..2ae110b 100644 --- a/Swift/Controllers/MainController.cpp +++ b/Swift/Controllers/MainController.cpp @@ -184,6 +184,11 @@ void MainController::handleEventQueueLengthChange(int count) { application_->getApplicationMessageDisplay()->setMessage(count == 0 ? "" : boost::lexical_cast<std::string>(count).c_str()); } +void MainController::reconnectAfterError() { + performLoginFromCachedCredentials(); + sendPresence(queuedPresence_); +} + void MainController::handleChangeStatusRequest(StatusShow::Type show, const String &statusText) { boost::shared_ptr<Presence> presence(new Presence()); if (show == StatusShow::None) { @@ -287,6 +292,9 @@ void MainController::handleError(const ClientError& error) { loginWindow_->setMessage(message); } logout(); + if (rosterController_) { + //reconnectAfterError(); + } } void MainController::handleCancelLoginRequest() { diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h index db6a110..df6901d 100644 --- a/Swift/Controllers/MainController.h +++ b/Swift/Controllers/MainController.h @@ -77,6 +77,7 @@ namespace Swift { virtual bool isMUC(const JID& muc) const; void performLoginFromCachedCredentials(); + void reconnectAfterError(); void setManagersEnabled(bool enabled); Client* client_; ChatWindowFactory* chatWindowFactory_; |