From dfeab948530982d10a7754a93a37cd8422888378 Mon Sep 17 00:00:00 2001 From: Mateusz Piekos Date: Tue, 5 Jun 2012 15:43:34 +0200 Subject: Restored ChatController and ChatsManager diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp index 38f443b..2fa4559 100644 --- a/Swift/Controllers/Chat/ChatController.cpp +++ b/Swift/Controllers/Chat/ChatController.cpp @@ -29,8 +29,6 @@ #include #include #include -#include -#include #include @@ -41,8 +39,6 @@ namespace Swift { */ ChatController::ChatController(const JID& self, StanzaChannel* stanzaChannel, IQRouter* iqRouter, ChatWindowFactory* chatWindowFactory, const JID &contact, NickResolver* nickResolver, PresenceOracle* presenceOracle, AvatarManager* avatarManager, bool isInMUC, bool useDelayForLatency, UIEventStream* eventStream, EventController* eventController, TimerFactory* timerFactory, EntityCapsProvider* entityCapsProvider, bool userWantsReceipts, SettingsProvider* settings) : ChatControllerBase(self, stanzaChannel, iqRouter, chatWindowFactory, contact, presenceOracle, avatarManager, useDelayForLatency, eventStream, eventController, timerFactory, entityCapsProvider), eventStream_(eventStream), userWantsReceipts_(userWantsReceipts), settings_(settings) { - WhiteboardWindowFactory* fac = dynamic_cast(chatWindowFactory); - whiteboardController_ = new WhiteboardController(stanzaChannel, toJID_, fac); isInMUC_ = isInMUC; lastWasPresence_ = false; chatStateNotifier_ = new ChatStateNotifier(stanzaChannel, contact, entityCapsProvider); @@ -93,7 +89,6 @@ ChatController::~ChatController() { nickResolver_->onNickChanged.disconnect(boost::bind(&ChatController::handleContactNickChanged, this, _1, _2)); delete chatStateNotifier_; delete chatStateTracker_; - delete whiteboardController_; } JID ChatController::getBaseJID() { @@ -143,7 +138,6 @@ bool ChatController::isIncomingMessageFromMe(boost::shared_ptr) { } void ChatController::preHandleIncomingMessage(boost::shared_ptr messageEvent) { - whiteboardController_->handleIncomingMessage(messageEvent); if (messageEvent->isReadable()) { chatWindow_->flash(); lastWasPresence_ = false; diff --git a/Swift/Controllers/Chat/ChatController.h b/Swift/Controllers/Chat/ChatController.h index a6a9efa..7043231 100644 --- a/Swift/Controllers/Chat/ChatController.h +++ b/Swift/Controllers/Chat/ChatController.h @@ -12,7 +12,6 @@ #include #include -#include "Swift/Controllers/WhiteboardController.h" namespace Swift { class AvatarManager; @@ -77,7 +76,6 @@ namespace Swift { bool userWantsReceipts_; std::map ftControllers; SettingsProvider* settings_; - WhiteboardController* whiteboardController_; }; } diff --git a/Swift/Controllers/Chat/ChatsManager.cpp b/Swift/Controllers/Chat/ChatsManager.cpp index b9a5759..da96603 100644 --- a/Swift/Controllers/Chat/ChatsManager.cpp +++ b/Swift/Controllers/Chat/ChatsManager.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -611,7 +610,7 @@ void ChatsManager::handleIncomingMessage(boost::shared_ptr message) { if (isMediatedInvite) { jid = (*message->getPayload()->getInvite()).from; } - if (!event->isReadable() && !message->getPayload() && !message->getPayload() && !message->getPayload() && !isInvite && !isMediatedInvite && !message->hasSubject() && !message->getPayload()) { + if (!event->isReadable() && !message->getPayload() && !message->getPayload() && !message->getPayload() && !isInvite && !isMediatedInvite && !message->hasSubject()) { return; } diff --git a/Swift/Controllers/WhiteboardController.cpp b/Swift/Controllers/WhiteboardController.cpp deleted file mode 100644 index 9228901..0000000 --- a/Swift/Controllers/WhiteboardController.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2012 Mateusz Piękos - * Licensed under the simplified BSD license. - * See Documentation/Licenses/BSD-simplified.txt for more information. - */ - -#include - -#include "Swift/Controllers/WhiteboardController.h" - -#include -#include - -#include - -#include - -namespace Swift { - WhiteboardController::WhiteboardController(StanzaChannel* stanzaChannel, const JID& toJID, WhiteboardWindowFactory* whiteboardWindowFactory) : stanzaChannel_(stanzaChannel), toJID_(toJID) { - whiteboardWindow_ = whiteboardWindowFactory->createWhiteboardWindow(); - whiteboardWindow_->show(); - whiteboardWindow_->onItemAdd.connect(boost::bind(&WhiteboardController::handleItemChange, this, _1)); - } - - WhiteboardController::~WhiteboardController() { - delete whiteboardWindow_; - } - - void WhiteboardController::handleIncomingMessage(boost::shared_ptr message) { - boost::shared_ptr wb = message->getStanza()->getPayload(); - if(wb) { - whiteboardWindow_->addItem(wb->getData()); - } - } - - void WhiteboardController::handleItemChange(std::string item) { - boost::shared_ptr mes(new Message()); - mes->setTo(toJID_); - boost::shared_ptr wbPayload(new WhiteboardPayload); - wbPayload->setData(item); -// mes->setType(Swift::Message::Chat); - mes->addPayload(wbPayload); - stanzaChannel_->sendMessage(mes); - } -} diff --git a/Swift/Controllers/WhiteboardController.h b/Swift/Controllers/WhiteboardController.h deleted file mode 100644 index aa1ace3..0000000 --- a/Swift/Controllers/WhiteboardController.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2012 Mateusz Piękos - * Licensed under the simplified BSD license. - * See Documentation/Licenses/BSD-simplified.txt for more information. - */ - -#pragma once - -#include - -#include -#include "Swiften/JID/JID.h" -#include "Swift/Controllers/XMPPEvents/MessageEvent.h" - -namespace Swift { - class WhiteboardWindow; - class WhiteboardWindowFactory; - - class WhiteboardController { - public: - WhiteboardController(StanzaChannel* stanzaChannel, const JID& toJID, WhiteboardWindowFactory* whiteboardWindowFactory); - ~WhiteboardController(); - void handleIncomingMessage(boost::shared_ptr message); - private: - void handleItemChange(std::string item); - WhiteboardWindow* whiteboardWindow_; - StanzaChannel* stanzaChannel_; - JID toJID_; - }; -} - -- cgit v0.10.2-6-g49f6