Update contactview to show photo, name and then the set of icons
[hermes] / package / src / org / maemo / hermes / engine / service.py
1 from friend import Friend
2
3 class Service:
4     """The notional `Service' for a provider. This is responsible for communicating
5        with the backend service and enhancing contacts.
6        
7        Copyright (c) Andrew Flegg <andrew@bleb.org> 2010.
8        Released under the Artistic Licence."""
9        
10     def __init__(self):
11         """Should make initial calls to the service and retrieve a list of friends."""
12
13
14     # -----------------------------------------------------------------------
15     def get_name(self):
16         """Should return the same name as the provider class - debugging only - REMOVE/FIXME"""
17         
18         return None
19
20     
21     # -----------------------------------------------------------------------
22     def pre_process_contact(self, contact):
23         """If the contact have an URL (or similar) that proves an existing matching
24            to a friend on this service, then this should be remembered to avoid
25            name collision/mapping the same friend to other contacts with the same 
26            name."""
27          
28         return None
29
30     
31     def process_friends(self):
32         """Called once to signal that it's time to get all friends' data."""
33         
34         pass
35     
36     
37     # -----------------------------------------------------------------------
38     def process_contact(self, contact):
39         """Called for each contact in the address book. Any friends linked to
40            from the contact should have their matching updated. The back end should 
41            enrich the friend passed with any meta-data it can."""
42            
43         pass
44     
45     
46     # -----------------------------------------------------------------------
47     def get_unmatched_friends(self):
48         """Return a list of friends not matched to a contact, or 'None' if manual mapping
49            is not supported."""
50          
51         return None
52
53
54     # -----------------------------------------------------------------------
55     def finalise(self, updated, overwrite = False):
56         """Once all contacts have been processed, allows for any tidy-up/additional
57            enrichment. If any contacts are updated at this stage, 'updated' should
58            be added to."""
59            
60         pass
61
62
63     # -----------------------------------------------------------------------
64     ###DEPRECATED
65     def _create_friend(self, name):
66         """Used to create a Friend object for a contact"""
67         
68         return Friend(name)