From: Jan Schneider Date: Thu, 4 Nov 2010 16:04:44 +0000 (+0100) Subject: MFB: X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=88d459bf2ae29604b5f23e79df16bcfd20f073a3;p=horde.git MFB: [jan] Skip event status synchronization with Outlook, which is broken. [jan] Don't send SIF data to recent Funambol clients, unless requested. --- diff --git a/framework/SyncML/SyncML/Device.php b/framework/SyncML/SyncML/Device.php index 85b421099..1e7502106 100644 --- a/framework/SyncML/SyncML/Device.php +++ b/framework/SyncML/SyncML/Device.php @@ -21,6 +21,14 @@ class SyncML_Device { /** + * The original preferred content type of the client, if provided through + * DevInf. + * + * @var string + */ + var $requestedContentType; + + /** * Attempts to return a concrete SyncML_Device instance based on $driver. * * @param string $driver The type of concrete SyncML_Device subclass to @@ -112,6 +120,7 @@ class SyncML_Device { if (!empty($ds)) { $r = $ds->getPreferredRXContentType(); if (!empty($r)) { + $this->requestedContentType = $r; return $r; } } diff --git a/framework/SyncML/SyncML/Device/Sync4j.php b/framework/SyncML/SyncML/Device/Sync4j.php index ecc6731f3..0fe47ce0d 100644 --- a/framework/SyncML/SyncML/Device/Sync4j.php +++ b/framework/SyncML/SyncML/Device/Sync4j.php @@ -28,30 +28,6 @@ require_once 'Horde/Icalendar.php'; */ class SyncML_Device_sync4j extends SyncML_Device { - function getPreferredContentTypeClient($serverSyncURI, $sourceSyncURI) - { - $database = strtolower($serverSyncURI); // no string api needed here - - // Code copied from parent function. But we must not use device - // mimetype from device information here as this would result in - // us asking the horde backend to provide crazy text/x-s4j-sifn - // stuff. Instead we ask backend for default type and convert it - // internally in this class (in convertServer2Client). - if (strpos($database, 'contact') !== false || - strpos($database, 'card') !== false) { - return 'text/x-vcard'; - } elseif (strpos($database, 'note') !== false || - strpos($database, 'memo') !== false) { - return 'text/x-vnote'; - } elseif (strpos($database, 'task') !== false || - strpos($database, 'cal') !== false || - strpos($database, 'event') !== false) { - return 'text/calendar'; - } - - return parent::getPreferredContentTypeClient($serverSyncURI, $sourceSyncURI); - } - /** * Convert the content. */ @@ -84,6 +60,18 @@ class SyncML_Device_sync4j extends SyncML_Device { $content = SyncML_Device_sync4j::sif2vtodo($content); $contentType = 'text/calendar'; break; + + case 'text/calendar': + case 'text/x-vcalendar': + $si = $_SESSION['SyncML.state']->sourceURI; + if (stristr($si, 'fol-') !== false) { + // The Funambol Outlook connector uses invalid STATUS + // values. Actually it maps MeetingStatus values of the + // Outlook event to the STATUS property, which is + // completely useless. So drop the STATUS altogether. + $content = preg_replace('/^STATUS:.*\r?\n/im', '', $content); + } + break; } $GLOBALS['backend']->logFile( @@ -116,6 +104,21 @@ class SyncML_Device_sync4j extends SyncML_Device { list($content, $contentType, $encodingType) = parent::convertServer2Client($content, $contentType, $database); + if ($this->requestedContentType == $contentType) { + if ($contentType == 'text/calendar' || + $contentType == 'text/x-vcalendar') { + $si = $_SESSION['SyncML.state']->sourceURI; + if (stristr($si, 'fol-') !== false) { + // The Funambol Outlook connector uses invalid STATUS + // values. Actually it maps MeetingStatus values of the + // Outlook event to the STATUS property, which is + // completely useless. So drop the STATUS altogether. + $content = preg_replace('/^STATUS:.*\r?\n/im', '', $content); + } + } + return array($content, $contentType, $encodingType); + } + switch ($contentType) { case 'text/calendar' : case 'text/x-vcalendar' : diff --git a/framework/SyncML/tests/sif.phpt b/framework/SyncML/tests/sif.phpt index c5d47d14e..7e81ca8be 100644 --- a/framework/SyncML/tests/sif.phpt +++ b/framework/SyncML/tests/sif.phpt @@ -75,6 +75,42 @@ EVENT; echo $device->vevent2sif($data); echo "\n\n"; +$data = <<vevent2sif($data); +echo "\n\n"; + $data = << @@ -177,6 +213,8 @@ echo $device->sif2vcard($data); 10212008-06-302008-06-30Server02015 +112020101101T090000Z20101101T100000ZCinco-LunesTrabajoKorta0112020101130T225959Z1560 + BEGIN:VCARD VERSION:3.0 FN:Lastname\, Firstname diff --git a/horde/docs/CHANGES b/horde/docs/CHANGES index db04930c7..ecab04847 100644 --- a/horde/docs/CHANGES +++ b/horde/docs/CHANGES @@ -53,6 +53,8 @@ v4.0-cvs v3.3.11-cvs ----------- +[jan] Skip event status synchronization with Outlook, which is broken. +[jan] Don't send SIF data to recent Funambol clients, unless requested. [jan] Log all queries by the history library.