telepathy-qt: dbus-tubes: Add dbusTubes in {Contact, Connection}Capabilities
Dario Freddi
drf at kemper.freedesktop.org
Tue Jul 3 15:08:40 PDT 2012
Module: telepathy-qt
Branch: master
Commit: bbdcb504b9eb0ac8243b31e4f73f60644c71ff37
URL: http://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=bbdcb504b9eb0ac8243b31e4f73f60644c71ff37
Author: Dario Freddi <dario.freddi at collabora.co.uk>
Date: Thu Jun 9 16:55:29 2011 +0200
dbus-tubes: Add dbusTubes in {Contact,Connection}Capabilities
---
TelepathyQt/connection-capabilities.cpp | 16 ++++++++++++
TelepathyQt/connection-capabilities.h | 1 +
TelepathyQt/contact-capabilities.cpp | 41 +++++++++++++++++++++++++++++++
TelepathyQt/contact-capabilities.h | 3 ++
4 files changed, 61 insertions(+), 0 deletions(-)
diff --git a/TelepathyQt/connection-capabilities.cpp b/TelepathyQt/connection-capabilities.cpp
index 8c5416f..dda5910 100644
--- a/TelepathyQt/connection-capabilities.cpp
+++ b/TelepathyQt/connection-capabilities.cpp
@@ -261,6 +261,22 @@ bool ConnectionCapabilities::contactSearchesWithLimit() const
}
/**
+ * Return whether creating a DBusTube channel by providing a contact identifier is supported.
+ *
+ * \return \c true if supported, \c false otherwise.
+ */
+bool ConnectionCapabilities::dbusTubes() const
+{
+ RequestableChannelClassSpecList rccSpecs = allClassSpecs();
+ foreach (const RequestableChannelClassSpec &rccSpec, rccSpecs) {
+ if (rccSpec.supports(RequestableChannelClassSpec::dbusTube())) {
+ return true;
+ }
+ }
+ return false;
+}
+
+/**
* Return whether creating a StreamTube channel by providing a contact identifier is supported.
*
* \return \c true if supported, \c false otherwise.
diff --git a/TelepathyQt/connection-capabilities.h b/TelepathyQt/connection-capabilities.h
index 641c8c2..55e639f 100644
--- a/TelepathyQt/connection-capabilities.h
+++ b/TelepathyQt/connection-capabilities.h
@@ -54,6 +54,7 @@ public:
bool contactSearchesWithSpecificServer() const;
bool contactSearchesWithLimit() const;
+ bool dbusTubes() const;
bool streamTubes() const;
protected:
diff --git a/TelepathyQt/contact-capabilities.cpp b/TelepathyQt/contact-capabilities.cpp
index 7a59f25..4709d1c 100644
--- a/TelepathyQt/contact-capabilities.cpp
+++ b/TelepathyQt/contact-capabilities.cpp
@@ -84,6 +84,47 @@ ContactCapabilities::~ContactCapabilities()
}
/**
+ * Return whether creating a DBusTube channel, using the given \a serviceName, by providing a
+ * contact identifier is supported.
+ *
+ * \return \c true if supported, \c false otherwise.
+ */
+bool ContactCapabilities::dbusTubes(const QString &serviceName) const
+{
+ RequestableChannelClassSpec dbusTubeSpec = RequestableChannelClassSpec::dbusTube(serviceName);
+ RequestableChannelClassSpecList rccSpecs = allClassSpecs();
+ foreach (const RequestableChannelClassSpec &rccSpec, rccSpecs) {
+ if (rccSpec.supports(dbusTubeSpec)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+/**
+ * Return the supported DBusTube services.
+ *
+ * \return A list of supported DBusTube services.
+ */
+QStringList ContactCapabilities::dbusTubeServices() const
+{
+ QSet<QString> ret;
+
+ RequestableChannelClassSpecList rccSpecs = allClassSpecs();
+ foreach (const RequestableChannelClassSpec &rccSpec, rccSpecs) {
+ if (rccSpec.channelType() == TP_QT_IFACE_CHANNEL_TYPE_DBUS_TUBE &&
+ rccSpec.targetHandleType() == HandleTypeContact &&
+ rccSpec.hasFixedProperty(
+ TP_QT_IFACE_CHANNEL_TYPE_DBUS_TUBE + QLatin1String(".ServiceName"))) {
+ ret << rccSpec.fixedProperty(
+ TP_QT_IFACE_CHANNEL_TYPE_DBUS_TUBE + QLatin1String(".ServiceName")).toString();
+ }
+ }
+
+ return ret.toList();
+}
+
+/**
* Return whether creating a StreamTube channel, using the given \a service, by providing a
* contact identifier is supported.
*
diff --git a/TelepathyQt/contact-capabilities.h b/TelepathyQt/contact-capabilities.h
index 52de21e..d2c0f67 100644
--- a/TelepathyQt/contact-capabilities.h
+++ b/TelepathyQt/contact-capabilities.h
@@ -41,6 +41,9 @@ public:
ContactCapabilities();
virtual ~ContactCapabilities();
+ bool dbusTubes(const QString &serviceName) const;
+ QStringList dbusTubeServices() const;
+
bool streamTubes(const QString &service) const;
QStringList streamTubeServices() const;
More information about the telepathy-commits
mailing list