[Telepathy-commits] [telepathy-qt4/master] Connection: Added getter for PendingChannel::yours.

Andre Moreira Magalhaes (andrunko) andre.magalhaes at collabora.co.uk
Mon Jan 26 12:19:21 PST 2009


---
 TelepathyQt4/Client/pending-channel.cpp |   21 +++++++++++++++++++++
 TelepathyQt4/Client/pending-channel.h   |    2 ++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/TelepathyQt4/Client/pending-channel.cpp b/TelepathyQt4/Client/pending-channel.cpp
index 457d9a0..9aa7370 100644
--- a/TelepathyQt4/Client/pending-channel.cpp
+++ b/TelepathyQt4/Client/pending-channel.cpp
@@ -46,6 +46,7 @@ namespace Client
 
 struct PendingChannel::Private
 {
+    bool yours;
     QString channelType;
     uint handleType;
     uint handle;
@@ -74,6 +75,7 @@ PendingChannel::PendingChannel(Connection *connection, const QString &errorName,
     : PendingOperation(connection),
       mPriv(new Private)
 {
+    mPriv->yours = false;
     mPriv->handleType = 0;
     mPriv->handle = 0;
 
@@ -92,6 +94,7 @@ PendingChannel::PendingChannel(Connection *connection,
     : PendingOperation(connection),
       mPriv(new Private)
 {
+    mPriv->yours = create;
     mPriv->channelType = request.value(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".ChannelType")).toString();
     mPriv->handleType = request.value(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetHandleType")).toUInt();
     mPriv->handle = request.value(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetHandle")).toUInt();
@@ -131,6 +134,22 @@ Connection *PendingChannel::connection() const
 }
 
 /**
+ * Return whether this channel belongs to this process.
+ *
+ * If false, the caller MUST assume that some other process is
+ * handling this channel; if true, the caller SHOULD handle it
+ * themselves or delegate it to another client.
+ *
+ * Note that the value may change when the operation finishes.
+ *
+ * \return Boolean indicating whether this channel belongs to this process.
+ */
+bool PendingChannel::yours() const
+{
+    return mPriv->yours;
+}
+
+/**
  * Return the channel type specified in the channel request.
  *
  * \return The D-Bus interface name of the interface specific to the
@@ -216,6 +235,8 @@ void PendingChannel::onCallEnsureChannelFinished(QDBusPendingCallWatcher *watche
     QDBusPendingReply<bool, QDBusObjectPath, QVariantMap> reply = *watcher;
 
     if (!reply.isError()) {
+        mPriv->yours = reply.argumentAt<0>();
+
         mPriv->objectPath = reply.argumentAt<1>();
         debug() << "Got reply to Connection.EnsureChannel - object path:" <<
             mPriv->objectPath.path();
diff --git a/TelepathyQt4/Client/pending-channel.h b/TelepathyQt4/Client/pending-channel.h
index e251bc7..c5d184f 100644
--- a/TelepathyQt4/Client/pending-channel.h
+++ b/TelepathyQt4/Client/pending-channel.h
@@ -48,6 +48,8 @@ public:
 
     Connection *connection() const;
 
+    bool yours() const;
+
     const QString &channelType() const;
 
     uint handleType() const;
-- 
1.5.6.5




More information about the Telepathy-commits mailing list