summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/ChatControllerBase.cpp1
-rw-r--r--Swift/Controllers/MainController.cpp24
-rw-r--r--Swift/Controllers/MainController.h3
3 files changed, 9 insertions, 19 deletions
diff --git a/Swift/Controllers/ChatControllerBase.cpp b/Swift/Controllers/ChatControllerBase.cpp
index 7d11401..baa715b 100644
--- a/Swift/Controllers/ChatControllerBase.cpp
+++ b/Swift/Controllers/ChatControllerBase.cpp
@@ -16,6 +16,7 @@ ChatControllerBase::ChatControllerBase(const JID& self, StanzaChannel* stanzaCha
chatWindow_ = chatWindowFactory_->createChatWindow(toJID);
chatWindow_->onAllMessagesRead.connect(boost::bind(&ChatControllerBase::handleAllMessagesRead, this));
chatWindow_->onSendMessageRequest.connect(boost::bind(&ChatControllerBase::handleSendMessageRequest, this, _1));
+ setEnabled(stanzaChannel->isAvailable() && iqRouter->isAvailable());
}
ChatControllerBase::~ChatControllerBase() {
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index a8fec70..63c854f 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -168,7 +168,7 @@ void MainController::handleConnected() {
initialPresence = boost::shared_ptr<Presence>(new Presence());
}
initialPresence->addPayload(capsInfo_);
- enableManagers();
+ setManagersEnabled(true);
sendPresence(initialPresence);
}
@@ -278,30 +278,20 @@ void MainController::signout() {
}
void MainController::logout() {
- disableManagers();
+ setManagersEnabled(false);
}
-void MainController::disableManagers() {
+void MainController::setManagersEnabled(bool enabled) {
foreach (JIDChatControllerPair controllerPair, chatControllers_) {
- controllerPair.second->setEnabled(false);
+ //printf("Setting enabled on %d to %d\n", controllerPair.second, enabled);
+ controllerPair.second->setEnabled(enabled);
}
foreach (JIDMUCControllerPair controllerPair, mucControllers_) {
- controllerPair.second->setEnabled(false);
+ controllerPair.second->setEnabled(enabled);
}
- rosterController_->setEnabled(false);
+ rosterController_->setEnabled(enabled);
}
-void MainController::enableManagers() {
- foreach (JIDChatControllerPair controllerPair, chatControllers_) {
- controllerPair.second->setEnabled(true);
- }
- foreach (JIDMUCControllerPair controllerPair, mucControllers_) {
- controllerPair.second->setEnabled(true);
- }
- rosterController_->setEnabled(true);
-}
-
-
void MainController::handleChatRequest(const String &contact) {
ChatController* controller = getChatController(JID(contact));
controller->showChatWindow();
diff --git a/Swift/Controllers/MainController.h b/Swift/Controllers/MainController.h
index 3fbe9b4..a52ebba 100644
--- a/Swift/Controllers/MainController.h
+++ b/Swift/Controllers/MainController.h
@@ -74,8 +74,7 @@ namespace Swift {
private:
void performLoginFromCachedCredentials();
- void enableManagers();
- void disableManagers();
+ void setManagersEnabled(bool enabled);
Client* client_;
ChatWindowFactory* chatWindowFactory_;
MainWindowFactory* mainWindowFactory_;