blob: a9ed10ab04a317b9086ab64d19520786d4715749 (
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/*
* Copyright (c) 2010-2013 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#pragma once
#include <Swiften/Base/API.h>
#include <Swiften/Elements/CapsInfo.h>
#include <Swiften/Elements/DiscoInfo.h>
#include <Swiften/Presence/PayloadAddingPresenceSender.h>
namespace Swift {
class IQRouter;
class DiscoInfoResponder;
class PayloadAddingPresenceSender;
class PresenceSender;
class CryptoProvider;
/**
* Class responsible for managing outgoing disco information for a client.
*
* The manager will respond to disco#info requests, and add entity capabilities information
* to outgoing presence.
*
* To use this class, call setCapsNode() once with the caps URI of the client. After this,
* call setDiscoInfo() with the capabilities for the client. This can be
* called whenever the capabilities change.
*/
class SWIFTEN_API ClientDiscoManager {
public:
/**
* Constructs the manager
*
* \param iqRouter the router on which requests will be answered
* \param presenceSender the presence sender to which all outgoing presence
* (with caps information) will be sent.
*/
ClientDiscoManager(IQRouter* iqRouter, PresenceSender* presenceSender, CryptoProvider* crypto);
~ClientDiscoManager();
/**
* Needs to be called before calling setDiscoInfo().
*/
void setCapsNode(const std::string& node);
/**
* Sets the capabilities of the client.
*/
void setDiscoInfo(const DiscoInfo& info);
/**
* Returns the presence sender through which all outgoing presence
* should be sent.
* The manager will add the necessary caps information, and forward it to
* the presence sender passed at construction time.
*/
PresenceSender* getPresenceSender() const {
return presenceSender;
}
/**
* Called when the client is connected.
* This resets the presence sender, such that it assumes initial presence
* hasn't been sent yet.
*/
void handleConnected();
private:
PayloadAddingPresenceSender* presenceSender;
CryptoProvider* crypto;
DiscoInfoResponder* discoInfoResponder;
std::string capsNode;
CapsInfo::ref capsInfo;
};
}
|