[telepathy-qt4/master] Channel: Handle MembersChanged for reason Renamed when renaming "myself".

Andre Moreira Magalhaes (andrunko) andre.magalhaes at collabora.co.uk
Mon Jul 27 08:21:33 PDT 2009


---
 TelepathyQt4/channel.cpp |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/TelepathyQt4/channel.cpp b/TelepathyQt4/channel.cpp
index 0e21b04..ee4e8b2 100644
--- a/TelepathyQt4/channel.cpp
+++ b/TelepathyQt4/channel.cpp
@@ -2432,6 +2432,27 @@ void Channel::onMembersChangedDetailed(
     // to build the contacts in case self contact is removed,
     // as Closed will be emitted right after
     if (removed.contains(mPriv->groupSelfHandle)) {
+        if (qdbus_cast<uint>(details.value("change-reason")) == ChannelGroupChangeReasonRenamed) {
+            if (removed.size() != 1 ||
+                (added.size() + localPending.size() + remotePending.size()) != 1) {
+                // spec-incompliant CM, ignoring members changed
+                warning() << "Received MembersChangedDetailed with reason "
+                    "Renamed and removed.size != 1 or added.size + "
+                    "localPending.size + remotePending.size != 1. Ignoring";
+                return;
+            }
+            uint newHandle = 0;
+            if (!added.isEmpty()) {
+                newHandle = added.first();
+            } else if (!localPending.isEmpty()) {
+                newHandle = localPending.first();
+            } else if (!remotePending.isEmpty()) {
+                newHandle = remotePending.first();
+            }
+            onSelfHandleChanged(newHandle);
+            return;
+        }
+
         // let's try to get the actor contact from contact manager if available
         mPriv->groupSelfContactRemoveInfo = GroupMemberChangeDetails(
                 mPriv->connection->contactManager()->lookupContactByHandle(
-- 
1.5.6.5



More information about the telepathy-commits mailing list