[Telepathy-commits] [telepathy-qt4/master] Consider SelfHandleChanged for Connection::selfContact()

Olli Salli olli.salli at collabora.co.uk
Thu Feb 5 00:30:51 PST 2009


---
 TelepathyQt4/Client/connection.cpp |   14 +++++++++++++-
 TelepathyQt4/Client/connection.h   |    3 ++-
 TelepathyQt4/Client/contact.h      |    6 ++++++
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/TelepathyQt4/Client/connection.cpp b/TelepathyQt4/Client/connection.cpp
index 13e2758..513b9f5 100644
--- a/TelepathyQt4/Client/connection.cpp
+++ b/TelepathyQt4/Client/connection.cpp
@@ -998,7 +998,11 @@ void Connection::gotSelfContact(PendingOperation *op)
 
     if (pending->isValid()) {
         Q_ASSERT(pending->contacts().size() == 1);
-        mPriv->selfContact = pending->contacts()[0];
+        QSharedPointer<Contact> contact = pending->contacts()[0];
+        if (mPriv->selfContact != contact) {
+            mPriv->selfContact = contact;
+            emit selfContactChanged();
+        }
     } else {
         warning().nospace() << "Getting self contact failed with " <<
             pending->errorName() << ":" << pending->errorMessage();
@@ -1616,6 +1620,14 @@ void Connection::onSelfHandleChanged(uint handle)
 {
     mPriv->selfHandle = handle;
     emit selfHandleChanged(handle);
+
+    // FIXME: not ideal - when SelfContact is a feature, should check
+    // actualFeatures().contains(SelfContact) instead
+    // Also, when we figure out how the Renaming interface should work and how that should map to
+    // Contact objects, this might not need any special handling anymore.
+    if (interfaces().contains(TELEPATHY_INTERFACE_CONNECTION_INTERFACE_CONTACTS)) {
+        mPriv->introspectSelfContact();
+    }
 }
 
 }
diff --git a/TelepathyQt4/Client/connection.h b/TelepathyQt4/Client/connection.h
index 80d5845..0f857f0 100644
--- a/TelepathyQt4/Client/connection.h
+++ b/TelepathyQt4/Client/connection.h
@@ -175,7 +175,8 @@ public:
 Q_SIGNALS:
     void statusChanged(uint newStatus, uint newStatusReason);
     void selfHandleChanged(uint newHandle);
-    void selfPresenceChanged(const Telepathy::SimplePresence &newPresence);
+    // FIXME: might not need this when Renaming is fixed and mapped to Contacts
+    void selfContactChanged();
 
 protected:
     ConnectionInterface *baseInterface() const;
diff --git a/TelepathyQt4/Client/contact.h b/TelepathyQt4/Client/contact.h
index 8b99e35..f2abd00 100644
--- a/TelepathyQt4/Client/contact.h
+++ b/TelepathyQt4/Client/contact.h
@@ -75,6 +75,12 @@ Q_SIGNALS:
     void avatarTokenChanged(const QString &avatarToken);
     void simplePresenceChanged(const QString &status, uint type, const QString &presenceMessage);
 
+    // TODO: consider how the Renaming interface should work and map to Contacts
+    // I guess it would be something like:
+    // void renamedTo(QSharedPointer<Contact>)
+    // with that contact getting the same features requested as the current one. Or would we rather
+    // want to signal that change right away with a handle?
+
 private:
     Q_DISABLE_COPY(Contact);
 
-- 
1.5.6.5



More information about the telepathy-commits mailing list