summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/MainController.cpp7
-rw-r--r--Swift/Controllers/MainController.h2
-rw-r--r--Swift/Controllers/MainWindow.h1
-rw-r--r--Swift/Controllers/RosterController.cpp1
-rw-r--r--Swift/Controllers/RosterController.h1
5 files changed, 10 insertions, 2 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 63c854f..958a2ed 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -135,6 +135,7 @@ void MainController::handleConnected() {
rosterController_->onStartChatRequest.connect(boost::bind(&MainController::handleChatRequest, this, _1));
rosterController_->onJoinMUCRequest.connect(boost::bind(&MainController::handleJoinMUCRequest, this, _1, _2));
rosterController_->onChangeStatusRequest.connect(boost::bind(&MainController::handleChangeStatusRequest, this, _1, _2));
+ rosterController_->onSignOutRequest.connect(boost::bind(&MainController::signOut, this));
xmppRosterController_ = new XMPPRosterController(client_, xmppRoster_);
xmppRosterController_->requestRoster();
@@ -262,7 +263,8 @@ void MainController::handleError(const ClientError& error) {
logout();
}
-void MainController::signout() {
+void MainController::signOut() {
+ logout();
loginWindow_->loggedOut();
foreach (JIDChatControllerPair controllerPair, chatControllers_) {
delete controllerPair.second;
@@ -278,6 +280,9 @@ void MainController::signout() {
}
void MainController::logout() {
+ if (client_->isAvailable()) {
+ client_->disconnect();
+ }
setManagersEnabled(false);
}
diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h
index a52ebba..5c2b523 100644
--- a/Swift/Controllers/MainController.h
+++ b/Swift/Controllers/MainController.h
@@ -68,7 +68,7 @@ namespace Swift {
ChatController* getChatController(const JID &contact);
void sendPresence(boost::shared_ptr<Presence> presence);
void logout();
- void signout();
+ void signOut();
virtual bool isMUC(const JID& muc) const;
diff --git a/Swift/Controllers/MainWindow.h b/Swift/Controllers/MainWindow.h
index 1098230..93345ff 100644
--- a/Swift/Controllers/MainWindow.h
+++ b/Swift/Controllers/MainWindow.h
@@ -24,6 +24,7 @@ namespace Swift {
boost::signal<void (const JID&, const String&)> onJoinMUCRequest;
boost::signal<void (StatusShow::Type, const String&)> onChangeStatusRequest;
boost::signal<void (bool)> onShowOfflineToggled;
+ boost::signal<void ()> onSignOutRequest;
};
}
#endif
diff --git a/Swift/Controllers/RosterController.cpp b/Swift/Controllers/RosterController.cpp
index 6da5faf..07edcf3 100644
--- a/Swift/Controllers/RosterController.cpp
+++ b/Swift/Controllers/RosterController.cpp
@@ -32,6 +32,7 @@ RosterController::RosterController(const JID& jid, boost::shared_ptr<XMPPRoster>
mainWindow_->onJoinMUCRequest.connect(boost::bind(&RosterController::handleJoinMUCRequest, this, _1, _2));
mainWindow_->onChangeStatusRequest.connect(boost::bind(&RosterController::handleChangeStatusRequest, this, _1, _2));
mainWindow_->onShowOfflineToggled.connect(boost::bind(&RosterController::handleShowOfflineToggled, this, _1));
+ mainWindow_->onSignOutRequest.connect(boost::bind(boost::ref(onSignOutRequest)));
roster_->onUserAction.connect(boost::bind(&RosterController::handleUserAction, this, _1));
xmppRoster_->onJIDAdded.connect(boost::bind(&RosterController::handleOnJIDAdded, this, _1));
avatarManager_ = NULL;
diff --git a/Swift/Controllers/RosterController.h b/Swift/Controllers/RosterController.h
index 50aff49..0da00ac 100644
--- a/Swift/Controllers/RosterController.h
+++ b/Swift/Controllers/RosterController.h
@@ -31,6 +31,7 @@ namespace Swift {
boost::signal<void (const JID&)> onStartChatRequest;
boost::signal<void (const JID&, const String&)> onJoinMUCRequest;
boost::signal<void (StatusShow::Type, const String&)> onChangeStatusRequest;
+ boost::signal<void ()> onSignOutRequest;
void handleIncomingPresence(boost::shared_ptr<Presence> presence);
void handleAvatarChanged(const JID& jid, const String& hash);
void setEnabled(bool enabled);