Fix namespace and FN default

This commit is contained in:
Akhil 2023-09-08 14:04:37 +05:30
parent 46cfa9ffa1
commit cc25129a5e
No known key found for this signature in database
GPG key ID: A8AB680DBB7F3D45

View file

@ -1,10 +1,9 @@
<?php <?php
use RainLoop\Providers\AddressBook\Classes\Contact; use RainLoop\Providers\AddressBook\Classes\Contact;
use Sabre\VObject\Component\VCard;
class NextcloudAddressBook implements \RainLoop\Providers\AddressBook\AddressBookInterface class NextcloudAddressBook implements \RainLoop\Providers\AddressBook\AddressBookInterface
{ {
use Rainloop\Providers\AddressBook\CardDAV; use RainLoop\Providers\AddressBook\CardDAV;
private const URI = 'webmail'; private const URI = 'webmail';
private $contactsManager; private $contactsManager;
private $key; private $key;
@ -126,6 +125,8 @@ class NextcloudAddressBook implements \RainLoop\Providers\AddressBook\AddressBoo
$properties['EMAIL'] = \trim($sEmail); $properties['EMAIL'] = \trim($sEmail);
if ('' !== \trim($oEmail->GetDisplayName())) { if ('' !== \trim($oEmail->GetDisplayName())) {
$properties['FN'] = $oEmail->GetDisplayName(); $properties['FN'] = $oEmail->GetDisplayName();
} else {
$properties['FN'] = \trim($sEmail);
} }
$this->contactsManager->createOrUpdate($properties, $this->key); $this->contactsManager->createOrUpdate($properties, $this->key);
} }