. */ namespace OCA\Contacts\Share; use OCA\Contacts; class Contact implements \OCP\Share_Backend { const FORMAT_CONTACT = 0; private static $contact; public function __construct() { // Currently only share $this->backend = new Backend\Database(); } public function isValidSource($itemSource, $uidOwner) { self::$contact = VCard::find($itemSource); if (self::$contact) { return true; } return false; } public function generateTarget($itemSource, $shareWith, $exclude = null) { // TODO Get default addressbook and check for conflicts return self::$contact['fullname']; } public function formatItems($items, $format, $parameters = null) { $contacts = array(); if ($format == self::FORMAT_CONTACT) { foreach ($items as $item) { $contact = VCard::find($item['item_source']); $contact['fullname'] = $item['item_target']; $contacts[] = $contact; } } return $contacts; } }