summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-10-23 21:08:19 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-11-03 12:17:40 (GMT)
commit9d9fb66aefef85a1c5ad432391014d15011747d1 (patch)
tree55b1ebe7dcb0108008a28ebf8fee773b27e60547 /Swiften/Disco/ClientDiscoManager.h
parentd509598b0f0edf5e103caedbab8662edc834445e (diff)
downloadswift-9d9fb66aefef85a1c5ad432391014d15011747d1.zip
swift-9d9fb66aefef85a1c5ad432391014d15011747d1.tar.bz2
Added ClientDiscoManager.
Diffstat (limited to 'Swiften/Disco/ClientDiscoManager.h')
-rw-r--r--Swiften/Disco/ClientDiscoManager.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/Swiften/Disco/ClientDiscoManager.h b/Swiften/Disco/ClientDiscoManager.h
new file mode 100644
index 0000000..b997374
--- /dev/null
+++ b/Swiften/Disco/ClientDiscoManager.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#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 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 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);
+ ~ClientDiscoManager();
+
+ /**
+ * Needs to be called before calling setDiscoInfo().
+ */
+ void setCapsNode(const 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;
+ }
+
+ private:
+ PayloadAddingPresenceSender* presenceSender;
+ DiscoInfoResponder* discoInfoResponder;
+ String capsNode;
+ CapsInfo::ref capsInfo;
+ };
+}