diff options
author | Mateusz Piekos <mateuszpiekos@gmail.com> | 2012-08-06 06:17:00 (GMT) |
---|---|---|
committer | Mateusz Piekos <mateuszpiekos@gmail.com> | 2012-08-06 06:17:00 (GMT) |
commit | 7709b172620653a15f7358186914d1a2b8a5e9be (patch) | |
tree | 6d6be9df9027d6d69377c000cdba4d6938562a0b /Swiften | |
parent | 6f300f03ed9a61b56dc69dab327869dd7ba4ff10 (diff) | |
download | swift-contrib-7709b172620653a15f7358186914d1a2b8a5e9be.zip swift-contrib-7709b172620653a15f7358186914d1a2b8a5e9be.tar.bz2 |
Moved handling of operation IDs to session classes
Diffstat (limited to 'Swiften')
-rw-r--r-- | Swiften/Whiteboard/IncomingWhiteboardSession.cpp | 5 | ||||
-rw-r--r-- | Swiften/Whiteboard/OutgoingWhiteboardSession.cpp | 5 | ||||
-rw-r--r-- | Swiften/Whiteboard/WhiteboardSession.h | 3 |
3 files changed, 13 insertions, 0 deletions
diff --git a/Swiften/Whiteboard/IncomingWhiteboardSession.cpp b/Swiften/Whiteboard/IncomingWhiteboardSession.cpp index 1904457..d3580e1 100644 --- a/Swiften/Whiteboard/IncomingWhiteboardSession.cpp +++ b/Swiften/Whiteboard/IncomingWhiteboardSession.cpp @@ -32,6 +32,7 @@ namespace Swift { WhiteboardClient::Result pairResult = client.handleServerOperationReceived(operation); if (pairResult.client) { onOperationReceived(pairResult.client); + lastOpID = pairResult.client->getID(); } if (pairResult.server) { @@ -42,6 +43,10 @@ namespace Swift { } void IncomingWhiteboardSession::sendOperation(WhiteboardOperation::ref operation) { + operation->setID(getClientID()+idGenerator.generateID()); + operation->setParentID(lastOpID); + lastOpID = operation->getID(); + WhiteboardOperation::ref result = client.handleLocalOperationReceived(operation); if (result) { diff --git a/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp b/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp index c527942..63e4476 100644 --- a/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp +++ b/Swiften/Whiteboard/OutgoingWhiteboardSession.cpp @@ -42,6 +42,7 @@ namespace Swift { WhiteboardOperation::ref op = server.handleClientOperationReceived(operation); onOperationReceived(op); + lastOpID = op->getID(); WhiteboardPayload::ref payload = boost::make_shared<WhiteboardPayload>(); payload->setOperation(op); @@ -49,6 +50,10 @@ namespace Swift { } void OutgoingWhiteboardSession::sendOperation(WhiteboardOperation::ref operation) { + operation->setID(getClientID()+idGenerator.generateID()); + operation->setParentID(lastOpID); + lastOpID = operation->getID(); + server.handleLocalOperationReceived(operation); WhiteboardPayload::ref payload = boost::make_shared<WhiteboardPayload>(); payload->setOperation(operation); diff --git a/Swiften/Whiteboard/WhiteboardSession.h b/Swiften/Whiteboard/WhiteboardSession.h index 1eb76a4..abfdd32 100644 --- a/Swiften/Whiteboard/WhiteboardSession.h +++ b/Swiften/Whiteboard/WhiteboardSession.h @@ -10,6 +10,7 @@ #include <Swiften/JID/JID.h> #include <Swiften/Base/boost_bsignals.h> +#include <Swiften/Base/SimpleIDGenerator.h> #include <Swiften/Queries/GenericRequest.h> #include <Swiften/Whiteboard/Elements/WhiteboardElement.h> #include <Swiften/Whiteboard/Operations/WhiteboardOperation.h> @@ -50,5 +51,7 @@ namespace Swift { JID toJID_; IQRouter* router_; + std::string lastOpID; + SimpleIDGenerator idGenerator; }; } |