[Pkg-owncloud-commits] [php-sabredav] 146/275: Email-address-set.

David Prévot taffit at moszumanska.debian.org
Thu Sep 25 14:56:02 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository php-sabredav.

commit eecd57ad8756550abf43ea65940cc85462b091b7
Author: Evert Pot <me at evertpot.com>
Date:   Mon Aug 11 18:24:56 2014 -0400

    Email-address-set.
---
 lib/CalDAV/Plugin.php                   |  4 +-
 lib/CalDAV/Property/EmailAddressSet.php | 73 +++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+), 2 deletions(-)

diff --git a/lib/CalDAV/Plugin.php b/lib/CalDAV/Plugin.php
index 1c84cd3..01c6db8 100644
--- a/lib/CalDAV/Plugin.php
+++ b/lib/CalDAV/Plugin.php
@@ -327,10 +327,10 @@ class Plugin extends DAV\ServerPlugin {
                 $emails = [];
                 foreach($addresses as $address) {
                     if (substr($address,0,7)==='mailto:') {
-                        $emails[] = $address;
+                        $emails[] = substr($address,7);
                     }
                 }
-                return new HrefList($emails, false);
+                return new Property\EmailAddressSet($emails);
             });
 
             // These two properties are shortcuts for ical to easily find
diff --git a/lib/CalDAV/Property/EmailAddressSet.php b/lib/CalDAV/Property/EmailAddressSet.php
new file mode 100644
index 0000000..03a4db6
--- /dev/null
+++ b/lib/CalDAV/Property/EmailAddressSet.php
@@ -0,0 +1,73 @@
+<?php
+
+namespace Sabre\CalDAV\Property;
+
+use Sabre\DAV;
+
+/**
+ * email-address-set property
+ *
+ * This property represents the email-address-set property in the
+ * http://calendarserver.org/ns/ namespace.
+ *
+ * It's a list of email addresses associated with a user.
+ *
+ * @copyright Copyright (C) 2007-2014 fruux GmbH (https://fruux.com/).
+ * @author Evert Pot (http://evertpot.com/)
+ * @license http://sabre.io/license/ Modified BSD License
+ */
+class EmailAddressSet extends DAV\Property {
+
+    /**
+     * emails
+     *
+     * @var array
+     */
+    private $emails;
+
+    /**
+     * __construct
+     *
+     * @param array $emails
+     */
+    public function __construct(array $hrefs) {
+
+        $this->emails = $emails;
+
+    }
+
+    /**
+     * Returns the email addresses
+     *
+     * @return array
+     */
+    public function getValue() {
+
+        return $this->emails;
+
+    }
+
+    /**
+     * Serializes this property.
+     *
+     * It will additionally prepend the href property with the server's base uri.
+     *
+     * @param DAV\Server $server
+     * @param \DOMElement $dom
+     * @return void
+     */
+    public function serialize(DAV\Server $server,\DOMElement $dom) {
+
+        $prefix = $server->xmlNamespaces['http://calendarserver.org/ns/'];
+
+        foreach($this->emails as $email) {
+
+            $elem = $dom->ownerDocument->createElement($prefix . ':email-address');
+            $elem->appendChild($dom->ownerDocument->createTextNode($email));
+            $dom->appendChild($elem);
+
+        }
+
+    }
+
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git



More information about the Pkg-owncloud-commits mailing list