removed deprecated _create_friend in engine.service
[hermes] / package / src / org / maemo / hermes / engine / service.py
index 6059bf6..65bdab7 100644 (file)
@@ -1,3 +1,5 @@
+from friend import Friend
+
 class Service:
     """The notional `Service' for a provider. This is responsible for communicating
        with the backend service and enhancing contacts.
@@ -5,32 +7,39 @@ class Service:
        Copyright (c) Andrew Flegg <andrew@bleb.org> 2010.
        Released under the Artistic Licence."""
        
-    def __init__(self):
+    def __init__(self, service_id):
         """Should make initial calls to the service and retrieve a list of friends."""
+        
+        self._service_id = service_id
 
 
     # -----------------------------------------------------------------------
-    def get_name(self):
-        """Should return the same name as the provider class - debugging only - REMOVE/FIXME"""
+    def get_id(self):
+        """Return the service ID, as given to the service at creation."""
         
-        return None
+        return self._service_id
 
     
     # -----------------------------------------------------------------------
     def pre_process_contact(self, contact):
         """If the contact have an URL (or similar) that proves an existing matching
            to a friend on this service, then this should be remembered to avoid
-           name collission/mapping the same friend to other contacts with the same 
+           name collision/mapping the same friend to other contacts with the same 
            name."""
          
         return None
 
     
+    def process_friends(self):
+        """Called once to signal that it's time to get all friends' data."""
+        
+        pass
+    
+    
     # -----------------------------------------------------------------------
-    def process_contact(self, contact, friend):
-        """Called for each contact in the address book. Any friends linked to
-           from the contact should have their matching updated. The back end should 
-           enrich the friend passed with any meta-data it can."""
+    def process_contact(self, contact):
+        """Called for each contact in the address book. If the contact can be 
+           matched to a Friend, than return the Friend object or None."""
            
         pass
     
@@ -44,6 +53,14 @@ class Service:
 
 
     # -----------------------------------------------------------------------
+    def create_contacts(self):
+        """Return a list of friends which should have contacts created. This
+           should expected by the user, and optional."""
+           
+        return []
+
+
+    # -----------------------------------------------------------------------
     def finalise(self, updated, overwrite = False):
         """Once all contacts have been processed, allows for any tidy-up/additional
            enrichment. If any contacts are updated at this stage, 'updated' should