diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-11-25 21:44:36 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-12-02 09:14:41 +0100 |
commit | dad6470baa817a796de7e1b6d27daf6d24519096 (patch) | |
tree | aeb21531d7465b8c2322076f5303744548778177 /apps | |
parent | c91192fb7324c246d3af95ae83ad9ac1ae0a8ec1 (diff) | |
download | nextcloud-server-dad6470baa817a796de7e1b6d27daf6d24519096.tar.gz nextcloud-server-dad6470baa817a796de7e1b6d27daf6d24519096.zip |
Add IUser::getAvatarImage() for easy access
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/command/syncsystemaddressbook.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/apps/dav/command/syncsystemaddressbook.php b/apps/dav/command/syncsystemaddressbook.php index 01f4d08940b..3139813fc4f 100644 --- a/apps/dav/command/syncsystemaddressbook.php +++ b/apps/dav/command/syncsystemaddressbook.php @@ -70,20 +70,25 @@ class SyncSystemAddressBook extends Command { $name = $user->getBackendClassName(); $userId = $user->getUID(); $displayName = $user->getDisplayName(); + //$emailAddress = $user->getEMailAddress(); + $image = $user->getAvatarImage(-1); + $cardId = "$name:$userId.vcf"; $card = $this->backend->getCard($systemAddressBook['id'], $cardId); if ($card === false) { $vCard = new VCard(); - $vCard->add(new Text($vCard, 'UID', $user->getUID())); + $vCard->add(new Text($vCard, 'UID', $userId)); $vCard->add(new Text($vCard, 'FN', $displayName)); -// $vCard->add(new Text($vCard, 'EMAIL', $user->getEMailAddress())); - //$vCard->add(new Binary($vCard, 'PHOTO', $user->getAvatar())); +// $vCard->add(new Text($vCard, 'EMAIL', $emailAddress)); + if ($image) { + $vCard->add('PHOTO', $image->data(), ['ENCODING' => 'b', 'TYPE' => $image->mimeType()]); + } $vCard->validate(); $this->backend->createCard($systemAddressBook['id'], $cardId, $vCard->serialize()); } else { $updated = false; $vCard = Reader::read($card['carddata']); - if($vCard->FN !== $user->getDisplayName()) { + if($vCard->FN !== $displayName) { $vCard->FN = new Text($vCard, 'FN', $displayName); $updated = true; } |