Hello everyone,

I have been playing with Tp::AbstractClientApprover and 
Tp::ChannelDispatchOperation this weekend in order to implement an approver 
for my gsoc project (kcall) and I have found some bugs in the implementation 
of those classes in TelepathyQt4. I am attaching some patches to fix them:

Patch 0001 adds a finished() signal in ChannelDispatchOperation in order to 
compy with the specification (I needed to use this signal, so I added it).

Patch 0002 makes ClientApproverAdaptor use the full name of the Connection 
property ("org.freedesktop.Telepathy.ChannelDispatchOperation.Connection") to 
read the Connection object path from the properties that are passed to its 
AddDispatchOperation method, in order to compy with the spec. Before I fix 
that, it would crash a while after the channel dispatcher had called this 
method, because the Connection object was assumed to be valid, although it 
wasn't.

Patch 0003 makes ChannelDispatchOperation read the "Channels" property from 
the remote ChannelDispatchOperation object instead of reading 
"ChannelDetailsLIst", which doesn't exist. This didn't crash before, but the 
channels() method of ChannelDispatchOperation would return an empty list, 
which is wrong.

Best regards,
George

From 4c8196758227e07c2f4c7307433fc57accd3ed33 Mon Sep 17 00:00:00 2001
From: George Kiagiadakis <[email protected]>
Date: Mon, 15 Jun 2009 17:17:57 +0300
Subject: [PATCH 2/3] ClientApproverAdaptor: Use the dbus qualified name to get the connection property.

Previously this didn't follow the specification and it would crash if used with
mission-control as a channel dispatcher, because mission-control correctly uses
"org.freedesktop.Telepathy.ChannelDispatchOperation.Connection" as the property name
and not just "Connection", which resulted in an invalid Connection object being created.
---
 TelepathyQt4/client-registrar.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/TelepathyQt4/client-registrar.cpp b/TelepathyQt4/client-registrar.cpp
index 9ff3603..1eb9e15 100644
--- a/TelepathyQt4/client-registrar.cpp
+++ b/TelepathyQt4/client-registrar.cpp
@@ -171,7 +171,7 @@ void ClientApproverAdaptor::AddDispatchOperation(const Tp::ChannelDetailsList &c
         const QDBusMessage &message)
 {
     QDBusObjectPath connectionPath = qdbus_cast<QDBusObjectPath>(
-            properties.value("Connection"));
+            properties.value(TELEPATHY_INTERFACE_CHANNEL_DISPATCH_OPERATION ".Connection"));
     debug() << "addDispatchOperation: connection:" << connectionPath.path();
     QString connectionBusName = connectionPath.path().mid(1).replace('/', '.');
     ConnectionPtr connection = Connection::create(mBus, connectionBusName,
-- 
1.6.3.1

From b2084428dba8f6aad6020c9dafb626a368a2f847 Mon Sep 17 00:00:00 2001
From: George Kiagiadakis <[email protected]>
Date: Mon, 15 Jun 2009 11:50:38 +0300
Subject: [PATCH 1/3] ChannelDispatchOperation: Add finished() signal.

---
 TelepathyQt4/channel-dispatch-operation.cpp |    1 +
 TelepathyQt4/channel-dispatch-operation.h   |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/TelepathyQt4/channel-dispatch-operation.cpp b/TelepathyQt4/channel-dispatch-operation.cpp
index b46ad28..cf62651 100644
--- a/TelepathyQt4/channel-dispatch-operation.cpp
+++ b/TelepathyQt4/channel-dispatch-operation.cpp
@@ -124,6 +124,7 @@ void ChannelDispatchOperation::Private::introspectMain(ChannelDispatchOperation:
     self->parent->connect(self->baseInterface,
             SIGNAL(ChannelLost(const QDBusObjectPath &, const QString &, const QString &)),
             SLOT(onChannelLost(const QDBusObjectPath &, const QString &, const QString &)));
+    self->parent->connect(self->baseInterface, SIGNAL(Finished()), self->parent, SIGNAL(finished()));
 
     debug() << "Calling Properties::GetAll(ChannelDispatchOperation)";
     QDBusPendingCallWatcher *watcher =
diff --git a/TelepathyQt4/channel-dispatch-operation.h b/TelepathyQt4/channel-dispatch-operation.h
index f3544ac..2927607 100644
--- a/TelepathyQt4/channel-dispatch-operation.h
+++ b/TelepathyQt4/channel-dispatch-operation.h
@@ -100,6 +100,7 @@ public:
 Q_SIGNALS:
     void channelLost(const ChannelPtr &channel, const QString &errorName,
             const QString &errorMessage);
+    void finished();
 
 protected:
     ChannelDispatchOperation(const QDBusConnection &bus,
-- 
1.6.3.1

From b7933ab25c252e6a742d2da820fbf891e9ccf988 Mon Sep 17 00:00:00 2001
From: George Kiagiadakis <[email protected]>
Date: Mon, 15 Jun 2009 17:18:48 +0300
Subject: [PATCH 3/3] ChannelDispatchOperation: Read the "Channels" property instead of the inexistent "ChannelDetailsList".

---
 TelepathyQt4/channel-dispatch-operation.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/TelepathyQt4/channel-dispatch-operation.cpp b/TelepathyQt4/channel-dispatch-operation.cpp
index cf62651..4093659 100644
--- a/TelepathyQt4/channel-dispatch-operation.cpp
+++ b/TelepathyQt4/channel-dispatch-operation.cpp
@@ -161,7 +161,7 @@ void ChannelDispatchOperation::Private::extractMainProps(const QVariantMap &prop
 
     if (!immutableProperties) {
         ChannelDetailsList channelDetailsList =
-            qdbus_cast<ChannelDetailsList>(props.value("ChannelDetailsList"));
+            qdbus_cast<ChannelDetailsList>(props.value("Channels"));
         ChannelPtr channel;
         foreach (const ChannelDetails &channelDetails, channelDetailsList) {
             channel = ChannelFactory::create(connection,
-- 
1.6.3.1

_______________________________________________
telepathy mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/telepathy

Reply via email to