From 0c3f861b1d7896257c0f3d0b16b3b44a0a5c44b7 Mon Sep 17 00:00:00 2001
From: Ajay Garg <ajay@activitycentral.com>
Date: Sat, 28 Jan 2012 14:13:33 +0530
Subject: [PATCH sugar v2] sl#2955: Ignore Buddy updates before receiving the initial Buddy list
Organization: Sugar Labs Foundation
Signed-off-by: Ajay Garg <ajay@activitycentral.com>
---
Note that this patch is to be applied in full, and not over version-1 patch.
jarabe.model.neighborhood._Account tracks buddies by setting up handlers
for Telepathy signals and requests initial state from Telepathy to
populate the Neighbourhood with Buddies and shared Activities. In order
to prevent a race condition between requesting initial (i.e. current)
state and updates to Buddies and shared Activities, the signal handlers
are connected before requesting (and receiving) the initial state.
However, this means that updates may arrive before the initial state,
i.e. before the corresponding Buddy is known to Sugar. That's perfectly
OK and we can simply ignore the update as the Buddy list we will receive
later on will already include the updated properties.
Changes of version-2 over version-1 :
-------------------------------------
a. Corrected the patch description (courtesy Sascha).
src/jarabe/model/neighborhood.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/jarabe/model/neighborhood.py b/src/jarabe/model/neighborhood.py
index 828cb14..4528a15 100644
a
|
b
|
class _Account(gobject.GObject): |
427 | 427 | |
428 | 428 | def __buddy_info_updated_cb(self, handle, properties): |
429 | 429 | logging.debug('_Account.__buddy_info_updated_cb %r', handle) |
430 | | self.emit('buddy-updated', self._buddy_handles[handle], properties) |
| 430 | if handle in self._buddy_handles: |
| 431 | self.emit('buddy-updated', self._buddy_handles[handle], properties) |
431 | 432 | |
432 | 433 | def __current_activity_changed_cb(self, contact_handle, activity_id, |
433 | 434 | room_handle): |