# -----------------------------------------------------------------------
- def __init__(self, book, contact):
+ def __init__(self, book, econtact):
"""Create a new contact store for modifying contacts in the given
EBook."""
self._book = book
- self._contact = contact
+ self._contact = econtact
self._identifiers = self._find_ids()
+ self._mapped_to = set([])
# -----------------------------------------------------------------------
versions of identifiers for this contact."""
return self._identifiers
+
+
+ # -----------------------------------------------------------------------
+ def get_econtact(self):
+ """Return the EContact which backs this contact."""
+
+ return self._contact
+
+
+ # -----------------------------------------------------------------------
+ def add_mapping(self, id):
+ """Record the fact that this contact is mapped against a provider.
+ 'id' MUST match the string returned by Provider.get_id()."""
+
+ self._mapped_to.add(id)
+
+
+ # ----------------------------------------------------------------------
+ def get_mappings(self):
+ """Return the set of IDs of providers which are mapped to this contact.
+ The data can only be relied upon after services have run."""
+
+ return self._mapped_to
+
+
+ # -----------------------------------------------------------------------
+ def get_photo(self):
+ """Return the photo property, or None. The result is of type
+ EContactPhoto."""
+
+ photo = self._contact.get_property('photo')
+ return cast(c_void_p(hash(photo)), POINTER(EContactPhoto))
# -----------------------------------------------------------------------
except:
print "FAILED to get photo from URL %s" % url
return False
-
-
- # -----------------------------------------------------------------------
- def has_photo(self):
- # FIXME
- return False
# -----------------------------------------------------------------------