Make sure unmatched friends are *actually* keyed off name.
[hermes] / package / src / org / maemo / hermes / engine / hermes.py
index 9a00bfd..e4b4713 100644 (file)
@@ -101,7 +101,10 @@ class Hermes:
             self._progress("Finalising...", current_tick, total_ticks)
             current_tick += len(contacts)
             service.finalise(self.updated, overwrite_existing_fields)
-            self.friends[service.get_id] = service.get_unmatched_friends()
+            for friend in service.get_unmatched_friends():
+                friend.set_source(service.get_id())
+                key = unicode(friend.get_name()).encode('trans') + "_" + service.get_id()
+                self.friends[key] = friend
             
         # commit changes
         tick_increment = total_contacts / (len(self.updated) or 1)
@@ -120,7 +123,9 @@ class Hermes:
         """Update the given contact with information from the given friend."""
         
         print "updating contact ", contact, " with friend ", friend
-        self.updated.append(contact)
+        if friend.update_contact(contact, resync):
+            self.updated.append(contact)
+
         self.matched.append(contact)
         if friend.get_source() is not None:
             contact.add_mapping(friend.get_source())