[Telepathy-commits] [telepathy-doc/master] Inform the state machine which handles have updated to cut down on updates

Davyd Madeley davyd at madeley.id.au
Mon Mar 9 00:35:29 PDT 2009


---
 docs/examples/pygtk_chat_client/example.py |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/docs/examples/pygtk_chat_client/example.py b/docs/examples/pygtk_chat_client/example.py
index fb0eabd..ab34b36 100755
--- a/docs/examples/pygtk_chat_client/example.py
+++ b/docs/examples/pygtk_chat_client/example.py
@@ -136,7 +136,7 @@ class ContactList(Channel):
             contact = Contact (self.sm, handle, attributes)
             self.sm.contacts[handle] = contact
 
-        self.sm.contacts_updated()
+        self.sm.contacts_updated(map.keys())
 
 class Contact(object):
     def __init__(self, sm, handle, attributes={}):
@@ -205,19 +205,19 @@ class StateMachine(object):
             if handle not in self.contacts: continue
             self.contacts[handle].alias = alias
 
-        self.contacts_updated()
+        self.contacts_updated(map(lambda (h, a): h, aliases))
 
     def _presences_changed(self, presences):
         for handle, presence in presences.iteritems():
             if handle not in self.contacts: continue
             self.contacts[handle].presence = presence
 
-        self.contacts_updated()
+        self.contacts_updated(presences.keys())
 
-    def contacts_updated(self):
-        print 'Contacts updated'
+    def contacts_updated(self, handles):
+        print ' -- Contacts updated --'
 
-        for contact in self.contacts.values():
+        for contact in [ self.contacts[h] for h in handles if h in self.contacts]:
             print "%s: %s (%s)" % (
                 contact.contact_id, contact.alias, contact.get_status())
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list