Add user's email address to vCard
This commit is contained in:
parent
079ae9b7a9
commit
7c8a84e7ac
|
@ -34,6 +34,7 @@ class SyncSystemAddressBook extends Command {
|
||||||
/**
|
/**
|
||||||
* @param IUserManager $userManager
|
* @param IUserManager $userManager
|
||||||
* @param IDBConnection $dbConnection
|
* @param IDBConnection $dbConnection
|
||||||
|
* @param IConfig $config
|
||||||
*/
|
*/
|
||||||
function __construct(IUserManager $userManager, IDBConnection $dbConnection, IConfig $config) {
|
function __construct(IUserManager $userManager, IDBConnection $dbConnection, IConfig $config) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
@ -70,7 +71,7 @@ class SyncSystemAddressBook extends Command {
|
||||||
$name = $user->getBackendClassName();
|
$name = $user->getBackendClassName();
|
||||||
$userId = $user->getUID();
|
$userId = $user->getUID();
|
||||||
$displayName = $user->getDisplayName();
|
$displayName = $user->getDisplayName();
|
||||||
//$emailAddress = $user->getEMailAddress();
|
$emailAddress = $user->getEMailAddress();
|
||||||
$image = $user->getAvatarImage(-1);
|
$image = $user->getAvatarImage(-1);
|
||||||
|
|
||||||
$cardId = "$name:$userId.vcf";
|
$cardId = "$name:$userId.vcf";
|
||||||
|
@ -79,7 +80,7 @@ class SyncSystemAddressBook extends Command {
|
||||||
$vCard = new VCard();
|
$vCard = new VCard();
|
||||||
$vCard->add(new Text($vCard, 'UID', $userId));
|
$vCard->add(new Text($vCard, 'UID', $userId));
|
||||||
$vCard->add(new Text($vCard, 'FN', $displayName));
|
$vCard->add(new Text($vCard, 'FN', $displayName));
|
||||||
// $vCard->add(new Text($vCard, 'EMAIL', $emailAddress));
|
$vCard->add(new Text($vCard, 'EMAIL', $emailAddress));
|
||||||
if ($image) {
|
if ($image) {
|
||||||
$vCard->add('PHOTO', $image->data(), ['ENCODING' => 'b', 'TYPE' => $image->mimeType()]);
|
$vCard->add('PHOTO', $image->data(), ['ENCODING' => 'b', 'TYPE' => $image->mimeType()]);
|
||||||
}
|
}
|
||||||
|
@ -92,6 +93,10 @@ class SyncSystemAddressBook extends Command {
|
||||||
$vCard->FN = new Text($vCard, 'FN', $displayName);
|
$vCard->FN = new Text($vCard, 'FN', $displayName);
|
||||||
$updated = true;
|
$updated = true;
|
||||||
}
|
}
|
||||||
|
if($vCard->EMail !== $emailAddress) {
|
||||||
|
$vCard->FN = new Text($vCard, 'EMAIL', $emailAddress);
|
||||||
|
$updated = true;
|
||||||
|
}
|
||||||
if ($updated) {
|
if ($updated) {
|
||||||
$this->backend->updateCard($systemAddressBook['id'], $cardId, $vCard->serialize());
|
$this->backend->updateCard($systemAddressBook['id'], $cardId, $vCard->serialize());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue