diff options
author | Mateusz Piekos <mateuszpiekos@gmail.com> | 2012-06-08 13:37:12 (GMT) |
---|---|---|
committer | Mateusz Piekos <mateuszpiekos@gmail.com> | 2012-06-08 13:37:12 (GMT) |
commit | 6e9fb4e4a3aeee8c40617a4dda6e5e0892ceebad (patch) | |
tree | fd2c0a48c6f5d033fe742790fb2e640d7e13ba91 /Swiften/Whiteboard/WhiteboardResponder.cpp | |
parent | 13ededd86bfb5dc5115af69d79810122313273b5 (diff) | |
download | swift-contrib-6e9fb4e4a3aeee8c40617a4dda6e5e0892ceebad.zip swift-contrib-6e9fb4e4a3aeee8c40617a4dda6e5e0892ceebad.tar.bz2 |
Added handling of whiteboard session requests
Diffstat (limited to 'Swiften/Whiteboard/WhiteboardResponder.cpp')
-rw-r--r-- | Swiften/Whiteboard/WhiteboardResponder.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/Swiften/Whiteboard/WhiteboardResponder.cpp b/Swiften/Whiteboard/WhiteboardResponder.cpp index 2e4905a..8a1b290 100644 --- a/Swiften/Whiteboard/WhiteboardResponder.cpp +++ b/Swiften/Whiteboard/WhiteboardResponder.cpp @@ -15,11 +15,28 @@ namespace Swift { } bool WhiteboardResponder::handleSetRequest(const JID& from, const JID& to, const std::string& id, boost::shared_ptr<WhiteboardPayload> payload) { - sendResponse(from, id, boost::shared_ptr<WhiteboardPayload>()); - WhiteboardSession* session = sessionManager_->getSession(from.toBare()); - if (session != NULL) { - session->handleIncomingAction(payload); + if (payload->getType() == WhiteboardPayload::SessionRequest) { + sessionManager_->onRequestReceived(from); + sessionRequests_[from] = id; + } else { + sendResponse(from, id, boost::shared_ptr<WhiteboardPayload>()); + WhiteboardSession* session = sessionManager_->getSession(from.toBare()); + if (session != NULL) { + session->handleIncomingAction(payload); + } } return true; } + + void WhiteboardResponder::sendRequestResponse(const JID& contact, bool accepted) { + if (sessionRequests_.find(contact) == sessionRequests_.end()) { + return; + } + if (accepted ) { + sendResponse(contact, sessionRequests_[contact], boost::shared_ptr<WhiteboardPayload>()); + } else { + sendError(contact, sessionRequests_[contact], ErrorPayload::Conflict, ErrorPayload::Cancel); + } + sessionRequests_.erase(contact); + } } |