From 09150e057c588b4f547662bddfeeb1c419aa9d2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Tue, 30 Jun 2015 10:26:09 +0200 Subject: [PATCH] Set raw photo data into vcard - encoding is done with the serialization mechanisms - fix #904 #787 --- lib/contact.php | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/lib/contact.php b/lib/contact.php index 0919121b..816de62d 100644 --- a/lib/contact.php +++ b/lib/contact.php @@ -43,7 +43,7 @@ class Contact extends VObject\VCard implements IPIMObject { /** * @brief language object * - * @var OC_L10N + * @var \OCP\IL10N */ public static $l10n; @@ -429,24 +429,10 @@ class Contact extends VObject\VCard implements IPIMObject { $type = strtoupper(array_pop($type)); } if (isset($this->PHOTO)) { - $property = $this->PHOTO; - if (!$property) { - return false; - } - $property->setValue(strval($photo)); - $property->parameters = array(); - $property->parameters[] - = new \Sabre\VObject\Parameter('ENCODING', 'b'); - $property->parameters[] - = new \Sabre\VObject\Parameter('TYPE', $photo->mimeType()); - $this->PHOTO = $property; - } else { - $this->add('PHOTO', - strval($photo), array('ENCODING' => 'b', - 'TYPE' => $type)); - // TODO: Fix this hack - $this->setSaved(false); + $this->remove('PHOTO'); } + $this->add('PHOTO', $photo->data(), ['ENCODING' => 'b', 'TYPE' => $type]); + $this->setSaved(false); return true;