Commit 0b5edfc3 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #47 in ZP/z-push from...

Merge pull request #47 in ZP/z-push from feature/ZP-687-extract-zarafa-mapiprovider-getsyncblobfromtz to develop

* commit 'd75e8b87':
  ZP-687 Extract function from Zarafa MAPI provider to TimeZoneUtils. Released under the Affero GNU General Public License (AGPL) version 3.
parents ab13d880 d75e8b87
......@@ -233,7 +233,7 @@ class MAPIProvider {
// set server default timezone (correct timezone should be configured!)
$tz = TimezoneUtil::GetFullTZ();
}
$message->timezone = base64_encode($this->getSyncBlobFromTZ($tz));
$message->timezone = base64_encode(TimezoneUtil::GetSyncBlobFromTZ($tz));
if(isset($messageprops[$appointmentprops["isrecurring"]]) && $messageprops[$appointmentprops["isrecurring"]]) {
// Process recurrence
......@@ -567,7 +567,7 @@ class MAPIProvider {
else
$tz = $this->getGMTTZ();
$message->meetingrequest->timezone = base64_encode($this->getSyncBlobFromTZ($tz));
$message->meetingrequest->timezone = base64_encode(TimezoneUtil::GetSyncBlobFromTZ($tz));
// send basedate if exception
if(isset($props[$meetingrequestproperties["recReplTime"]]) ||
......@@ -1895,27 +1895,6 @@ class MAPIProvider {
return $tz;
}
/**
* Pack timezone info for Sync
*
* @param array $tz
*
* @access private
* @return string
*/
private function getSyncBlobFromTZ($tz) {
// set the correct TZ name (done using the Bias)
if (!isset($tz["tzname"]) || !$tz["tzname"] || !isset($tz["tznamedst"]) || !$tz["tznamedst"])
$tz = TimezoneUtil::FillTZNames($tz);
$packed = pack("la64vvvvvvvv" . "la64vvvvvvvv" . "l",
$tz["bias"], $tz["tzname"], 0, $tz["dstendmonth"], $tz["dstendday"], $tz["dstendweek"], $tz["dstendhour"], $tz["dstendminute"], $tz["dstendsecond"], $tz["dstendmillis"],
$tz["stdbias"], $tz["tznamedst"], 0, $tz["dststartmonth"], $tz["dststartday"], $tz["dststartweek"], $tz["dststarthour"], $tz["dststartminute"], $tz["dststartsecond"], $tz["dststartmillis"],
$tz["dstbias"]);
return $packed;
}
/**
* Pack timezone info for MAPI
*
......
......@@ -1258,4 +1258,24 @@ class TimezoneUtil {
}
}
/**
* Pack timezone info for Sync
*
* @param array $tz
*
* @access private
* @return string
*/
static public function GetSyncBlobFromTZ($tz) {
// set the correct TZ name (done using the Bias)
if (!isset($tz["tzname"]) || !$tz["tzname"] || !isset($tz["tznamedst"]) || !$tz["tznamedst"])
$tz = TimezoneUtil::FillTZNames($tz);
$packed = pack("la64vvvvvvvv" . "la64vvvvvvvv" . "l",
$tz["bias"], $tz["tzname"], 0, $tz["dstendmonth"], $tz["dstendday"], $tz["dstendweek"], $tz["dstendhour"], $tz["dstendminute"], $tz["dstendsecond"], $tz["dstendmillis"],
$tz["stdbias"], $tz["tznamedst"], 0, $tz["dststartmonth"], $tz["dststartday"], $tz["dststartweek"], $tz["dststarthour"], $tz["dststartminute"], $tz["dststartsecond"], $tz["dststartmillis"],
$tz["dstbias"]);
return $packed;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment