mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 18:19:22 +03:00
convert results from nc to sm contacts
This commit is contained in:
parent
1ee07bb83d
commit
5d04ca597e
1 changed files with 15 additions and 2 deletions
|
|
@ -56,7 +56,7 @@ class NextcloudAddressBook implements \RainLoop\Providers\AddressBook\AddressBoo
|
|||
];
|
||||
$results = $this->contactsManager->search($sSearch, [], $options);
|
||||
$iResultCount = count($results);
|
||||
return $results;
|
||||
return $this->convertResultsToSnappymailContacts($results);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -72,7 +72,8 @@ class NextcloudAddressBook implements \RainLoop\Providers\AddressBook\AddressBoo
|
|||
$options = [
|
||||
'limit' => $iLimit
|
||||
];
|
||||
return $this->contactsManager->search($sSearch, [], $options);
|
||||
$results = $this->contactsManager->search($sSearch, [], $options);
|
||||
return $this->convertResultsToSnappymailContacts($results);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -86,4 +87,16 @@ class NextcloudAddressBook implements \RainLoop\Providers\AddressBook\AddressBoo
|
|||
public function Test() : string {
|
||||
return '';
|
||||
}
|
||||
|
||||
private function convertResultsToSnappymailContacts(array $results = []) {
|
||||
$contacts = [];
|
||||
foreach($results as $result) {
|
||||
$vCard = \Sabre\VObject\Reader::readJson($result);
|
||||
$contact = new Contact();
|
||||
$contact->setVCard($vCard);
|
||||
$contacts[] = $contact;
|
||||
}
|
||||
|
||||
return $contacts;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue