telepathy-qt: dbus-tubes: Move the instrospection of DBusNames to the correct feature.

Dario Freddi drf at kemper.freedesktop.org
Tue Jul 3 15:08:41 PDT 2012


Module: telepathy-qt
Branch: master
Commit: 0cec6fcd0cb272da9ebe76df167767adb3d1bd07
URL:    http://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=0cec6fcd0cb272da9ebe76df167767adb3d1bd07

Author: Dario Freddi <dario.freddi at collabora.co.uk>
Date:   Tue Jun 14 15:22:33 2011 +0200

dbus-tubes: Move the instrospection of DBusNames to the correct feature.

---

 TelepathyQt/dbus-tube-channel.cpp |   20 ++++++++++++++++++--
 TelepathyQt/dbus-tube-channel.h   |    1 +
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/TelepathyQt/dbus-tube-channel.cpp b/TelepathyQt/dbus-tube-channel.cpp
index 952c871..dd52c37 100644
--- a/TelepathyQt/dbus-tube-channel.cpp
+++ b/TelepathyQt/dbus-tube-channel.cpp
@@ -27,6 +27,7 @@
 
 #include <TelepathyQt/Connection>
 #include <TelepathyQt/ContactManager>
+#include <TelepathyQt/PendingVariant>
 
 namespace Tp
 {
@@ -95,7 +96,6 @@ void DBusTubeChannel::Private::extractProperties(const QVariantMap &props)
 {
     serviceName = qdbus_cast<QString>(props[QLatin1String("Service")]);
     accessControls = qdbus_cast<UIntList>(props[QLatin1String("SupportedAccessControls")]);
-    extractParticipants(qdbus_cast<DBusTubeParticipants>(props[QLatin1String("DBusNames")]));
 }
 
 void DBusTubeChannel::Private::extractParticipants(const Tp::DBusTubeParticipants &participants)
@@ -127,7 +127,9 @@ void DBusTubeChannel::Private::introspectBusNamesMonitoring(DBusTubeChannel::Pri
         debug() << "FeatureBusNameMonitoring does not make sense in a P2P context";
     }
 
-    self->readinessHelper->setIntrospectCompleted(DBusTubeChannel::FeatureBusNameMonitoring, true);
+    // Request the current DBusNames property
+    connect(dbusTubeInterface->requestPropertyDBusNames(), SIGNAL(finished(Tp::PendingOperation*)),
+            parent, SLOT(onRequestPropertyDBusNamesFinished(Tp::PendingOperation*)));
 }
 
 void DBusTubeChannel::Private::introspectDBusTube(DBusTubeChannel::Private *self)
@@ -348,6 +350,20 @@ void DBusTubeChannel::gotDBusTubeProperties(QDBusPendingCallWatcher *watcher)
     }
 }
 
+void DBusTubeChannel::onRequestPropertyDBusNamesFinished(PendingOperation *op)
+{
+    if (!op->isError()) {
+        debug() << "RequestPropertyDBusNames succeeded";
+        PendingVariant *result = qobject_cast<PendingVariant*>(op);
+        mPriv->extractParticipants(qdbus_cast<DBusTubeParticipants>(result->result()));
+        mPriv->readinessHelper->setIntrospectCompleted(DBusTubeChannel::FeatureBusNameMonitoring, true);
+    } else {
+        warning().nospace() << "RequestPropertyDBusNames failed "
+            "with " << op->errorName() << ": " << op->errorMessage();
+        mPriv->readinessHelper->setIntrospectCompleted(DBusTubeChannel::FeatureBusNameMonitoring, false);
+    }
+}
+
 void DBusTubeChannel::onDBusNamesChanged(const Tp::DBusTubeParticipants &added,
         const Tp::UIntList &removed)
 {
diff --git a/TelepathyQt/dbus-tube-channel.h b/TelepathyQt/dbus-tube-channel.h
index 4f4cfbd..c87e688 100644
--- a/TelepathyQt/dbus-tube-channel.h
+++ b/TelepathyQt/dbus-tube-channel.h
@@ -65,6 +65,7 @@ Q_SIGNALS:
 
 private Q_SLOTS:
     TP_QT_NO_EXPORT void gotDBusTubeProperties(QDBusPendingCallWatcher *watcher);
+    TP_QT_NO_EXPORT void onRequestPropertyDBusNamesFinished(Tp::PendingOperation *op);
     TP_QT_NO_EXPORT void onDBusNamesChanged(const Tp::DBusTubeParticipants &added, const Tp::UIntList &removed);
     TP_QT_NO_EXPORT void onContactsRetrieved(const QUuid &uuid, const QList<Tp::ContactPtr> &contacts);
 



More information about the telepathy-commits mailing list