blob: 568bed89b7725e036bf968b1f23a38594b518b39 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/*
* Copyright (c) 2012 Mateusz Piękos
* Licensed under the simplified BSD license.
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
#include <Swiften/Whiteboard/IncomingWhiteboardSession.h>
#include <Swiften/Elements/WhiteboardPayload.h>
namespace Swift {
IncomingWhiteboardSession::IncomingWhiteboardSession(const JID& jid, IQRouter* router) : WhiteboardSession(jid, router) {
}
IncomingWhiteboardSession::~IncomingWhiteboardSession() {
}
void IncomingWhiteboardSession::accept() {
boost::shared_ptr<WhiteboardPayload> payload = boost::make_shared<WhiteboardPayload>(WhiteboardPayload::SessionAccept);
boost::shared_ptr<GenericRequest<WhiteboardPayload> > request = boost::make_shared<GenericRequest<WhiteboardPayload> >(IQ::Set, toJID_, payload, router_);
request->send();
}
std::string IncomingWhiteboardSession::getClientID() const {
return "b";
}
void IncomingWhiteboardSession::handleIncomingOperation(WhiteboardOperation::ref operation) {
// std::cout << "incoming pos: " << operation->getPos() << std::endl;
// WhiteboardInsertOperation::ref insertOp = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(operation);
WhiteboardOperation::ref op = server.handleClientOperationReceived(operation);
//std::cout << "in1: " << operation->getID() << " " << operation->getPos() << " " << operation->getParentID() << std::endl;
//std::cout << "in2: " << op->getID() << " " << op->getPos() << " " << op->getParentID() << std::endl;
onOperationReceived(op);
WhiteboardPayload::ref payload = boost::make_shared<WhiteboardPayload>();
payload->setOperation(op);
sendPayload(payload);
}
void IncomingWhiteboardSession::sendOperation(WhiteboardOperation::ref operation) {
//std::cout << "out: " << operation->getID() << " " << operation->getPos() << " " << operation->getParentID()<< std::endl;
server.handleLocalOperationReceived(operation);
WhiteboardPayload::ref payload = boost::make_shared<WhiteboardPayload>();
payload->setOperation(operation);
sendPayload(payload);
}
}
|