summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Swift/Controllers/MainController.cpp11
-rw-r--r--Swift/Controllers/MainController.h3
2 files changed, 14 insertions, 0 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index b925857..660c12f 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -554,6 +554,9 @@ void MainController::handleNotificationClicked(const JID& jid) {
void MainController::handleQuitRequest() {
if (client_ && client_->isActive()) {
quitRequested_ = true;
+ quitTimer_ = networkFactories_->getTimerFactory()->createTimer(SecondsToWaitBeforeForceQuitting * 1000);
+ quitTimer_->onTick.connect(boost::bind(&MainController::handleForceQuit, this));
+ quitTimer_->start();
client_->disconnect();
}
else {
@@ -562,4 +565,12 @@ void MainController::handleQuitRequest() {
}
}
+void MainController::handleForceQuit() {
+ delete client_;
+ client_ = NULL;
+ handleQuitRequest();
+}
+
+const int MainController::SecondsToWaitBeforeForceQuitting = 20;
+
}
diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h
index aece80f..8489f71 100644
--- a/Swift/Controllers/MainController.h
+++ b/Swift/Controllers/MainController.h
@@ -102,6 +102,7 @@ namespace Swift {
void reconnectAfterError();
void setManagersOffline();
void handleNotificationClicked(const JID& jid);
+ void handleForceQuit();
private:
EventLoop* eventLoop_;
@@ -141,8 +142,10 @@ namespace Swift {
UserSearchController* userSearchController_;
int timeBeforeNextReconnect_;
Timer::ref reconnectTimer_;
+ Timer::ref quitTimer_;
StatusTracker* statusTracker_;
bool myStatusLooksOnline_;
bool quitRequested_;
+ static const int SecondsToWaitBeforeForceQuitting;
};
}