updated and cleaned up Gravatar
[hermes] / package / src / org / maemo / hermes / engine / gravatar / service.py
index 6c4880b..f3bb225 100644 (file)
@@ -20,13 +20,12 @@ class Service(org.maemo.hermes.engine.service.Service):
         
         org.maemo.hermes.engine.service.Service.__init__(self, service_id)
 
-        self._api_email  = api_email
-        self._api_key    = api_key
+        self._api_email = api_email
+        self._api_key = api_key
          
         self._address_to_contact = {}
         self._hash_to_address = {}
         self._hash_has_gravatar = {}
-        self._empty_cache = True
         
         self._friends_by_contact = {}
         self._contacts_by_friend = {}
@@ -37,13 +36,20 @@ class Service(org.maemo.hermes.engine.service.Service):
     # -----------------------------------------------------------------------
     def pre_process_contact(self, contact):
         """Extracts addresses from the contact."""
+        
         for address in contact.get_emails():
             self._address_to_contact[address] = contact
     
     
     # -----------------------------------------------------------------------
+    def process_friends(self):
+        self._lookup_addresses()
+
+    
+    # -----------------------------------------------------------------------
     def process_contact(self, contact):
-        """On first call (with a contact missing a photo), go get data from Gravatar's servers."""
+        """On first call (with a contact missing a photo), go get data from 
+           Gravatar's servers."""
         
         if not self._has_photo(contact):
             for address in contact.get_emails():
@@ -58,25 +64,24 @@ class Service(org.maemo.hermes.engine.service.Service):
 
 
     # -----------------------------------------------------------------------
-    def process_friends(self):
-        self._lookup_addresses()
+    def get_unmatched_friends(self):
+        """Will always return empty list - Gravatar only reacts on e-mail 
+           addresses from existing contacts."""
 
+        return []
     
+
     # -----------------------------------------------------------------------
-    def get_friends(self):
+    def _get_friends(self):
         return self._contacts_by_friend.keys()
 
-    
-    def get_contacts_with_match(self):
-        """Returns a dict with Contact objects as keys and Friend objects as values"""
-        return self._friends_by_contact
-    
 
-    def get_unmatched_friends(self):
-        """Will always return None - Gravatar only reacts on e-mail address input."""
-        return None
-    
-    
+    # -----------------------------------------------------------------------    
+    def _get_contacts_with_match(self):
+        """Returns a dict with Contact objects as keys and Friend objects as 
+           values"""
+        
+        return self._friends_by_contact
 
 
     # -----------------------------------------------------------------------
@@ -118,7 +123,6 @@ class Service(org.maemo.hermes.engine.service.Service):
     # -----------------------------------------------------------------------
     def _set_hash_information(self, hash_info):
         self._hash_has_gravatar = hash_info
-        self._empty_cache = False
         
 
     # -----------------------------------------------------------------------