diff options
author | Kevin Smith <git@kismith.co.uk> | 2009-09-16 09:47:42 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2009-09-16 09:47:42 (GMT) |
commit | 5d71183270c1b214a816e494ab7de9d94502df33 (patch) | |
tree | b5cbf5ff34a6f1cd03a673ad3adb956db7a6f438 /Swift/Controllers | |
parent | 9a02397822d7ef3dea95bc8821f14fb35d201b7b (diff) | |
download | swift-contrib-5d71183270c1b214a816e494ab7de9d94502df33.zip swift-contrib-5d71183270c1b214a816e494ab7de9d94502df33.tar.bz2 |
SignOut nearly working.
Diffstat (limited to 'Swift/Controllers')
-rw-r--r-- | Swift/Controllers/MainController.cpp | 7 | ||||
-rw-r--r-- | Swift/Controllers/MainController.h | 2 | ||||
-rw-r--r-- | Swift/Controllers/MainWindow.h | 1 | ||||
-rw-r--r-- | Swift/Controllers/RosterController.cpp | 1 | ||||
-rw-r--r-- | Swift/Controllers/RosterController.h | 1 |
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); |