Commit 04482f97 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #18 in ZO/z-push from...

Merge pull request #18 in ZO/z-push from feature/ZO-41-z-push-define-configuration-options to develop

* commit 'ad13c0e7':
  ZO-41 Added config options for KOE, use options to enable features in the code, send features GAB folder name in the settings headers.
parents c010c476 ad13c0e7
...@@ -280,6 +280,33 @@ ...@@ -280,6 +280,33 @@
// might result in timeout. Default is 10. // might result in timeout. Default is 10.
define('SEARCH_MAXRESULTS', 10); define('SEARCH_MAXRESULTS', 10);
/**********************************************************************************
* Kopano Outlook Plugin - Settings
*
* The Kopano Outlook Extension (KOE) provides MS Outlook 2013 and newer with
* functionality not provided by ActiveSync or not implemented by Outlook.
* For more information, see: https://wiki.z-hub.io/x/z4Aa
*/
// Global Address Book functionality
define('KOE_CAPABILITY_GAB', true);
// Synchronize mail flags from the server to Outlook/KOE
define('KOE_CAPABILITY_RECEIVEFLAGS', true);
// Encode flags when sending from Outlook/KOE
define('KOE_CAPABILITY_SENDFLAGS', true);
// Out-of-office support
define('KOE_CAPABILITY_OOF', true);
// Out-of-office support with start & end times (superseeds KOE_CAPABILITY_OOF)
define('KOE_CAPABILITY_OOFTIMES', true);
// Notes support
define('KOE_CAPABILITY_NOTES', true);
// To synchronize the GAB, the GAB store and folderid need to be specified.
// Use the gab-sync script to generate the GAB information. The name needs to
// match the config of the gab-sync script. The folderid is informed by the script.
// TODO use defines
// define('KOE_GAB_STORE', 'SYSTEM');
// define('KOE_GAB_FOLDERID', '');
define('KOE_GAB_NAME', 'Z-Push-KOE-GAB');
/********************************************************************************** /**********************************************************************************
* Synchronize additional folders to all mobiles * Synchronize additional folders to all mobiles
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Created : 01.10.2007 * Created : 01.10.2007
* *
* Copyright 2007 - 2013 Zarafa Deutschland GmbH * Copyright 2007 - 2016 Zarafa Deutschland GmbH
* *
* This program is free software: you can redistribute it and/or modify * 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, * it under the terms of the GNU Affero General Public License, version 3,
...@@ -89,7 +89,7 @@ class ImportChangesStream implements IImportChanges { ...@@ -89,7 +89,7 @@ class ImportChangesStream implements IImportChanges {
} }
// KOP ZO-42: to sync Notes to Outlook we sync them as Appointments // KOP ZO-42: to sync Notes to Outlook we sync them as Appointments
if ($this->classAsString == "SyncNote" && ZPush::GetDeviceManager()->IsOutlookClient()) { if (KOE_CAPABILITY_NOTES && $this->classAsString == "SyncNote" && ZPush::GetDeviceManager()->IsOutlookClient()) {
// update category from SyncNote->Color // update category from SyncNote->Color
$message->SetCategoryFromColor(); $message->SetCategoryFromColor();
...@@ -139,8 +139,8 @@ class ImportChangesStream implements IImportChanges { ...@@ -139,8 +139,8 @@ class ImportChangesStream implements IImportChanges {
} }
// KOP ZO-3: Stream reply/forward flag and time as additional category to Outlook // KOP ZO-3: Stream reply/forward flag and time as additional category to Outlook
if (ZPush::GetDeviceManager()->IsOutlookClient() && isset($message->lastverbexectime) && isset($message->lastverbexecuted) && $message->lastverbexecuted > 0) { if (ZPush::GetDeviceManager()->IsOutlookClient() && KOE_CAPABILITY_RECEIVEFLAGS && isset($message->lastverbexectime) && isset($message->lastverbexecuted) && $message->lastverbexecuted > 0) {
ZLog::Write(LOGLEVEL_DEBUG, "ImportChangesStream->ImportMessageChange('%s'): Outlook client detected. Adding LastVerb information as category."); ZLog::Write(LOGLEVEL_DEBUG, "ImportChangesStream->ImportMessageChange('%s'): KOE detected. Adding LastVerb information as category.");
if (!isset($message->categories)){ if (!isset($message->categories)){
$message->categories = array(); $message->categories = array();
} }
......
...@@ -341,6 +341,26 @@ class ZPush { ...@@ -341,6 +341,26 @@ class ZPush {
throw new FatalMisconfigurationException("The PING_HIGHER_BOUND_LIFETIME value must be greater or equal to PING_LOWER_BOUND_LIFETIME."); throw new FatalMisconfigurationException("The PING_HIGHER_BOUND_LIFETIME value must be greater or equal to PING_LOWER_BOUND_LIFETIME.");
} }
// Check KOE flags
if (!defined('KOE_CAPABILITY_GAB')) {
define('KOE_CAPABILITY_GAB', false);
}
if (!defined('KOE_CAPABILITY_RECEIVEFLAGS')) {
define('KOE_CAPABILITY_RECEIVEFLAGS', false);
}
if (!defined('KOE_CAPABILITY_SENDFLAGS')) {
define('KOE_CAPABILITY_SENDFLAGS', false);
}
if (!defined('KOE_CAPABILITY_OOF')) {
define('KOE_CAPABILITY_OOF', false);
}
if (!defined('KOE_CAPABILITY_OOFTIMES')) {
define('KOE_CAPABILITY_OOFTIMES', false);
}
if (!defined('KOE_CAPABILITY_NOTES')) {
define('KOE_CAPABILITY_NOTES', false);
}
// the check on additional folders will not throw hard errors, as this is probably changed on live systems // the check on additional folders will not throw hard errors, as this is probably changed on live systems
if (isset($additionalFolders) && !is_array($additionalFolders)) if (isset($additionalFolders) && !is_array($additionalFolders))
ZLog::Write(LOGLEVEL_ERROR, "ZPush::CheckConfig() : The additional folders synchronization not available as array."); ZLog::Write(LOGLEVEL_ERROR, "ZPush::CheckConfig() : The additional folders synchronization not available as array.");
......
...@@ -285,7 +285,7 @@ class Ping extends RequestProcessor { ...@@ -285,7 +285,7 @@ class Ping extends RequestProcessor {
private function isClassValid($class, $spa) { private function isClassValid($class, $spa) {
if ($class == $spa->GetContentClass() || if ($class == $spa->GetContentClass() ||
// KOP ZO-42: Notes are synched as Appointments // KOP ZO-42: Notes are synched as Appointments
(self::$deviceManager->IsOutlookClient() && $class == "Calendar" && $spa->GetContentClass() == "Notes") (self::$deviceManager->IsOutlookClient() && KOE_CAPABILITY_NOTES && $class == "Calendar" && $spa->GetContentClass() == "Notes")
) { ) {
return true; return true;
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Created : 16.02.2012 * Created : 16.02.2012
* *
* Copyright 2007 - 2013 Zarafa Deutschland GmbH * Copyright 2007 - 2013, 2016 Zarafa Deutschland GmbH
* *
* This program is free software: you can redistribute it and/or modify * 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, * it under the terms of the GNU Affero General Public License, version 3,
...@@ -90,7 +90,7 @@ class SendMail extends RequestProcessor { ...@@ -90,7 +90,7 @@ class SendMail extends RequestProcessor {
// KOP ZO-6: grep for the OL header and set flags accordingly. // KOP ZO-6: grep for the OL header and set flags accordingly.
// The header has the values verb/message-source-key/folder-source-key // The header has the values verb/message-source-key/folder-source-key
if (preg_match("/X-Push-Flags: (\d{3})\/([\da-f]+)\/([\da-f]+)/i", $sm->mime, $ol_flags)) { 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" // "reply" and "reply-all" are handled as "reply"
if ($ol_flags[1] == 102 || $ol_flags[1] == 103) { if ($ol_flags[1] == 102 || $ol_flags[1] == 103) {
$reply = true; $reply = true;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Created : 16.02.2012 * Created : 16.02.2012
* *
* Copyright 2007 - 2013 Zarafa Deutschland GmbH * Copyright 2007 - 2016 Zarafa Deutschland GmbH
* *
* This program is free software: you can redistribute it and/or modify * 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, * it under the terms of the GNU Affero General Public License, version 3,
...@@ -55,12 +55,20 @@ class Settings extends RequestProcessor { ...@@ -55,12 +55,20 @@ class Settings extends RequestProcessor {
if (!self::$decoder->getElementStartTag(SYNC_SETTINGS_SETTINGS)) if (!self::$decoder->getElementStartTag(SYNC_SETTINGS_SETTINGS))
return false; return false;
// add capability header for OL client // add capability header for KOE
if(self::$deviceManager->IsOutlookClient()) { if(self::$deviceManager->IsOutlookClient()) {
// define the supported capabilites
$cap = array();
if(KOE_CAPABILITY_GAB) $cap[] = "gab";
if(KOE_CAPABILITY_RECEIVEFLAGS) $cap[] = "receiveflags";
if(KOE_CAPABILITY_SENDFLAGS) $cap[] = "sendflags";
if(KOE_CAPABILITY_OOFTIMES) $cap[] = "ooftime";
else if(KOE_CAPABILITY_OOF) $cap[] = "oof"; // 'ooftime' superseeds 'oof'. If 'ooftime' is set, 'oof' should not be defined.
if(KOE_CAPABILITY_NOTES) $cap[] = "notes";
self::$specialHeaders = array(); self::$specialHeaders = array();
// TODO these values need to be configurable, ZO-41 self::$specialHeaders[] = "X-Push-Capabilities: ". implode(",",$cap);
self::$specialHeaders[] = "X-Push-Capabilities: gab,receiveflags,sendflags,ooftime,recover,notes"; // "oof" removed as "ooftime" superseeds it self::$specialHeaders[] = "X-Push-GAB-Name: ". bin2hex(KOE_GAB_NAME);
self::$specialHeaders[] = "X-Push-GAB-Name: Z-Push-KOB-GAB";
} }
//save the request parameters //save the request parameters
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Created : 16.02.2012 * Created : 16.02.2012
* *
* Copyright 2007 - 2015 Zarafa Deutschland GmbH * Copyright 2007 - 2016 Zarafa Deutschland GmbH
* *
* This program is free software: you can redistribute it and/or modify * 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, * it under the terms of the GNU Affero General Public License, version 3,
...@@ -468,7 +468,7 @@ class Sync extends RequestProcessor { ...@@ -468,7 +468,7 @@ class Sync extends RequestProcessor {
$message = ZPush::getSyncObjectFromFolderClass($spa->GetContentClass()); $message = ZPush::getSyncObjectFromFolderClass($spa->GetContentClass());
// KOP ZO-42: OL sends Notes as Appointments // KOP ZO-42: OL sends Notes as Appointments
if ($spa->GetContentClass() == "Notes" && self::$deviceManager->IsOutlookClient()) { 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."); ZLog::Write(LOGLEVEL_DEBUG, "HandleSync(): Outlook sends Notes as Appointments, read as SyncAppointment and convert it into a SyncNote object.");
$message = new SyncAppointment(); $message = new SyncAppointment();
$message->Decode(self::$decoder); $message->Decode(self::$decoder);
......
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