[Pkg-owncloud-commits] [php-sabre-vobject] 03/43: Rely on converter instead of duplicating X-APPLE-OMIT-YEAR handling
David Prévot
taffit at moszumanska.debian.org
Sat Sep 5 15:23:46 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to tag 4.0.0-alpha2
in repository php-sabre-vobject.
commit 66c24683d8fd6547e855785e170ea48adb632263
Author: Dominik Tobschall <dominik at fruux.com>
Date: Wed Jul 8 14:07:11 2015 +0200
Rely on converter instead of duplicating X-APPLE-OMIT-YEAR handling
---
lib/BirthdayCalendarGenerator.php | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/lib/BirthdayCalendarGenerator.php b/lib/BirthdayCalendarGenerator.php
index 02b1a1f..8b6198c 100644
--- a/lib/BirthdayCalendarGenerator.php
+++ b/lib/BirthdayCalendarGenerator.php
@@ -137,6 +137,10 @@ class BirthdayCalendarGenerator {
continue;
}
+ // We're always converting to vCard 4.0 so we can rely on the
+ // VCardConverter handling the X-APPLE-OMIT-YEAR property for us.
+ $object = $object->convert(Document::VCARD40);
+
// Skip if the BDAY property is not of the right type.
if (!$object->BDAY instanceof Property\VCard\DateAndOrTime) {
continue;
@@ -152,17 +156,9 @@ class BirthdayCalendarGenerator {
// Set a year if it's not set.
if (!$dateParts['year']) {
$object->BDAY=$this->defaultYear . '-' . $dateParts['month'] . '-' . $dateParts['date'];
- }
-
- // Set a year, if X-APPLE-OMIT-YEAR is set.
- if (isset($object->BDAY['X-APPLE-OMIT-YEAR'])) {
- if ($dateParts['year'] === $object->BDAY['X-APPLE-OMIT-YEAR']->getValue()) {
- // @TODO:
- // It probably makes sense to add an info to our event that the year is unknown.
- // Maybe we should just keep this and also set the X-APPLE-OMIT-YEAR PARAM on our PROPERTY
- $object->BDAY=$this->defaultYear . '-' . $dateParts['month'] . '-' . $dateParts['date'];
- }
+ // @TODO:
+ // It may make sense to add an info to our event that the year was unknown.
}
// Generate the event.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabre-vobject.git
More information about the Pkg-owncloud-commits
mailing list