Commit 3c19e28d authored by Manfred Kutas's avatar Manfred Kutas

ZP-900 Merged Kopano code. Updated references to KOE.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 25ffa5d4
......@@ -206,7 +206,7 @@ class ChangesMemoryWrapper extends HierarchyCache implements IImportChanges, IEx
// KOE ZO-42: When Notes folders are updated in Outlook, it tries to update the name (that fails by default, as it's a system folder)
// catch this case here and ignore the change
if (($folder->type == SYNC_FOLDER_TYPE_NOTE || $folder->type == SYNC_FOLDER_TYPE_USER_NOTE) && ZPush::GetDeviceManager()->IsOutlookClient()) {
if (($folder->type == SYNC_FOLDER_TYPE_NOTE || $folder->type == SYNC_FOLDER_TYPE_USER_NOTE) && ZPush::GetDeviceManager()->IsKoe()) {
$retFolder = false;
}
// do regular folder update
......
......@@ -103,8 +103,8 @@ class DeviceManager {
$this->additionalFoldersHash = $this->getAdditionalFoldersHash();
if ($this->IsOutlookClient() && $this->device->GetOLPluginVersion() !== false) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("KOE: %s / %s / %s", $this->device->GetOLPluginVersion(), $this->device->GetOLPluginBuild(), strftime("%Y-%m-%d %H:%M", $this->device->GetOLPluginBuildDate())));
if ($this->IsKoe() && $this->device->GetKoeVersion() !== false) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("KOE: %s / %s / %s", $this->device->GetKoeVersion(), $this->device->GetKoeBuild(), strftime("%Y-%m-%d %H:%M", $this->device->GetKoeBuildDate())));
}
}
......@@ -156,10 +156,10 @@ class DeviceManager {
$this->device->SetASVersion(Request::GetProtocolVersion());
// update data from the OL plugin (if available)
if (Request::HasOLPluginStats()) {
$this->device->SetOLPluginVersion(Request::GetOLPluginVersion());
$this->device->SetOLPluginBuild(Request::GetOLPluginBuild());
$this->device->SetOLPluginBuildDate(Request::GetOLPluginBuildDate());
if (Request::HasKoeStats()) {
$this->device->SetOLPluginVersion(Request::GetKoeVersion());
$this->device->SetOLPluginBuild(Request::GetKoeBuild());
$this->device->SetOLPluginBuildDate(Request::GetKoeBuildDate());
}
// data to be saved
......@@ -491,7 +491,7 @@ class DeviceManager {
}
// ZO-40: add KOE GAB folder
if (KOE_CAPABILITY_GAB && $this->IsOutlookClient() && KOE_GAB_STORE != "" && KOE_GAB_NAME != "") {
if (KOE_CAPABILITY_GAB && $this->IsKoe() && KOE_GAB_STORE != "" && KOE_GAB_NAME != "") {
// if KOE_GAB_FOLDERID is set, use it
if (KOE_GAB_FOLDERID != "") {
$folder = $this->getAdditionalSyncFolder(KOE_GAB_STORE, KOE_GAB_FOLDERID, KOE_GAB_NAME, SYNC_FOLDER_TYPE_USER_APPOINTMENT);
......@@ -751,8 +751,8 @@ class DeviceManager {
* @access public
* @return boolean
*/
public function IsOutlookClient() {
if (Request::GetDeviceType() == "WindowsOutlook" && ($this->device->GetOLPluginVersion() !== false || Request::HasOLPluginStats())) {
public function IsKoe() {
if (Request::IsOutlook() && ($this->device->GetKoeVersion() !== false || Request::HasKoeStats())) {
return true;
}
return false;
......
......@@ -90,7 +90,7 @@ class ImportChangesStream implements IImportChanges {
// KOE ZO-42: to sync Notes to Outlook we sync them as Appointments
if ($this->classAsString == "SyncNote") {
if (KOE_CAPABILITY_NOTES && ZPush::GetDeviceManager()->IsOutlookClient()) {
if (KOE_CAPABILITY_NOTES && ZPush::GetDeviceManager()->IsKoe()) {
// update category from SyncNote->Color
$message->SetCategoryFromColor();
......@@ -117,7 +117,7 @@ class ImportChangesStream implements IImportChanges {
$message = $appointment;
}
else if (Request::GetDeviceType() == "WindowsOutlook") {
else if (Request::IsOutlook()) {
ZLog::Write(LOGLEVEL_WARN, "MS Outlook is synchronizing Notes folder without active KOE settings or extension. Not streaming SyncNote change!");
return false;
}
......@@ -144,8 +144,8 @@ class ImportChangesStream implements IImportChanges {
return $stat;
}
// KOE ZO-3: Stream reply/forward flag and time as additional category to Outlook
if (ZPush::GetDeviceManager()->IsOutlookClient() && KOE_CAPABILITY_RECEIVEFLAGS && isset($message->lastverbexectime) && isset($message->lastverbexecuted) && $message->lastverbexecuted > 0) {
// KOE ZO-3: Stream reply/forward flag and time as additional category to KOE
if (ZPush::GetDeviceManager()->IsKoe() && KOE_CAPABILITY_RECEIVEFLAGS && isset($message->lastverbexectime) && isset($message->lastverbexecuted) && $message->lastverbexecuted > 0) {
ZLog::Write(LOGLEVEL_DEBUG, "ImportChangesStream->ImportMessageChange('%s'): KOE detected. Adding LastVerb information as category.");
if (!isset($message->categories)){
$message->categories = array();
......
......@@ -285,7 +285,7 @@ class Ping extends RequestProcessor {
private function isClassValid($class, $spa) {
if ($class == $spa->GetContentClass() ||
// KOE ZO-42: Notes are synched as Appointments
(self::$deviceManager->IsOutlookClient() && KOE_CAPABILITY_NOTES && $class == "Calendar" && $spa->GetContentClass() == "Notes")
(self::$deviceManager->IsKoe() && KOE_CAPABILITY_NOTES && $class == "Calendar" && $spa->GetContentClass() == "Notes")
) {
return true;
}
......
......@@ -94,9 +94,9 @@ class Request {
static private $occurence; //TODO
static private $saveInSent;
static private $acceptMultipart;
static private $olPluginVersion;
static private $olPluginBuild;
static private $olPluginBuildDate;
static private $koeVersion;
static private $koeBuild;
static private $koeBuildDate;
/**
......@@ -238,9 +238,9 @@ class Request {
if (isset(self::$headers["x-push-plugin"])) {
list($version, $build, $buildDate) = explode("/", self::$headers["x-push-plugin"]);
self::$olPluginVersion = self::filterEvilInput($version, self::NUMBERSDOT_ONLY);
self::$olPluginBuild = self::filterEvilInput($build, self::HEX_ONLY);
self::$olPluginBuildDate = strtotime(self::filterEvilInput($buildDate, self::ISO8601));
self::$koeVersion = self::filterEvilInput($version, self::NUMBERSDOT_ONLY);
self::$koeBuild = self::filterEvilInput($build, self::HEX_ONLY);
self::$koeBuildDate = strtotime(self::filterEvilInput($buildDate, self::ISO8601));
}
if (defined('USE_X_FORWARDED_FOR_HEADER') && USE_X_FORWARDED_FOR_HEADER == true && isset(self::$headers["x-forwarded-for"])) {
......@@ -682,51 +682,61 @@ class Request {
}
/**
* Indicates if the request contained the OL plugin stats header.
* Indicates if the request contained the KOE stats header.
*
* @access public
* @return boolean
*/
static public function HasOLPluginStats() {
return isset(self::$olPluginVersion) && isset(self::$olPluginBuild) && isset(self::$olPluginBuildDate);
static public function HasKoeStats() {
return isset(self::$koeVersion) && isset(self::$koeBuild) && isset(self::$koeBuildDate);
}
/**
* Returns the version number of the OL plugin informed by the stats header.
* Returns the version number of the KOE informed by the stats header.
*
* @access public
* @return string
*/
static public function GetOLPluginVersion() {
if (isset(self::$olPluginVersion))
return self::$olPluginVersion;
static public function GetKoeVersion() {
if (isset(self::$koeVersion))
return self::$koeVersion;
else
return self::UNKNOWN;
}
/**
* Returns the build of the OL plugin informed by the stats header.
* Returns the build of the KOE informed by the stats header.
*
* @access public
* @return string
*/
static public function GetOLPluginBuild() {
if (isset(self::$olPluginBuild))
return self::$olPluginBuild;
static public function GetKoeBuild() {
if (isset(self::$koeBuild))
return self::$koeBuild;
else
return self::UNKNOWN;
}
/**
* Returns the build date of the OL plugin informed by the stats header.
* Returns the build date of the KOE informed by the stats header.
*
* @access public
* @return string
*/
static public function GetOLPluginBuildDate() {
if (isset(self::$olPluginBuildDate))
return self::$olPluginBuildDate;
static public function GetKoeBuildDate() {
if (isset(self::$koeBuildDate))
return self::$koeBuildDate;
else
return self::UNKNOWN;
}
/**
* Returns whether it is an Outlook client.
*
* @access public
* @return boolean
*/
static public function IsOutlook() {
return (self::GetDeviceType() == "WindowsOutlook");
}
}
......@@ -88,7 +88,7 @@ class SendMail extends RequestProcessor {
$sm->saveinsent = Request::GetGETSaveInSent();
}
// KOE ZO-6: grep for the OL header and set flags accordingly.
// KOE ZO-6: grep for the KOE header and set flags accordingly.
// The header has the values verb/message-source-key/folder-source-key
if (KOE_CAPABILITY_SENDFLAGS && preg_match("/X-Push-Flags: (\d{3})\/([\da-f]+)\/([\da-f]+)/i", $sm->mime, $ol_flags)) {
// "reply" and "reply-all" are handled as "reply"
......
......@@ -56,7 +56,7 @@ class Settings extends RequestProcessor {
return false;
// add capability header for KOE
if(self::$deviceManager->IsOutlookClient()) {
if(self::$deviceManager->IsKoe()) {
// define the supported capabilites
$cap = array();
if(KOE_CAPABILITY_GAB) $cap[] = "gab";
......
......@@ -397,7 +397,7 @@ class Sync extends RequestProcessor {
}
// unset filtertype for KOE GAB folder
if (KOE_CAPABILITY_GAB && self::$deviceManager->IsOutlookClient() && $spa->GetBackendFolderId() == self::$deviceManager->GetKoeGabBackendFolderId()) {
if (KOE_CAPABILITY_GAB && self::$deviceManager->IsKoe() && $spa->GetBackendFolderId() == self::$deviceManager->GetKoeGabBackendFolderId()) {
$spa->SetFilterType(SYNC_FILTERTYPE_ALL);
ZLog::Write(LOGLEVEL_DEBUG, "HandleSync(): KOE GAB folder - setting filter type to unlimited");
}
......@@ -474,8 +474,8 @@ class Sync extends RequestProcessor {
$message = ZPush::getSyncObjectFromFolderClass($spa->GetContentClass());
// KOE ZO-42: OL sends Notes as Appointments
if ($spa->GetContentClass() == "Notes" && KOE_CAPABILITY_NOTES && self::$deviceManager->IsOutlookClient()) {
ZLog::Write(LOGLEVEL_DEBUG, "HandleSync(): Outlook sends Notes as Appointments, read as SyncAppointment and convert it into a SyncNote object.");
if ($spa->GetContentClass() == "Notes" && KOE_CAPABILITY_NOTES && self::$deviceManager->IsKoe()) {
ZLog::Write(LOGLEVEL_DEBUG, "HandleSync(): KOE sends Notes as Appointments, read as SyncAppointment and convert it into a SyncNote object.");
$message = new SyncAppointment();
$message->Decode(self::$decoder);
......
......@@ -47,7 +47,7 @@
class SyncNote extends SyncObject {
// Outlook transports note colors as categories
// KOE transports note colors as categories
static private $colors = array(
0 => "Blue Category",
1 => "Green Category",
......
......@@ -862,11 +862,11 @@ class ZPushAdminCLI {
echo "Wiped on:\t\t". ($device->GetWipeActionOn() ? strftime("%Y-%m-%d %H:%M", $device->GetWipeActionOn()) : "not set")."\n";
echo "Policy name:\t\t". ($device->GetPolicyName() ? $device->GetPolicyName() : ASDevice::DEFAULTPOLICYNAME)."\n";
if ($device->GetOLPluginVersion()) {
echo "Kopano OL Plugin:\n";
echo "\tVersion:\t". $device->GetOLPluginVersion() ."\n";
echo "\tBuild:\t\t". $device->GetOLPluginBuild() ."\n";
echo "\tBuild Date:\t". strftime("%Y-%m-%d %H:%M",$device->GetOLPluginBuildDate()) ."\n";
if ($device->GetKoeVersion()) {
echo "Kopano Outlook Extension:\n";
echo "\tVersion:\t". $device->GetKoeVersion() ."\n";
echo "\tBuild:\t\t". $device->GetKoeBuild() ."\n";
echo "\tBuild Date:\t". strftime("%Y-%m-%d %H:%M",$device->GetKoeBuildDate()) ."\n";
}
echo "Attention needed:\t";
......
This diff is collapsed.
<?php
/***********************************************
* File : config.php
* Project : Z-Push - tools - OL GAB sync
* Project : Z-Push - tools - GAB sync
* Descr : Configuration file.
*
* Created : 28.01.2016
*
* Copyright 2016 Zarafa Deutschland GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation with the following additional
* term according to sec. 7:
*
* According to sec. 7 of the GNU Affero General Public License, version 3,
* the terms of the AGPL are supplemented with the following terms:
*
* "Zarafa" is a registered trademark of Zarafa B.V.
* "Z-Push" is a registered trademark of Zarafa Deutschland GmbH
* The licensing of the Program under the AGPL does not imply a trademark license.
* Therefore any rights, title and interest in our trademarks remain entirely with us.
*
* However, if you propagate an unmodified version of the Program you are
* allowed to use the term "Z-Push" to indicate that you distribute the Program.
* Furthermore you may use our trademarks where it is necessary to indicate
* the intended purpose of a product or service provided you use it in accordance
* with honest practices in industrial or commercial matters.
* If you want to propagate modified versions of the Program under the name "Z-Push",
* you may only do so if you have a written permission by Zarafa Deutschland GmbH
* (to acquire a permission please contact Zarafa at trademark@zarafa.com).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Consult LICENSE file for details
* ************************************************/
// The field to be hashed that is unique and never changes
......@@ -15,14 +47,29 @@ define('HASHFIELD', 'account');
define('AMOUNT_OF_CHUNKS', 10);
// SyncWorker implementation to be used
define('SYNCWORKER', 'Zarafa');
define('SYNCWORKER', 'Kopano');
// unique id to find a contact from the GAB (value to be supplied by -u on the command line)
// Zarafa supports: 'account' and 'smtpAddress' (email)
define('UNIQUEID', 'account');
// server connection settings
define('SERVER', 'file:///var/run/zarafa');
// Depending on your setup, it might be advisable to change the lines below to one defined with your
// default socket location.
// Normally "default:" points to the default setting ("file:///var/run/kopano/server.sock")
// Examples: define("SERVER", "default:");
// define("SERVER", "http://localhost:236/kopano");
// define("SERVER", "https://localhost:237/kopano");
// define("SERVER", "file:///var/run/kopano/server.sock";
// If you are using ZCP >= 7.2.0, set it to the zarafa location, e.g.
// define("SERVER", "http://localhost:236/zarafa");
// define("SERVER", "https://localhost:237/zarafa");
// define("SERVER", "file:///var/run/zarafad/server.sock";
// For ZCP versions prior to 7.2.0 the socket location is different (http(s) sockets are the same):
// define("SERVER", "file:///var/run/zarafa";
define('SERVER', 'default:');
define('USERNAME', '');
define('PASSWORD', '');
define('CERTIFICATE', null);
......
<?php
/***********************************************
* File : gab-sync.php
* Project : Z-Push - tools - OL GAB sync
* Project : Z-Push - tools - GAB sync
* Descr : GAB-Sync tool.
*
* Created : 28.01.2016
*
* Copyright 2016 Zarafa Deutschland GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation with the following additional
* term according to sec. 7:
*
* According to sec. 7 of the GNU Affero General Public License, version 3,
* the terms of the AGPL are supplemented with the following terms:
*
* "Zarafa" is a registered trademark of Zarafa B.V.
* "Z-Push" is a registered trademark of Zarafa Deutschland GmbH
* The licensing of the Program under the AGPL does not imply a trademark license.
* Therefore any rights, title and interest in our trademarks remain entirely with us.
*
* However, if you propagate an unmodified version of the Program you are
* allowed to use the term "Z-Push" to indicate that you distribute the Program.
* Furthermore you may use our trademarks where it is necessary to indicate
* the intended purpose of a product or service provided you use it in accordance
* with honest practices in industrial or commercial matters.
* If you want to propagate modified versions of the Program under the name "Z-Push",
* you may only do so if you have a written permission by Zarafa Deutschland GmbH
* (to acquire a permission please contact Zarafa at trademark@zarafa.com).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Consult LICENSE file for details
* ************************************************/
if (!defined('SYNC_CONFIG')) define('SYNC_CONFIG', 'config.php');
......@@ -222,7 +254,7 @@ class GabSyncCLI {
break;
case self::COMMAND_CLEARALL:
echo "Are you sure you want to remove all chunks and data from the public folder. ALL GAB data will be removed from ALL Outlook instances [y/N]: ";
echo "Are you sure you want to remove all chunks and data from the public folder. ALL GAB data will be removed from ALL KOE instances [y/N]: ";
$confirm = strtolower(trim(fgets(STDIN)));
if ( $confirm === 'y' || $confirm === 'yes')
self::$syncWorker->ClearAll();
......@@ -231,7 +263,7 @@ class GabSyncCLI {
break;
case self::COMMAND_DELETEALL:
echo "Are you sure you want to remove all chunks and data from the public folder and delete it? ALL GAB data will be removed from ALL Outlook instances [y/N]: ";
echo "Are you sure you want to remove all chunks and data from the public folder and delete it? ALL GAB data will be removed from ALL KOE instances [y/N]: ";
$confirm = strtolower(trim(fgets(STDIN)));
if ( $confirm === 'y' || $confirm === 'yes')
self::$syncWorker->DeleteAll();
......
<?php
/***********************************************
* File : gabentry.php
* Project : Z-Push - tools - OL GAB sync
* Project : Z-Push - tools - GAB sync
* Descr : Data class for a GAB entry.
*
* Created : 28.01.2016
*
* Copyright 2016 Zarafa Deutschland GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation with the following additional
* term according to sec. 7:
*
* According to sec. 7 of the GNU Affero General Public License, version 3,
* the terms of the AGPL are supplemented with the following terms:
*
* "Zarafa" is a registered trademark of Zarafa B.V.
* "Z-Push" is a registered trademark of Zarafa Deutschland GmbH
* The licensing of the Program under the AGPL does not imply a trademark license.
* Therefore any rights, title and interest in our trademarks remain entirely with us.
*
* However, if you propagate an unmodified version of the Program you are
* allowed to use the term "Z-Push" to indicate that you distribute the Program.
* Furthermore you may use our trademarks where it is necessary to indicate
* the intended purpose of a product or service provided you use it in accordance
* with honest practices in industrial or commercial matters.
* If you want to propagate modified versions of the Program under the name "Z-Push",
* you may only do so if you have a written permission by Zarafa Deutschland GmbH
* (to acquire a permission please contact Zarafa at trademark@zarafa.com).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Consult LICENSE file for details
* ************************************************/
......
<?php
/***********************************************
* File : synchworker.php
* Project : Z-Push - tools - OL GAB sync
* Project : Z-Push - tools - GAB sync
* Descr : Main synchronization class.
*
* Created : 28.01.2016
*
* Copyright 2016 Zarafa Deutschland GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation with the following additional
* term according to sec. 7:
*
* According to sec. 7 of the GNU Affero General Public License, version 3,
* the terms of the AGPL are supplemented with the following terms:
*
* "Zarafa" is a registered trademark of Zarafa B.V.
* "Z-Push" is a registered trademark of Zarafa Deutschland GmbH
* The licensing of the Program under the AGPL does not imply a trademark license.
* Therefore any rights, title and interest in our trademarks remain entirely with us.
*
* However, if you propagate an unmodified version of the Program you are
* allowed to use the term "Z-Push" to indicate that you distribute the Program.
* Furthermore you may use our trademarks where it is necessary to indicate
* the intended purpose of a product or service provided you use it in accordance
* with honest practices in industrial or commercial matters.
* If you want to propagate modified versions of the Program under the name "Z-Push",
* you may only do so if you have a written permission by Zarafa Deutschland GmbH
* (to acquire a permission please contact Zarafa at trademark@zarafa.com).
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Consult LICENSE file for details
* ************************************************/
include_once("gabentry.php");
......
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