summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers/Chat/ChatController.cpp')
-rw-r--r--Swift/Controllers/Chat/ChatController.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp
index 16b22fe..611f870 100644
--- a/Swift/Controllers/Chat/ChatController.cpp
+++ b/Swift/Controllers/Chat/ChatController.cpp
@@ -32,6 +32,7 @@
#include <Swiften/Elements/DeliveryReceipt.h>
#include <Swiften/Elements/DeliveryReceiptRequest.h>
#include <Swift/Controllers/SettingConstants.h>
+#include <Swift/Controllers/ScreenSharing/ScreenSharingController.h>
#include <Swiften/Base/Log.h>
@@ -79,6 +80,9 @@ ChatController::ChatController(const JID& self, StanzaChannel* stanzaChannel, IQ
chatWindow_->onWhiteboardSessionAccept.connect(boost::bind(&ChatController::handleWhiteboardSessionAccept, this));
chatWindow_->onWhiteboardSessionCancel.connect(boost::bind(&ChatController::handleWhiteboardSessionCancel, this));
chatWindow_->onWhiteboardWindowShow.connect(boost::bind(&ChatController::handleWhiteboardWindowShow, this));
+ chatWindow_->onScreenSharingAccept.connect(boost::bind(&ChatController::handleScreenSharingAccept, this, _1));
+ chatWindow_->onScreenSharingCancel.connect(boost::bind(&ChatController::handleScreenSharingCancel, this, _1));
+ chatWindow_->onScreenSharingStop.connect(boost::bind(&ChatController::handleScreenSharingStop, this, _1));
handleBareJIDCapsChanged(toJID_);
settings_->onSettingChanged.connect(boost::bind(&ChatController::handleSettingChanged, this, _1));
@@ -269,6 +273,14 @@ void ChatController::handleWhiteboardStateChange(const ChatWindow::WhiteboardSes
chatWindow_->setWhiteboardSessionStatus(lastWbID_, state);
}
+void ChatController::handleNewScreenSharingController(ScreenSharingController* ssc)
+{
+ std::string nick = senderDisplayNameFromMessage(ssc->getOtherParty());
+ std::string ssID = ssc->setChatWindow(chatWindow_, nick);
+
+ ssControllers[ssID] = ssc;
+}
+
void ChatController::handleFileTransferCancel(std::string id) {
SWIFT_LOG(debug) << "handleFileTransferCancel(" << id << ")" << std::endl;
if (ftControllers.find(id) != ftControllers.end()) {
@@ -313,6 +325,39 @@ void ChatController::handleWhiteboardWindowShow() {
eventStream_->send(boost::make_shared<ShowWhiteboardUIEvent>(toJID_));
}
+void ChatController::handleScreenSharingAccept(std::string id)
+{
+ SWIFT_LOG(debug) "handleScreenSharingAccept(" << id << ")" << std::endl;
+ std::map<std::string, ScreenSharingController*>::iterator controller = ssControllers.find(id);
+ if (controller != ssControllers.end()) {
+ controller->second->accept();
+ } else {
+ std::cerr << "unknown screen sharing UI id" << std::endl;
+ }
+}
+
+void ChatController::handleScreenSharingCancel(std::string id)
+{
+ SWIFT_LOG(debug) "handleScreenSharingCancel(" << id << ")" << std::endl;
+ std::map<std::string, ScreenSharingController*>::iterator controller = ssControllers.find(id);
+ if (controller != ssControllers.end()) {
+ controller->second->cancel();
+ } else {
+ std::cerr << "unknown screen sharing UI id" << std::endl;
+ }
+}
+
+void ChatController::handleScreenSharingStop(std::string id)
+{
+ SWIFT_LOG(debug) "handleScreenSharingStop(" << id << ")" << std::endl;
+ std::map<std::string, ScreenSharingController*>::iterator controller = ssControllers.find(id);
+ if (controller != ssControllers.end()) {
+ controller->second->stop();
+ } else {
+ std::cerr << "unknown screen sharing UI id" << std::endl;
+ }
+}
+
std::string ChatController::senderDisplayNameFromMessage(const JID& from) {
return nickResolver_->jidToNick(from);
}