summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMateusz Piekos <mateuszpiekos@gmail.com>2012-06-05 13:43:34 (GMT)
committerMateusz Piekos <mateuszpiekos@gmail.com>2012-06-05 13:43:34 (GMT)
commitdfeab948530982d10a7754a93a37cd8422888378 (patch)
tree68f437c9b100794fefb75f8cf143722e11f973cd
parent7520c7fed383d4f7631f5572ef40379022126264 (diff)
downloadswift-contrib-dfeab948530982d10a7754a93a37cd8422888378.zip
swift-contrib-dfeab948530982d10a7754a93a37cd8422888378.tar.bz2
Restored ChatController and ChatsManager
-rw-r--r--Swift/Controllers/Chat/ChatController.cpp6
-rw-r--r--Swift/Controllers/Chat/ChatController.h2
-rw-r--r--Swift/Controllers/Chat/ChatsManager.cpp3
-rw-r--r--Swift/Controllers/WhiteboardController.cpp45
-rw-r--r--Swift/Controllers/WhiteboardController.h31
5 files changed, 1 insertions, 86 deletions
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 <Swiften/Elements/DeliveryReceipt.h>
#include <Swiften/Elements/DeliveryReceiptRequest.h>
#include <Swift/Controllers/SettingConstants.h>
-#include <Swift/Controllers/UIInterfaces/WhiteboardWindowFactory.h>
-#include <Swift/Controllers/WhiteboardController.h>
#include <Swiften/Base/Log.h>
@@ -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<WhiteboardWindowFactory*>(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<Message>) {
}
void ChatController::preHandleIncomingMessage(boost::shared_ptr<MessageEvent> 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 <string>
#include <Swift/Controllers/UIInterfaces/ChatWindow.h>
-#include "Swift/Controllers/WhiteboardController.h"
namespace Swift {
class AvatarManager;
@@ -77,7 +76,6 @@ namespace Swift {
bool userWantsReceipts_;
std::map<std::string, FileTransferController*> 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 <Swiften/MUC/MUCManager.h>
#include <Swiften/Elements/ChatState.h>
#include <Swiften/Elements/MUCUserPayload.h>
-#include <Swiften/Elements/WhiteboardPayload.h>
#include <Swiften/Elements/DeliveryReceipt.h>
#include <Swiften/Elements/DeliveryReceiptRequest.h>
#include <Swiften/MUC/MUCBookmarkManager.h>
@@ -611,7 +610,7 @@ void ChatsManager::handleIncomingMessage(boost::shared_ptr<Message> message) {
if (isMediatedInvite) {
jid = (*message->getPayload<MUCUserPayload>()->getInvite()).from;
}
- if (!event->isReadable() && !message->getPayload<ChatState>() && !message->getPayload<DeliveryReceipt>() && !message->getPayload<DeliveryReceiptRequest>() && !isInvite && !isMediatedInvite && !message->hasSubject() && !message->getPayload<WhiteboardPayload>()) {
+ if (!event->isReadable() && !message->getPayload<ChatState>() && !message->getPayload<DeliveryReceipt>() && !message->getPayload<DeliveryReceiptRequest>() && !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 <boost/bind.hpp>
-
-#include "Swift/Controllers/WhiteboardController.h"
-
-#include <Swift/Controllers/UIInterfaces/WhiteboardWindowFactory.h>
-#include <Swift/Controllers/UIInterfaces/WhiteboardWindow.h>
-
-#include <Swiften/Elements/WhiteboardPayload.h>
-
-#include <iostream>
-
-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<MessageEvent> message) {
- boost::shared_ptr<WhiteboardPayload> wb = message->getStanza()->getPayload<WhiteboardPayload>();
- if(wb) {
- whiteboardWindow_->addItem(wb->getData());
- }
- }
-
- void WhiteboardController::handleItemChange(std::string item) {
- boost::shared_ptr<Message> mes(new Message());
- mes->setTo(toJID_);
- boost::shared_ptr<WhiteboardPayload> 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 <boost/shared_ptr.hpp>
-
-#include <Swiften/Client/StanzaChannel.h>
-#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<MessageEvent> message);
- private:
- void handleItemChange(std::string item);
- WhiteboardWindow* whiteboardWindow_;
- StanzaChannel* stanzaChannel_;
- JID toJID_;
- };
-}
-