[Telepathy-commits] [telepathy-qt4/master] Channel: Added requested getter.

Andre Moreira Magalhaes (andrunko) andre.magalhaes at collabora.co.uk
Mon Feb 9 11:17:50 PST 2009


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

diff --git a/TelepathyQt4/Client/channel.cpp b/TelepathyQt4/Client/channel.cpp
index c3e2d5f..dc253ed 100644
--- a/TelepathyQt4/Client/channel.cpp
+++ b/TelepathyQt4/Client/channel.cpp
@@ -120,6 +120,7 @@ struct Channel::Private
     QString channelType;
     uint targetHandleType;
     uint targetHandle;
+    bool requested;
 
     // Group flags
     uint groupFlags;
@@ -205,6 +206,7 @@ Channel::Private::Private(Channel *parent, Connection *connection)
       features(0),
       targetHandleType(0),
       targetHandle(0),
+      requested(false),
       groupFlags(0),
       groupHaveMembers(false),
       buildingInitialContacts(false),
@@ -412,6 +414,7 @@ void Channel::Private::extract0177MainProps(const QVariantMap &props)
         interfaces = qdbus_cast<QStringList>(props["Interfaces"]);
         targetHandle = qdbus_cast<uint>(props["TargetHandle"]);
         targetHandleType = qdbus_cast<uint>(props["TargetHandleType"]);
+        requested = qdbus_cast<uint>(props["Requested"]);
 
         nowHaveInterfaces();
     }
@@ -900,6 +903,24 @@ uint Channel::targetHandle() const
 }
 
 /**
+ * Return whether this channel was created in response to a
+ * local request.
+ *
+ * Note that the value is undefined until the channel is ready.
+ *
+ * \return \c true if this channel was created in response to a local request,
+ *         \c false otherwise.
+ */
+bool Channel::requested() const
+{
+    if (!isReady()) {
+        warning() << "Channel::requested() used channel not ready";
+    }
+
+    return mPriv->requested;
+}
+
+/**
  * Return whether this object has finished its initial setup.
  *
  * This is mostly useful as a sanity check, in code that shouldn't be run
diff --git a/TelepathyQt4/Client/channel.h b/TelepathyQt4/Client/channel.h
index a60e410..0e50fae 100644
--- a/TelepathyQt4/Client/channel.h
+++ b/TelepathyQt4/Client/channel.h
@@ -73,6 +73,8 @@ public:
 
     uint targetHandle() const;
 
+    bool requested() const;
+
     bool isReady(Features features = 0) const;
 
     PendingOperation *becomeReady(Features features = 0);
-- 
1.5.6.5




More information about the telepathy-commits mailing list