bigboard r7242 - trunk/bigboard
- From: otaylor svn gnome org
- To: svn-commits-list gnome org
- Subject: bigboard r7242 - trunk/bigboard
- Date: Tue, 29 Jan 2008 23:04:29 +0000 (GMT)
Author: otaylor
Date: Tue Jan 29 23:04:29 2008
New Revision: 7242
URL: http://svn.gnome.org/viewvc/bigboard?rev=7242&view=rev
Log:
Fix a case where we didn't properly update the user list when buddy.user.contact changed
Modified:
trunk/bigboard/people_tracker.py
Modified: trunk/bigboard/people_tracker.py
==============================================================================
--- trunk/bigboard/people_tracker.py (original)
+++ trunk/bigboard/people_tracker.py Tue Jan 29 23:04:29 2008
@@ -456,14 +456,14 @@
self.__resources = set()
self.__resolved = set()
+ # This is the set of users we need to watch the 'contact' property on
+ self.__watched_users = set()
+
def _update(self, resources):
for resource in self.__resources:
if resource.class_id == "online-desktop:/p/o/buddy" and resource not in resources:
resource.disconnect(self.__buddy_user_changed)
resource.disconnect(self.__buddy_contact_changed)
- # FIXME: we need to watch for changes on user.contact as well, which will
- # require some rewriting; currently we won't update properly when someone
- # adds a resource on the online.gnome.org server
for resource in resources:
if resource.class_id == "online-desktop:/p/o/buddy" and resource not in self.__resources:
@@ -475,14 +475,17 @@
def __update_resolved(self):
resolved = set()
+ watched_users = set()
for resource in self.__resources:
if resource.class_id == "online-desktop:/p/o/buddy":
user = getattr(resource, 'user', None)
contact = getattr(resource, 'contact', None)
- if user != None and contact == None:
- contact = getattr(user, 'contact', None)
+ if user != None:
+ watched_users.add(user)
+ if contact == None:
+ contact = getattr(user, 'contact', None)
if contact != None:
resource = contact
@@ -496,6 +499,17 @@
resolved.add(person)
+ old_watched_users = self.__watched_users
+ self.__watched_users = watched_users
+
+ for user in old_watched_users:
+ if not user in self.__watched_users:
+ user.disconnect(self.__user_contact_changed)
+
+ for user in self.__watched_users:
+ if not user in old_watched_users:
+ user.connect(self.__user_contact_changed, 'contact')
+
old_resolved = self.__resolved
self.__resolved = resolved
@@ -513,6 +527,9 @@
def __buddy_contact_changed(self, resource):
self.__update_resolved()
+ def __user_contact_changed(self, resource):
+ self.__update_resolved()
+
def __str__(self):
return self.__resolved.__str__()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]