blob: 89fb00d52fc5cab6749c0d65b68e8bb302f55b54 (
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
|
/*
* Copyright (c) 2012 Mateusz Piękos
* Licensed under the simplified BSD license.
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
#include <Swiften/Whiteboard/WhiteboardServer.h>
#include <Swiften/Whiteboard/WhiteboardTransformer.h>
namespace Swift {
void WhiteboardServer::handleLocalOperationReceived(WhiteboardOperation::ref operation) {
operations_.push_back(operation);
}
WhiteboardOperation::ref WhiteboardServer::handleClientOperationReceived(WhiteboardInsertOperation::ref operation) {
std::list<WhiteboardOperation::ref>::iterator it;
for (it = operations_.begin(); it != operations_.end(); ++it) {
if (operation->getParentID() == (*it)->getParentID()) {
WhiteboardInsertOperation::ref insertOperation = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(*it);
if (insertOperation) {
std::pair<WhiteboardInsertOperation::ref, WhiteboardInsertOperation::ref> tResult = WhiteboardTransformer::transform(operation, insertOperation);
operations_.push_back(tResult.second);
return tResult.second;
}
else {
operations_.push_back(*it);
return *it;
}
}
}
}
}
|