diff options
Diffstat (limited to 'Swiften/Whiteboard/OutgoingWhiteboardSession.cpp')
-rw-r--r-- | Swiften/Whiteboard/OutgoingWhiteboardSession.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp b/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp index f0b6d22..da4d3cf 100644 --- a/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp +++ b/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp @@ -33,4 +33,33 @@ namespace Swift { onRequestRejected(toJID_); } } + + void OutgoingWhiteboardSession::handleIncomingOperation(WhiteboardOperation::ref operation) { +// std::cout << "incoming pos: " << operation->getPos() << std::endl; + WhiteboardClient::Result pairResult = client.handleServerOperationReceived(operation); + if (pairResult.client) { + onOperationReceived(pairResult.client); + //std::cout << "in1: " << operation->getID() << " " << operation->getPos() << " " << operation->getParentID() << std::endl; + //std::cout << "in2: " << pairResult.client->getID() << " " << pairResult.client->getPos() << " " << pairResult.client->getParentID() << std::endl; + } + + if (pairResult.server) { + //std::cout << "outts: " << pairResult.server->getID() << " " << pairResult.server->getPos() << std::endl; + WhiteboardPayload::ref payload = boost::make_shared<WhiteboardPayload>(); + payload->setOperation(pairResult.server); + sendPayload(payload); + } + } + + void OutgoingWhiteboardSession::handleSendOperationRequest(WhiteboardOperation::ref operation) { + //std::cout << "out1: " << operation->getID() << " " << operation->getPos() << " " << operation->getParentID() << std::endl; + WhiteboardOperation::ref result = client.handleLocalOperationReceived(operation); + + if (result) { + //std::cout << "out2: " << result->getID() << " " << result->getPos()<< " " << result->getParentID()<< std::endl; + WhiteboardPayload::ref payload = boost::make_shared<WhiteboardPayload>(); + payload->setOperation(result); + sendPayload(payload); + } + } } |