mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 18:19:22 +03:00
Fix issue when contact is found in some other addressbook
Signed-off-by: Akhil <akhil@e.email>
This commit is contained in:
parent
cc25129a5e
commit
3c7ef4df46
1 changed files with 14 additions and 8 deletions
|
|
@ -113,20 +113,26 @@ class NextcloudAddressBook implements \RainLoop\Providers\AddressBook\AddressBoo
|
|||
return false;
|
||||
}
|
||||
foreach ($aEmailsObjects as $oEmail) {
|
||||
$properties = [];
|
||||
if ('' === \trim($oEmail->GetEmail())) {
|
||||
continue;
|
||||
}
|
||||
$sEmail = \trim($oEmail->GetEmail(true));
|
||||
$existingResults = $this->contactsManager->search($sEmail, ['EMAIL'], ['strict_search' => true]);
|
||||
if (!empty($existingResults)) {
|
||||
$properties['URI'] = $existingResults[0]['UID'] . '.vcf';
|
||||
}
|
||||
$properties['EMAIL'] = \trim($sEmail);
|
||||
|
||||
$properties = [
|
||||
'EMAIL' => $sEmail,
|
||||
'FN' => $sEmail
|
||||
];
|
||||
|
||||
if ('' !== \trim($oEmail->GetDisplayName())) {
|
||||
$properties['FN'] = $oEmail->GetDisplayName();
|
||||
} else {
|
||||
$properties['FN'] = \trim($sEmail);
|
||||
}
|
||||
$existingResults = $this->contactsManager->search($sEmail, ['EMAIL'], ['strict_search' => true]);
|
||||
|
||||
foreach ($existingResults as $contact) {
|
||||
if ($contact['addressbook-key'] === $this->key) {
|
||||
$properties['URI'] = $contact['UID'] . '.vcf';
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->contactsManager->createOrUpdate($properties, $this->key);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue