diff options
Diffstat (limited to 'Swiften/Whiteboard/WhiteboardResponder.cpp')
-rw-r--r-- | Swiften/Whiteboard/WhiteboardResponder.cpp | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/Swiften/Whiteboard/WhiteboardResponder.cpp b/Swiften/Whiteboard/WhiteboardResponder.cpp index f72861f..f9df709 100644 --- a/Swiften/Whiteboard/WhiteboardResponder.cpp +++ b/Swiften/Whiteboard/WhiteboardResponder.cpp @@ -4,34 +4,41 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + #include <Swiften/Whiteboard/WhiteboardResponder.h> -#include <boost/smart_ptr/make_shared.hpp> -#include <Swiften/Whiteboard/WhiteboardSessionManager.h> +#include <memory> + +#include <Swiften/Queries/IQRouter.h> #include <Swiften/Whiteboard/IncomingWhiteboardSession.h> #include <Swiften/Whiteboard/WhiteboardSession.h> -#include <Swiften/Queries/IQRouter.h> +#include <Swiften/Whiteboard/WhiteboardSessionManager.h> namespace Swift { - WhiteboardResponder::WhiteboardResponder(WhiteboardSessionManager* sessionManager, IQRouter* router) : SetResponder<WhiteboardPayload>(router), sessionManager_(sessionManager), router_(router) { - } + WhiteboardResponder::WhiteboardResponder(WhiteboardSessionManager* sessionManager, IQRouter* router) : SetResponder<WhiteboardPayload>(router), sessionManager_(sessionManager), router_(router) { + } - bool WhiteboardResponder::handleSetRequest(const JID& from, const JID& /*to*/, const std::string& id, boost::shared_ptr<WhiteboardPayload> payload) { - if (payload->getType() == WhiteboardPayload::SessionRequest) { - if (sessionManager_->getSession(from)) { - sendError(from, id, ErrorPayload::Conflict, ErrorPayload::Cancel); - } else { - sendResponse(from, id, boost::shared_ptr<WhiteboardPayload>()); - IncomingWhiteboardSession::ref session = boost::make_shared<IncomingWhiteboardSession>(from, router_); - sessionManager_->handleIncomingSession(session); - } - } else { - sendResponse(from, id, boost::shared_ptr<WhiteboardPayload>()); - WhiteboardSession::ref session = sessionManager_->getSession(from); - if (session != NULL) { - session->handleIncomingAction(payload); - } - } - return true; - } + bool WhiteboardResponder::handleSetRequest(const JID& from, const JID& /*to*/, const std::string& id, std::shared_ptr<WhiteboardPayload> payload) { + if (payload->getType() == WhiteboardPayload::SessionRequest) { + if (sessionManager_->getSession(from)) { + sendError(from, id, ErrorPayload::Conflict, ErrorPayload::Cancel); + } else { + sendResponse(from, id, std::shared_ptr<WhiteboardPayload>()); + IncomingWhiteboardSession::ref session = std::make_shared<IncomingWhiteboardSession>(from, router_); + sessionManager_->handleIncomingSession(session); + } + } else { + sendResponse(from, id, std::shared_ptr<WhiteboardPayload>()); + WhiteboardSession::ref session = sessionManager_->getSession(from); + if (session != nullptr) { + session->handleIncomingAction(payload); + } + } + return true; + } } |