From 65d3ecaa5b7b8394a822228e646974ec99cb178d Mon Sep 17 00:00:00 2001 From: Patrick Bihan-Faou Date: Mon, 19 Nov 2007 11:16:24 +0000 Subject: [PATCH] Fix the synml fragmentation support problem detected on some phones such as the Nokia E61. This affected most phones/devices that use SyncML with the vcard/vcalendar format. Fix from Christoph Kaulich, thanks. --- phpgwapi/inc/horde/Horde/SyncML/State.php | 42 +++++++++++++++-------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/phpgwapi/inc/horde/Horde/SyncML/State.php b/phpgwapi/inc/horde/Horde/SyncML/State.php index e6afd5001c..7cb93898f8 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/State.php +++ b/phpgwapi/inc/horde/Horde/SyncML/State.php @@ -670,7 +670,7 @@ class Horde_SyncML_State { $res['ContentType'] = $ctype; } - switch($ctype) + switch(strtolower($ctype)) { case 'text/x-vcard': case 'text/x-vcalendar': @@ -687,19 +687,20 @@ class Horde_SyncML_State { $res['ContentFormat'] = 'b64'; $res['mayFragment'] = 0; break; - } - if (!isset($res['mayFragment'])) - { - $res['mayFragment'] = 0; + default: + Horde::logMessage("SyncML: unrecognized content type '$ctype'", __FILE__, __LINE__, PEAR_LOG_ERR); + break; } if ($target != null) { - switch($target) + $_target = str_replace('./','',$target); + switch(strtolower($_target)) { case 'calendar': case 'tasks': + case 'caltasks': case 'notes': case 'contacts': $res['mayFragment'] = 1; @@ -710,22 +711,30 @@ class Horde_SyncML_State { case 'sifnotes': case 'sifcontacts': case 'scard': - case 'scalendar': + case 'scal': case 'stask': case 'snote': - default: $res['mayFragment'] = 0; break; + + default: + Horde::logMessage("SyncML: unrecognized target '$_target'", __FILE__, __LINE__, PEAR_LOG_ERR); + break; } } + if (!isset($res['mayFragment'])) + { + $res['mayFragment'] = 0; + } + return $res; } function getPreferedContentType($type) { $_type = str_replace('./','',$type); - switch($_type) + switch(strtolower($_type)) { case 'contacts': return 'text/x-vcard'; @@ -735,11 +744,9 @@ class Horde_SyncML_State { return 'text/x-vnote'; break; - case 'tasks': - return 'text/x-vcalendar'; - break; - case 'calendar': + case 'tasks': + case 'caltasks': return 'text/x-vcalendar'; break; @@ -762,13 +769,17 @@ class Horde_SyncML_State { case 'snote': return 'text/x-s4j-sifn'; break; + + default: + Horde::logMessage("SyncML: unrecognized content type '$_type'", __FILE__, __LINE__, PEAR_LOG_ERR); + break; } } function getHordeType($type) { $_type = str_replace('./','',$type); - switch($_type) + switch(strtolower($_type)) { case 'contacts': return 'contacts'; @@ -783,6 +794,7 @@ class Horde_SyncML_State { break; case 'calendar': + case 'caltasks': return 'calendar'; break; @@ -809,7 +821,7 @@ class Horde_SyncML_State { break; default: - Horde::logMessage("unknown hordeType for type=$type ($_type)", __FILE__, __LINE__, PEAR_LOG_INFO); + Horde::logMessage("SyncML: unknown hordeType for type=$type ($_type)", __FILE__, __LINE__, PEAR_LOG_INFO); return $_type; break; }