[Telepathy-commits] [telepathy-qt4/master] Expose group self handle

Olli Salli olli.salli at collabora.co.uk
Mon Oct 20 09:13:37 PDT 2008


---
 TelepathyQt4/cli-channel.cpp |   18 ++++++++++++++++--
 TelepathyQt4/cli-channel.h   |   28 ++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/TelepathyQt4/cli-channel.cpp b/TelepathyQt4/cli-channel.cpp
index 47c9d56..f0a47f2 100644
--- a/TelepathyQt4/cli-channel.cpp
+++ b/TelepathyQt4/cli-channel.cpp
@@ -387,6 +387,16 @@ HandleOwnerMap Channel::groupHandleOwners() const
     return mPriv->groupHandleOwners;
 }
 
+bool Channel::groupIsSelfHandleTracked() const
+{
+    return mPriv->groupIsSelfHandleTracked;
+}
+
+uint Channel::groupSelfHandle() const
+{
+    return mPriv->groupSelfHandle;
+}
+
 void Channel::gotMainProperties(QDBusPendingCallWatcher* watcher)
 {
     QDBusPendingReply<QVariantMap> reply = *watcher;
@@ -762,9 +772,13 @@ void Channel::onHandleOwnersChanged(const Telepathy::HandleOwnerMap& added, cons
 
 void Channel::onSelfHandleChanged(uint newSelfHandle)
 {
-    debug().nospace() << "Got Channel.Interface.Group::SelfHandleChanged(" << newSelfHandle << ")";
+    debug().nospace() << "Got Channel.Interface.Group::SelfHandleChanged";
 
-    mPriv->groupSelfHandle = newSelfHandle;
+    if (newSelfHandle != mPriv->groupSelfHandle) {
+        mPriv->groupSelfHandle = newSelfHandle;
+        debug() << " Emitting groupSelfHandleChanged with new self handle" << newSelfHandle;
+        emit groupSelfHandleChanged(newSelfHandle);
+    }
 }
 
 }
diff --git a/TelepathyQt4/cli-channel.h b/TelepathyQt4/cli-channel.h
index 5beec47..dbfb905 100644
--- a/TelepathyQt4/cli-channel.h
+++ b/TelepathyQt4/cli-channel.h
@@ -367,6 +367,26 @@ public:
      */
     HandleOwnerMap groupHandleOwners() const;
 
+    /**
+     * Returns whether the value returned by groupSelfHandle() is guaranteed to
+     * stay synchronized with what groupInterface()->GetSelfHandle() would
+     * return. Older services not providing group properties don't necessarily
+     * emit the SelfHandleChanged signal either, so self handle changes can't be
+     * reliably tracked.
+     *
+     * \return Whether or not changes to the self handle are tracked.
+     */
+    bool groupIsSelfHandleTracked() const;
+
+    /**
+     * Returns a handle representing the user in the group if the user is a
+     * member of the group, otherwise either a handle representing the user or
+     * 0.
+     *
+     * \return A contact handle representing the user, if possible.
+     */
+    uint groupSelfHandle() const;
+
 Q_SIGNALS:
 
     /**
@@ -440,6 +460,14 @@ Q_SIGNALS:
     void groupHandleOwnersChanged(const HandleOwnerMap& owners, const Telepathy::UIntList& added, const Telepathy::UIntList& removed);
 
     /**
+     * Emitted when the value returned by groupSelfHandle() changes.
+     *
+     * \param selfHandle The value which would now be returned by
+     *                   groupSelfHandle().
+     */
+    void groupSelfHandleChanged(uint selfHandle);
+
+    /**
      * \name Optional interface proxy factory
      *
      * Factory functions fabricating proxies for optional %Channel interfaces and
-- 
1.5.6.5




More information about the Telepathy-commits mailing list