summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMateusz Piekos <mateuszpiekos@gmail.com>2012-06-14 14:23:32 (GMT)
committerMateusz Piekos <mateuszpiekos@gmail.com>2012-06-14 14:23:32 (GMT)
commit83f6dbd0036f3f2e23f9015626ef42d4836fbeee (patch)
tree0fbb4ce455b3b22133138ffcd7dd714cc3f652d1 /Swift/Controllers/Chat/ChatController.cpp
parent94259d74a5f21d7dbe4ef30bfe433e3950c135f6 (diff)
downloadswift-contrib-83f6dbd0036f3f2e23f9015626ef42d4836fbeee.zip
swift-contrib-83f6dbd0036f3f2e23f9015626ef42d4836fbeee.tar.bz2
Improved session initialization from UI side
Diffstat (limited to 'Swift/Controllers/Chat/ChatController.cpp')
-rw-r--r--Swift/Controllers/Chat/ChatController.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp
index 12d3814..3b74368 100644
--- a/Swift/Controllers/Chat/ChatController.cpp
+++ b/Swift/Controllers/Chat/ChatController.cpp
@@ -26,6 +26,9 @@
#include <Swiften/Base/foreach.h>
#include <Swift/Controllers/UIEvents/UIEventStream.h>
#include <Swift/Controllers/UIEvents/SendFileUIEvent.h>
+#include <Swift/Controllers/UIEvents/AcceptWhiteboardSessionUIEvent.h>
+#include <Swift/Controllers/UIEvents/CancelWhiteboardSessionUIEvent.h>
+#include <Swift/Controllers/UIEvents/ShowWhiteboardUIEvent.h>
#include <Swiften/Elements/DeliveryReceipt.h>
#include <Swiften/Elements/DeliveryReceiptRequest.h>
#include <Swift/Controllers/SettingConstants.h>
@@ -73,6 +76,9 @@ ChatController::ChatController(const JID& self, StanzaChannel* stanzaChannel, IQ
chatWindow_->onFileTransferAccept.connect(boost::bind(&ChatController::handleFileTransferAccept, this, _1, _2));
chatWindow_->onFileTransferCancel.connect(boost::bind(&ChatController::handleFileTransferCancel, this, _1));
chatWindow_->onSendFileRequest.connect(boost::bind(&ChatController::handleSendFileRequest, this, _1));
+ chatWindow_->onWhiteboardSessionAccept.connect(boost::bind(&ChatController::handleWhiteboardSessionAccept, this));
+ chatWindow_->onWhiteboardSessionCancel.connect(boost::bind(&ChatController::handleWhiteboardSessionCancel, this));
+ chatWindow_->onWhiteboardWindowShow.connect(boost::bind(&ChatController::handleWhiteboardWindowShow, this));
handleBareJIDCapsChanged(toJID_);
settings_->onSettingChanged.connect(boost::bind(&ChatController::handleSettingChanged, this, _1));
@@ -255,8 +261,12 @@ void ChatController::handleNewFileTransferController(FileTransferController* ftc
ftControllers[ftID] = ftc;
}
-void ChatController::handleIncomingWhiteboardSession() {
- chatWindow_->addWhiteboardRequest(toJID_);
+void ChatController::handleWhiteboardSessionRequest(bool senderIsSelf) {
+ lastWbID_ = chatWindow_->addWhiteboardRequest(toJID_, senderIsSelf);
+}
+
+void ChatController::handleWhiteboardStateChange(const ChatWindow::WhiteboardSessionState state) {
+ chatWindow_->setWhiteboardSessionStatus(lastWbID_, state);
}
void ChatController::handleFileTransferCancel(std::string id) {
@@ -291,6 +301,18 @@ void ChatController::handleSendFileRequest(std::string filename) {
eventStream_->send(boost::make_shared<SendFileUIEvent>(getToJID(), filename));
}
+void ChatController::handleWhiteboardSessionAccept() {
+ eventStream_->send(boost::make_shared<AcceptWhiteboardSessionUIEvent>(toJID_));
+}
+
+void ChatController::handleWhiteboardSessionCancel() {
+ eventStream_->send(boost::make_shared<CancelWhiteboardSessionUIEvent>(toJID_));
+}
+
+void ChatController::handleWhiteboardWindowShow() {
+ eventStream_->send(boost::make_shared<ShowWhiteboardUIEvent>(toJID_));
+}
+
std::string ChatController::senderDisplayNameFromMessage(const JID& from) {
return nickResolver_->jidToNick(from);
}