summaryrefslogtreecommitdiffstats
path: root/Swift
diff options
context:
space:
mode:
Diffstat (limited to 'Swift')
-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
-rw-r--r--Swift/QtUI/QtMainWindow.cpp7
-rw-r--r--Swift/QtUI/QtMainWindow.h1
7 files changed, 18 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);
diff --git a/Swift/QtUI/QtMainWindow.cpp b/Swift/QtUI/QtMainWindow.cpp
index e3c6e35..ed7e67b 100644
--- a/Swift/QtUI/QtMainWindow.cpp
+++ b/Swift/QtUI/QtMainWindow.cpp
@@ -70,6 +70,9 @@ QtMainWindow::QtMainWindow(QtTreeWidgetFactory *treeWidgetFactory) : QWidget() {
QAction* joinMUCAction = new QAction("Join chatroom", this);
connect(joinMUCAction, SIGNAL(triggered()), SLOT(handleJoinMUCAction()));
chatMenu->addAction(joinMUCAction);
+ QAction* signOutAction = new QAction("Sign Out", this);
+ connect(signOutAction, SIGNAL(triggered()), SLOT(handleSignOutAction()));
+ chatMenu->addAction(signOutAction);
}
void QtMainWindow::handleAddActionTriggered(bool checked) {
@@ -79,6 +82,10 @@ void QtMainWindow::handleAddActionTriggered(bool checked) {
addContact->show();
}
+void QtMainWindow::handleSignOutAction() {
+ onSignOutRequest();
+}
+
void QtMainWindow::handleAddContactDialogComplete(const JID& contact, const QString& name) {
onAddContactRequest(contact, Q2PSTRING(name));
}
diff --git a/Swift/QtUI/QtMainWindow.h b/Swift/QtUI/QtMainWindow.h
index 1faf65a..afe6ccd 100644
--- a/Swift/QtUI/QtMainWindow.h
+++ b/Swift/QtUI/QtMainWindow.h
@@ -35,6 +35,7 @@ namespace Swift {
void handleStatusChanged(StatusShow::Type showType, const QString &statusMessage);
void handleShowOfflineToggled(bool);
void handleJoinMUCAction();
+ void handleSignOutAction();
void handleJoinMUCDialogComplete(const JID& muc, const QString& nick);
void handleAddContactDialogComplete(const JID& contact, const QString& name);
void handleAddActionTriggered(bool checked);