summaryrefslogtreecommitdiffstats
blob: 7706c0a130876563ad2fdaabc5e32fb1b02fb3a3 (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
33
34
35
36
37
38
39
40
41
42
43
44
/*
 * Copyright (c) 2012 Yoann Blein
 * Licensed under the simplified BSD license.
 * See Documentation/Licenses/BSD-simplified.txt for more information.
 */

#include <Swiften/ScreenSharing/IncomingScreenSharingManager.h>

#include <Swiften/Elements/JingleRTPDescription.h>
#include <Swiften/ScreenSharing/IncomingScreenSharing.h>
#include <Swiften/Jingle/Jingle.h>
#include <Swiften/Jingle/JingleSessionManager.h>

#include <boost/make_shared.hpp>

namespace Swift {

IncomingScreenSharingManager::IncomingScreenSharingManager(JingleSessionManager* jingleSessionManager, IQRouter* router, UDPSocketFactory* udpSocketFactory)
	: jingleSessionManager(jingleSessionManager), router(router), udpSocketFactory(udpSocketFactory)
{
	jingleSessionManager->addIncomingSessionHandler(this);
}

IncomingScreenSharingManager::~IncomingScreenSharingManager()
{
	jingleSessionManager->removeIncomingSessionHandler(this);
}

bool IncomingScreenSharingManager::handleIncomingJingleSession(Swift::JingleSession::ref session, const std::vector<JingleContentPayload::ref>& contents, const Swift::JID& /*recipient*/)
{
	JingleContentPayload::ref content = Jingle::getContentWithDescription<JingleRTPDescription>(contents);
	if (!content)
		return false;

	// Check transport
	// Check description
	// Create IncomingScreenSharing

	onIncomingScreenSharing(boost::make_shared<IncomingScreenSharing>(session, udpSocketFactory, content));

	return true;
}

}