summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Jingle/JingleResponder.cpp')
-rw-r--r--Swiften/Jingle/JingleResponder.cpp81
1 files changed, 40 insertions, 41 deletions
diff --git a/Swiften/Jingle/JingleResponder.cpp b/Swiften/Jingle/JingleResponder.cpp
index b0caa74..09bb234 100644
--- a/Swiften/Jingle/JingleResponder.cpp
+++ b/Swiften/Jingle/JingleResponder.cpp
@@ -1,17 +1,16 @@
/*
- * Copyright (c) 2011-2014 Isode Limited.
+ * Copyright (c) 2011-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <Swiften/Jingle/JingleResponder.h>
-#include <boost/smart_ptr/make_shared.hpp>
-
-#include <Swiften/Jingle/JingleSessionManager.h>
-#include <Swiften/Jingle/JingleSessionImpl.h>
+#include <memory>
#include <Swiften/Base/Log.h>
+#include <Swiften/Jingle/JingleSessionImpl.h>
+#include <Swiften/Jingle/JingleSessionManager.h>
namespace Swift {
@@ -21,42 +20,42 @@ JingleResponder::JingleResponder(JingleSessionManager* sessionManager, IQRouter*
JingleResponder::~JingleResponder() {
}
-bool JingleResponder::handleSetRequest(const JID& from, const JID& to, const std::string& id, boost::shared_ptr<JinglePayload> payload) {
- if (payload->getAction() == JinglePayload::SessionInitiate) {
- if (sessionManager->getSession(from, payload->getSessionID())) {
- // TODO: Add tie-break error
- sendError(from, id, ErrorPayload::Conflict, ErrorPayload::Cancel);
- }
- else {
- sendResponse(from, id, boost::shared_ptr<JinglePayload>());
- if (!payload->getInitiator().isBare()) {
- JingleSessionImpl::ref session = boost::make_shared<JingleSessionImpl>(payload->getInitiator(), from, payload->getSessionID(), router);
- sessionManager->handleIncomingSession(from, to, session, payload->getContents());
- } else {
- SWIFT_LOG(debug) << "Unable to create Jingle session due to initiator not being a full JID." << std::endl;
- }
- }
- }
- else {
- JingleSessionImpl::ref session;
- if (payload->getInitiator().isValid()) {
- SWIFT_LOG(debug) << "Lookup session by initiator." << std::endl;
- session = sessionManager->getSession(payload->getInitiator(), payload->getSessionID());
- } else {
- SWIFT_LOG(debug) << "Lookup session by from attribute." << std::endl;
- session = sessionManager->getSession(from, payload->getSessionID());
- }
- if (session) {
- session->handleIncomingAction(payload);
- sendResponse(from, id, boost::shared_ptr<JinglePayload>());
- }
- else {
- SWIFT_LOG(warning) << "Didn't find jingle session!";
- // TODO: Add jingle-specific error
- sendError(from, id, ErrorPayload::ItemNotFound, ErrorPayload::Cancel);
- }
- }
- return true;
+bool JingleResponder::handleSetRequest(const JID& from, const JID& to, const std::string& id, std::shared_ptr<JinglePayload> payload) {
+ if (payload->getAction() == JinglePayload::SessionInitiate) {
+ if (sessionManager->getSession(from, payload->getSessionID())) {
+ // TODO: Add tie-break error
+ sendError(from, id, ErrorPayload::Conflict, ErrorPayload::Cancel);
+ }
+ else {
+ sendResponse(from, id, std::shared_ptr<JinglePayload>());
+ if (!payload->getInitiator().isBare()) {
+ JingleSessionImpl::ref session = std::make_shared<JingleSessionImpl>(payload->getInitiator(), from, payload->getSessionID(), router);
+ sessionManager->handleIncomingSession(from, to, session, payload->getContents());
+ } else {
+ SWIFT_LOG(debug) << "Unable to create Jingle session due to initiator not being a full JID." << std::endl;
+ }
+ }
+ }
+ else {
+ JingleSessionImpl::ref session;
+ if (payload->getInitiator().isValid()) {
+ SWIFT_LOG(debug) << "Lookup session by initiator." << std::endl;
+ session = sessionManager->getSession(payload->getInitiator(), payload->getSessionID());
+ } else {
+ SWIFT_LOG(debug) << "Lookup session by from attribute." << std::endl;
+ session = sessionManager->getSession(from, payload->getSessionID());
+ }
+ if (session) {
+ session->handleIncomingAction(payload);
+ sendResponse(from, id, std::shared_ptr<JinglePayload>());
+ }
+ else {
+ SWIFT_LOG(warning) << "Didn't find jingle session!";
+ // TODO: Add jingle-specific error
+ sendError(from, id, ErrorPayload::ItemNotFound, ErrorPayload::Cancel);
+ }
+ }
+ return true;
}
}