Commit facac7a3 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #599 in ZP/z-push from AS14.1 to develop

* commit '1b7e5af5': (28 commits)
  ZP-745 Added BodyPartPreference class. Read body part preference from incoming WBXML and save it to content parameters.
  ZP-745 Added body part element to SyncMail.
  ZP-745 Added SyncBaseBodyPart class.
  ZP-748 Save rights management support request value in content parameters in itemoperations, search and sync commands.
  ZP-748 Added rightsManagementLicense property to SyncMail.
  ZP-748 RightsManagement:RightsManagementTemplates might be an empty container.
  ZP-748 Per default return IRM_FeatureDisabled status for RightsManagementTemplates requests.
  ZP-748 Added SyncRightsManagementLicense class.
  ZP-748 Renamed RMOwner to Owner in WBXML definitions.
  ZP-748 Fixed typos in file description.
  ZP-748 Added max length checks for description and name in SyncRightsManagementTemplate.
  ZP-748 Added RightsManagementTemplates handling for Settings in the backends.
  ZP-748 Read incoming RightsManagementInformation request in Settings, added SyncRightsManagement class.
  ZP-748 Renamed ihsManagementInformation to RightsManagementInformation.
  ZP-596 Review WBXML tags and update comments.
  ZP-596 use __construct instead of SyncObject.
  ZP-747 Implemented Accounts and PrimarySmtpAddress in Settings.
  ZP-743 Implement Picture for ResolveRecipients.
  ZP-1121 Output opaque data.
  ZP-743 Typo in zpushdefs.php. It must be SYNC_GAL_STATUS instead of SYNC_GAL_MAXSIZE.
  ...
parents c18d2621 1b7e5af5
......@@ -747,13 +747,15 @@ class BackendCardDAV extends BackendDiff implements ISearchProvider {
/**
* Queries the CardDAV backend
*
* @param string $searchquery string to be searched for
* @param string $searchrange specified searchrange
* @param string $searchquery string to be searched for
* @param string $searchrange specified searchrange
* @param SyncResolveRecipientsPicture $searchpicture limitations for picture
*
* @access public
* @return array search results
* @throws StatusException
*/
public function GetGALSearchResults($searchquery, $searchrange) {
public function GetGALSearchResults($searchquery, $searchrange, $searchpicture) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendCardDAV->GetGALSearchResults(%s, %s)", $searchquery, $searchrange));
if ($this->gal_url !== false && $this->server !== false) {
// Don't search if the length is < 5, we are typing yet
......
......@@ -567,25 +567,26 @@ class BackendCombined extends Backend implements ISearchProvider {
/**
* Queries the LDAP backend
*
* @param string $searchquery string to be searched for
* @param string $searchrange specified searchrange
* @param string $searchquery string to be searched for
* @param string $searchrange specified searchrange
* @param SyncResolveRecipientsPicture $searchpicture limitations for picture
*
* @access public
* @return array search results
* @throws StatusException
*/
public function GetGALSearchResults($searchquery, $searchrange) {
public function GetGALSearchResults($searchquery, $searchrange, $searchpicture) {
ZLog::Write(LOGLEVEL_DEBUG, "Combined->GetGALSearchResults()");
$i = $this->getSearchBackend(ISearchProvider::SEARCH_GAL);
$result = false;
if ($i !== false) {
$result = $this->backends[$i]->GetGALSearchResults($searchquery, $searchrange);
$result = $this->backends[$i]->GetGALSearchResults($searchquery, $searchrange, $searchpicture);
}
return $result;
}
/**
* Searches for the emails on the server
*
......
......@@ -1761,7 +1761,7 @@ class BackendIMAP extends BackendDiff implements ISearchProvider {
/**
* Applies settings to and gets informations from the device
*
* @param SyncObject $settings (SyncOOF or SyncUserInformation possible)
* @param SyncObject $settings (SyncOOF, SyncUserInformation, SyncRightsManagementTemplates possible)
*
* @access public
* @return SyncObject $settings
......@@ -1770,9 +1770,12 @@ class BackendIMAP extends BackendDiff implements ISearchProvider {
if ($settings instanceof SyncOOF) {
$this->settingsOOF($settings);
}
else if ($settings instanceof SyncUserInformation) {
elseif ($settings instanceof SyncUserInformation) {
$this->settingsUserInformation($settings);
}
elseif ($settings instanceof SyncRightsManagementTemplates) {
$settings->Status = SYNC_COMMONSTATUS_IRMFEATUREDISABLED;
}
return $settings;
}
......@@ -1821,13 +1824,15 @@ class BackendIMAP extends BackendDiff implements ISearchProvider {
/**
* Queries the IMAP backend
*
* @param string $searchquery string to be searched for
* @param string $searchrange specified searchrange
* @param string $searchquery string to be searched for
* @param string $searchrange specified searchrange
* @param SyncResolveRecipientsPicture $searchpicture limitations for picture
*
* @access public
* @return array search results
* @throws StatusException
*/
public function GetGALSearchResults($searchquery, $searchrange) {
public function GetGALSearchResults($searchquery, $searchrange, $searchpicture) {
return false;
}
......@@ -2623,7 +2628,17 @@ class BackendIMAP extends BackendDiff implements ISearchProvider {
*/
private function settingsUserInformation(&$userinformation) {
$userinformation->Status = SYNC_SETTINGSSTATUS_USERINFO_SUCCESS;
$userinformation->emailaddresses[] = $this->username;
if (Request::GetProtocolVersion() >= 14.1) {
$account = new SyncAccount();
$emailaddresses = new SyncEmailAddresses();
$emailaddresses->smtpaddress[] = $this->username;
$emailaddresses->primarysmtpaddress = $this->username;
$account->emailaddresses = $emailaddresses;
$userinformation->accounts[] = $account;
}
else {
$userinformation->emailaddresses[] = $this->username;
}
return true;
}
......
......@@ -126,7 +126,7 @@ class BackendKopano implements IBackend, ISearchProvider {
* @return string AS version constant
*/
public function GetSupportedASVersion() {
return ZPush::ASV_14;
return ZPush::ASV_141;
}
/**
......@@ -1074,9 +1074,9 @@ class BackendKopano implements IBackend, ISearchProvider {
}
/**
* Applies settings to and gets informations from the device
* Applies settings to and gets informations from the device.
*
* @param SyncObject $settings (SyncOOF or SyncUserInformation possible)
* @param SyncObject $settings (SyncOOF, SyncUserInformation, SyncRightsManagementTemplates possible)
*
* @access public
* @return SyncObject $settings
......@@ -1090,6 +1090,10 @@ class BackendKopano implements IBackend, ISearchProvider {
$this->settingsUserInformation($settings);
}
if ($settings instanceof SyncRightsManagementTemplates) {
$this->settingsRightsManagementTemplates($settings);
}
return $settings;
}
......@@ -1225,14 +1229,15 @@ class BackendKopano implements IBackend, ISearchProvider {
* Searches the GAB of Kopano
* Can be overwitten globally by configuring a SearchBackend
*
* @param string $searchquery
* @param string $searchrange
* @param string $searchquery string to be searched for
* @param string $searchrange specified searchrange
* @param SyncResolveRecipientsPicture $searchpicture limitations for picture
*
* @access public
* @return array
* @return array search results
* @throws StatusException
*/
public function GetGALSearchResults($searchquery, $searchrange){
public function GetGALSearchResults($searchquery, $searchrange, $searchpicture) {
// only return users whose displayName or the username starts with $name
//TODO: use PR_ANR for this restriction instead of PR_DISPLAY_NAME and PR_ACCOUNT
$addrbook = $this->getAddressbook();
......@@ -1271,7 +1276,7 @@ class BackendKopano implements IBackend, ISearchProvider {
$querylimit = (($rangeend + 1) < $querycnt) ? ($rangeend + 1) : $querycnt;
if ($querycnt > 0)
$abentries = mapi_table_queryrows($table, array(PR_ACCOUNT, PR_DISPLAY_NAME, PR_SMTP_ADDRESS, PR_BUSINESS_TELEPHONE_NUMBER, PR_GIVEN_NAME, PR_SURNAME, PR_MOBILE_TELEPHONE_NUMBER, PR_HOME_TELEPHONE_NUMBER, PR_TITLE, PR_COMPANY_NAME, PR_OFFICE_LOCATION), $rangestart, $querylimit);
$abentries = mapi_table_queryrows($table, array(PR_ENTRYID, PR_ACCOUNT, PR_DISPLAY_NAME, PR_SMTP_ADDRESS, PR_BUSINESS_TELEPHONE_NUMBER, PR_GIVEN_NAME, PR_SURNAME, PR_MOBILE_TELEPHONE_NUMBER, PR_HOME_TELEPHONE_NUMBER, PR_TITLE, PR_COMPANY_NAME, PR_OFFICE_LOCATION, PR_EMS_AB_THUMBNAIL_PHOTO), $rangestart, $querylimit);
for ($i = 0; $i < $querylimit; $i++) {
if (!isset($abentries[$i][PR_SMTP_ADDRESS])) {
......@@ -1316,6 +1321,10 @@ class BackendKopano implements IBackend, ISearchProvider {
if (isset($abentries[$i][PR_OFFICE_LOCATION]))
$items[$i][SYNC_GAL_OFFICE] = w2u($abentries[$i][PR_OFFICE_LOCATION]);
if (isset($abentries[$i][PR_EMS_AB_THUMBNAIL_PHOTO])) {
$items[$i][SYNC_GAL_PICTURE] = StringStreamWrapper::Open($abentries[$i][PR_EMS_AB_THUMBNAIL_PHOTO]);
}
}
$nrResults = count($items);
$items['range'] = ($nrResults > 0) ? $rangestart.'-'.($nrResults - 1) : '0-0';
......@@ -1914,13 +1923,47 @@ class BackendKopano implements IBackend, ISearchProvider {
$user = mapi_zarafa_getuser($this->defaultstore, $this->mainUser);
if ($user != false) {
$userinformation->Status = SYNC_SETTINGSSTATUS_USERINFO_SUCCESS;
$userinformation->emailaddresses[] = $user["emailaddress"];
if (Request::GetProtocolVersion() >= 14.1) {
$account = new SyncAccount();
$emailaddresses = new SyncEmailAddresses();
$emailaddresses->smtpaddress[] = $user["emailaddress"];
$emailaddresses->primarysmtpaddress = $user["emailaddress"];
$account->emailaddresses = $emailaddresses;
$userinformation->accounts[] = $account;
}
else {
$userinformation->emailaddresses[] = $user["emailaddress"];
}
return true;
}
ZLog::Write(LOGLEVEL_ERROR, sprintf("Getting user information failed: mapi_zarafa_getuser(%X)", mapi_last_hresult()));
return false;
}
/**
* Gets the rights management templates from the server.
*
* @param SyncObject $rmTemplates
*
* @access private
* @return void
*/
private function settingsRightsManagementTemplates(&$rmTemplates) {
/* Currently there is no information rights management feature in
* Kopano backend, so just return the status and empty
* SyncRightsManagementTemplates tag.
* Once it's available, it would be something like:
$rmTemplate = new SyncRightsManagementTemplate();
$rmTemplate->id = "some-template-id-eg-guid";
$rmTemplate->name = "Template name";
$rmTemplate->description = "What does the template do. E.g. it disables forward and reply.";
$rmTemplates->rmtemplates[] = $rmTemplate;
*/
$rmTemplates->Status = SYNC_COMMONSTATUS_IRMFEATUREDISABLED;
$rmTemplates->rmtemplates = array();
}
/**
* Sets the importance and priority of a message from a RFC822 message headers.
*
......
......@@ -1218,6 +1218,7 @@ define('PR_EMS_AB_IS_MEMBER_OF_DL' ,mapi_prop_tag(PT_MV_BINAR
define('PR_EMS_AB_OWNER' ,mapi_prop_tag(PT_BINARY, 0x800C));
define('PR_EMS_AB_ROOM_CAPACITY' ,mapi_prop_tag(PT_LONG, 0x0807));
define('PR_EMS_AB_TAGGED_X509_CERT' ,mapi_prop_tag(PT_MV_BINARY, 0x8C6A));
define('PR_EMS_AB_THUMBNAIL_PHOTO' ,mapi_prop_tag(PT_BINARY, 0x8C9E));
define('PR_EC_ARCHIVE_SERVERS' ,mapi_prop_tag(PT_MV_TSTRING, 0x67c4));
......
......@@ -235,6 +235,7 @@ class MAPIMapping {
"reminderset" => "PT_BOOLEAN:PSETID_Common:0x8503",
"remindertime" => "PT_LONG:PSETID_Common:0x8501",
"recurrenceend" => "PT_SYSTIME:PSETID_Appointment:0x8236",
"meetingType" => "PT_LONG:PSETID_Meeting:0x26",
);
}
......
......@@ -709,6 +709,36 @@ class MAPIProvider {
}
}
$message->contentclass = DEFAULT_CALENDAR_CONTENTCLASS;
// MeetingMessageType values
// 0 = A silent update was performed, or the message type is unspecified.
// 1 = Initial meeting request.
// 2 = Full update.
// 3 = Informational update.
// 4 = Outdated. A newer meeting request or meeting update was received after this message.
// 5 = Identifies the delegator's copy of the meeting request.
// 6 = Identifies that the meeting request has been delegated and the meeting request cannot be responded to.
$message->meetingrequest->meetingmessagetype = mtgEmpty;
if (isset($props[$meetingrequestproperties["meetingType"]])) {
switch ($props[$meetingrequestproperties["meetingType"]]) {
case mtgRequest:
$message->meetingrequest->meetingmessagetype = 1;
break;
case mtgFull:
$message->meetingrequest->meetingmessagetype = 2;
break;
case mtgInfo:
$message->meetingrequest->meetingmessagetype = 3;
break;
case mtgOutOfDate:
$message->meetingrequest->meetingmessagetype = 4;
break;
case mtgDelegatorCopy:
$message->meetingrequest->meetingmessagetype = 5;
break;
}
}
}
// Add attachments
......
......@@ -83,15 +83,17 @@ class BackendSearchLDAP implements ISearchProvider {
/**
* Queries the LDAP backend
* Queries the LDAP backend.
*
* @param string $searchquery string to be searched for
* @param string $searchrange specified searchrange
* @param string $searchquery string to be searched for
* @param string $searchrange specified searchrange
* @param SyncResolveRecipientsPicture $searchpicture limitations for picture
*
* @access public
* @return array search results
* @throws StatusException
*/
public function GetGALSearchResults($searchquery, $searchrange) {
public function GetGALSearchResults($searchquery, $searchrange, $searchpicture) {
global $ldap_field_map;
if (isset($this->connection) && $this->connection !== false) {
$searchfilter = str_replace("SEARCHVALUE", $searchquery, LDAP_SEARCH_FILTER);
......
<?php
/***********************************************
* File : bodypartpreference.php
* Project : Z-Push
* Descr : Holds body part preference data
*
* Created : 13.07.2017
*
* Copyright 2017 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.
*
* 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
************************************************/
class BodyPartPreference extends StateObject {
protected $unsetdata = array( 'truncationsize' => false,
'allornone' => false,
'preview' => false,
);
/**
* Expected magic getters and setters.
*
* GetTruncationSize() + SetTruncationSize()
* GetAllOrNone() + SetAllOrNone()
* GetPreview() + SetPreview()
*/
/**
* Indicates if this object has values.
*
* @access public
* @return boolean
*/
public function HasValues() {
return (count($this->data) > 0);
}
}
......@@ -55,13 +55,19 @@ class ContentParameters extends StateObject {
/**
* Overwrite StateObject->__call so we are able to handle ContentParameters->BodyPreference()
* and ContentParameters->BodyPartPreference().
*
* @access public
* @return mixed
*/
public function __call($name, $arguments) {
if ($name === "BodyPreference")
if ($name === "BodyPreference") {
return $this->BodyPreference($arguments[0]);
}
if ($name === "BodyPartPreference") {
return $this->BodyPartPreference($arguments[0]);
}
return parent::__call($name, $arguments);
}
......@@ -90,6 +96,30 @@ class ContentParameters extends StateObject {
}
}
/**
* Instantiates/returns the bodypartpreference object for a type.
*
* @param int $type
*
* @access public
* @return int/boolean returns false if value is not defined
*/
public function BodyPartPreference($type) {
if (!isset($this->bodypartpref)) {
$this->bodypartpref = array();
}
if (isset($this->bodypartpref[$type])) {
return $this->bodypartpref[$type];
}
$asb = new BodyPartPreference();
$arr = (array)$this->bodypartpref;
$arr[$type] = $asb;
$this->bodypartpref = $arr;
return $asb;
}
/**
* Returns available body preference objects
*
......@@ -104,6 +134,20 @@ class ContentParameters extends StateObject {
return array_keys($this->bodypref);
}
/**
* Returns available body part preference objects.
*
* @access public
* @return array/boolean returns false if the client's body preference is not available
*/
public function GetBodyPartPreference() {
if (!isset($this->bodypartpref) || !(is_array($this->bodypartpref) || empty($this->bodypartpref))) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ContentParameters->GetBodyPartPreference(): bodypartpref is empty or not set"));
return false;
}
return array_keys($this->bodypartpref);
}
/**
* Called before the StateObject is serialized
*
......
......@@ -44,6 +44,7 @@ class ZPush {
const ASV_12 = "12.0";
const ASV_121 = "12.1";
const ASV_14 = "14.0";
const ASV_141 = "14.1";
/**
* Command codes for base64 encoded requests (AS >= 12.1)
......@@ -95,7 +96,8 @@ class ZPush {
static private $supportedASVersions = array(
self::ASV_12,
self::ASV_121,
self::ASV_14
self::ASV_14,
self::ASV_141
);
static private $supportedCommands = array(
......
This diff is collapsed.
......@@ -159,7 +159,7 @@ abstract class Backend implements IBackend {
/**
* Applies settings to and gets informations from the device
*
* @param SyncObject $settings (SyncOOF or SyncUserInformation possible)
* @param SyncObject $settings (SyncOOF, SyncUserInformation, SyncRightsManagementTemplates possible)
*
* @access public
* @return SyncObject $settings
......@@ -178,8 +178,24 @@ abstract class Backend implements IBackend {
}
}
if ($settings instanceof SyncUserInformation) {
$settings->emailaddresses = array(ZPush::GetBackend()->GetUserDetails(Request::GetAuthUser())['emailaddress']);
$settings->Status = SYNC_SETTINGSSTATUS_SUCCESS;
if (Request::GetProtocolVersion() >= 14.1) {
$account = new SyncAccount();
$emailaddresses = new SyncEmailAddresses();
$emailaddresses->smtpaddress[] = ZPush::GetBackend()->GetUserDetails(Request::GetAuthUser())['emailaddress'];
$emailaddresses->primarysmtpaddress = ZPush::GetBackend()->GetUserDetails(Request::GetAuthUser())['emailaddress'];
$account->emailaddresses = $emailaddresses;
$userinformation->accounts[] = $account;
}
else {
$userinformation->emailaddresses = array(ZPush::GetBackend()->GetUserDetails(Request::GetAuthUser())['emailaddress']);
}
$settings->emailaddresses = array(ZPush::GetBackend()->GetUserDetails(Request::GetAuthUser())['emailaddress']);
}
if ($settings instanceof SyncRightsManagementTemplates) {
$settings->Status = SYNC_COMMONSTATUS_IRMFEATUREDISABLED;
}
return $settings;
}
......
......@@ -61,14 +61,15 @@ class SearchProvider implements ISearchProvider{
/**
* Searches the GAL
*
* @param string $searchquery string to be searched for
* @param string $searchrange specified searchrange
* @param string $searchquery string to be searched for
* @param string $searchrange specified searchrange
* @param SyncResolveRecipientsPicture $searchpicture limitations for picture
*
* @access public
* @return array search results
* @throws StatusException
*/
public function GetGALSearchResults($searchquery, $searchrange) {
public function GetGALSearchResults($searchquery, $searchrange, $searchpicture) {
return array();
}
......
......@@ -257,7 +257,7 @@ interface IBackend {
/**
* Applies settings to and gets informations from the device
*
* @param SyncObject $settings (SyncOOF or SyncUserInformation possible)
* @param SyncObject $settings (SyncOOF, SyncUserInformation, SyncRightsManagementTemplates possible)
*
* @access public
* @return SyncObject $settings
......
......@@ -47,16 +47,17 @@ interface ISearchProvider {
public function SupportsType($searchtype);
/**
* Searches the GAL
* Searches the GAL.
*
* @param string $searchquery
* @param string $searchrange
* @param string $searchquery string to be searched for
* @param string $searchrange specified searchrange
* @param SyncResolveRecipientsPicture $searchpicture limitations for picture
*
* @access public
* @return array
* @return array search results
* @throws StatusException
*/
public function GetGALSearchResults($searchquery, $searchrange);
public function GetGALSearchResults($searchquery, $searchrange, $searchpicture);
/**
* Searches for the emails on the server
......
......@@ -151,6 +151,37 @@ class ItemOperations extends RequestProcessor {
return false;//SYNC_AIRSYNCBASE_BODYPREFERENCE
}
if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_BODYPARTPREFERENCE)) {
if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TYPE)) {
$bpptype = self::$decoder->getElementContent();
$operation["cpo"]->BodyPartPreference($bpptype);
if (!self::$decoder->getElementEndTag()) {
return false;
}
}
if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TRUNCATIONSIZE)) {
$operation["cpo"]->BodyPartPreference($bpptype)->SetTruncationSize(self::$decoder->getElementContent());
if(!self::$decoder->getElementEndTag())
return false;
}
if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_ALLORNONE)) {
$operation["cpo"]->BodyPartPreference($bpptype)->SetAllOrNone(self::$decoder->getElementContent());
if(!self::$decoder->getElementEndTag())
return false;
}
if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_PREVIEW)) {
$operation["cpo"]->BodyPartPreference($bpptype)->SetPreview(self::$decoder->getElementContent());
if(!self::$decoder->getElementEndTag())
return false;
}
if (!self::$decoder->getElementEndTag())
return false;
}
if(self::$decoder->getElementStartTag(SYNC_MIMESUPPORT)) {
$operation["cpo"]->SetMimeSupport(self::$decoder->getElementContent());
if(!self::$decoder->getElementEndTag())
......@@ -177,6 +208,12 @@ class ItemOperations extends RequestProcessor {
}
}
if(self::$decoder->getElementStartTag(SYNC_RIGHTSMANAGEMENT_SUPPORT)) {
$operation["cpo"]->SetRmSupport(self::$decoder->getElementContent());
if(!self::$decoder->getElementEndTag())
return false;
}
//break if it reached the endtag
$e = self::$decoder->peek();
if($e[EN_TYPE] == EN_TYPE_ENDTAG) {
......@@ -185,6 +222,16 @@ class ItemOperations extends RequestProcessor {
}
}
}
if (self::$decoder->getElementStartTag(SYNC_RIGHTSMANAGEMENT_REMOVERIGHTSMGNTPROTECTION)) {
$operation["cpo"]->SetRemoveRmProtection(true);
if (($rrmp = self::$decoder->getElementContent()) !== false) {
$operation["cpo"]->SetRemoveRmProtection($rrmp);
if(!self::$decoder->getElementEndTag()) {
return false;
}
}
}
} // end if fetch
if ($efc) {
......
......@@ -35,6 +35,7 @@ class Search extends RequestProcessor {
*/
public function Handle($commandCode) {
$searchrange = '0';
$searchpicture = new SyncResolveRecipientsPicture();
$cpo = new ContentParameters();
if(!self::$decoder->getElementStartTag(SYNC_SEARCH_SEARCH))
......@@ -246,6 +247,64 @@ class Search extends RequestProcessor {
return false;
}
if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_BODYPARTPREFERENCE)) {
if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TYPE)) {
$bpptype = self::$decoder->getElementContent();
$cpo->BodyPartPreference($bpptype);
if (!self::$decoder->getElementEndTag()) {
return false;
}
}
if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TRUNCATIONSIZE)) {
$cpo->BodyPartPreference($bpptype)->SetTruncationSize(self::$decoder->getElementContent());
if(!self::$decoder->getElementEndTag())
return false;
}
if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_ALLORNONE)) {
$cpo->BodyPartPreference($bpptype)->SetAllOrNone(self::$decoder->getElementContent());
if(!self::$decoder->getElementEndTag())
return false;
}
if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_PREVIEW)) {
$cpo->BodyPartPreference($bpptype)->SetPreview(self::$decoder->getElementContent());
if(!self::$decoder->getElementEndTag())
return false;
}
if (!self::$decoder->getElementEndTag())
return false;
}
if(self::$decoder->getElementStartTag(SYNC_RIGHTSMANAGEMENT_SUPPORT)) {
$cpo->SetRmSupport(self::$decoder->getElementContent());
if(!self::$decoder->getElementEndTag())
return false;
}
if(self::$decoder->getElementStartTag(SYNC_SEARCH_PICTURE)) { // TODO - do something with maxsize and maxpictures in the backend
if(self::$decoder->getElementStartTag(SYNC_SEARCH_MAXSIZE)) {
$searchpicture->maxsize = self::$decoder->getElementContent();
if(!self::$decoder->getElementEndTag())
return false;
}
if(self::$decoder->getElementStartTag(SYNC_SEARCH_MAXPICTURES)) {
$searchpicture->maxpictures = self::$decoder->getElementContent();
if(!self::$decoder->getElementEndTag())
return false;
}
// iOs devices send empty picture tag: <Search:Picture/>
$e = self::$decoder->peek();
if($e[EN_TYPE] == EN_TYPE_ENDTAG) {
if(!self::$decoder->getElementEndTag()) // SYNC_SEARCH_PICTURE
return false;
}
}
$e = self::$decoder->peek();
if($e[EN_TYPE] == EN_TYPE_ENDTAG) {
self::$decoder->getElementEndTag();
......@@ -270,7 +329,7 @@ class Search extends RequestProcessor {
try {
if ($searchname == ISearchProvider::SEARCH_GAL) {
//get search results from the searchprovider
$rows = $searchprovider->GetGALSearchResults($searchquery, $searchrange);
$rows = $searchprovider->GetGALSearchResults($searchquery, $searchrange, $searchpicture);
}
elseif ($searchname == ISearchProvider::SEARCH_MAILBOX) {
$backendFolderId = self::$deviceManager->GetBackendIdForFolderId($cpo->GetSearchFolderid());
......@@ -380,6 +439,19 @@ class Search extends RequestProcessor {
self::$encoder->content((isset($u[SYNC_GAL_EMAILADDRESS]))?$u[SYNC_GAL_EMAILADDRESS]:"");
self::$encoder->endTag();
if (isset($u[SYNC_GAL_PICTURE])) {
self::$encoder->startTag(SYNC_GAL_PICTURE);
self::$encoder->startTag(SYNC_GAL_STATUS);
self::$encoder->content(SYNC_SEARCHSTATUS_PICTURE_SUCCESS); //FIXME: status code
self::$encoder->endTag(); // SYNC_SEARCH_STATUS
self::$encoder->startTag(SYNC_GAL_DATA);
self::$encoder->contentStream($u[SYNC_GAL_PICTURE], false, true);
self::$encoder->endTag(); // SYNC_GAL_DATA
self::$encoder->endTag(); // SYNC_GAL_PICTURE
}
self::$encoder->endTag();//result
self::$encoder->endTag();//properties
}
......
......@@ -86,6 +86,9 @@ class Settings extends RequestProcessor {
if (self::$decoder->getElementStartTag(SYNC_SETTINGS_USERINFORMATION)) {
$propertyName = SYNC_SETTINGS_USERINFORMATION;
}
if (self::$decoder->getElementStartTag(SYNC_SETTINGS_RIGHTSMANAGEMENTINFORMATION)) {
$propertyName = SYNC_SETTINGS_RIGHTSMANAGEMENTINFORMATION;
}
//TODO - check if it is necessary
//no property name available - break
if (!$propertyName)
......@@ -93,7 +96,7 @@ class Settings extends RequestProcessor {
//the property name is followed by either get or set
if (self::$decoder->getElementStartTag(SYNC_SETTINGS_GET)) {
//get is only available for OOF and user information
//get is available for OOF (AS 12), user information (AS 12) and rights management (AS 14.1)
switch ($propertyName) {
case SYNC_SETTINGS_OOF:
$oofGet = new SyncOOF();
......@@ -106,6 +109,10 @@ class Settings extends RequestProcessor {
$userInformation = new SyncUserInformation();
break;
case SYNC_SETTINGS_RIGHTSMANAGEMENTINFORMATION:
$rmTemplates = new SyncRightsManagementTemplates();
break;
default:
//TODO: a special status code needed?
ZLog::Write(LOGLEVEL_WARN, sprintf ("This property ('%s') is not allowed to use get in request", $propertyName));
......@@ -201,6 +208,20 @@ class Settings extends RequestProcessor {
self::$encoder->endTag(); //SYNC_SETTINGS_USERINFORMATION
}
// get rights management templates
if (isset($rmTemplates)) {
self::$backend->Settings($rmTemplates);
self::$encoder->startTag(SYNC_SETTINGS_RIGHTSMANAGEMENTINFORMATION);
self::$encoder->startTag(SYNC_SETTINGS_STATUS);
self::$encoder->content($rmTemplates->Status);
self::$encoder->endTag(); //SYNC_SETTINGS_STATUS
self::$encoder->startTag(SYNC_SETTINGS_GET);
$rmTemplates->Encode(self::$encoder);
self::$encoder->endTag(); //SYNC_SETTINGS_GET
self::$encoder->endTag(); //SYNC_SETTINGS_RIGHTSMANAGEMENTINFORMATION
}
//set out of office
if (isset($oofSet)) {
$oofSet = self::$backend->Settings($oofSet);
......
......@@ -369,6 +369,43 @@ class Sync extends RequestProcessor {
return false;
}
if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_BODYPARTPREFERENCE)) {
if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TYPE)) {
$bpptype = self::$decoder->getElementContent();
$spa->BodyPartPreference($bpptype);
if (!self::$decoder->getElementEndTag()) {
return false;
}
}
if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_TRUNCATIONSIZE)) {
$spa->BodyPartPreference($bpptype)->SetTruncationSize(self::$decoder->getElementContent());
if(!self::$decoder->getElementEndTag())
return false;
}
if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_ALLORNONE)) {
$spa->BodyPartPreference($bpptype)->SetAllOrNone(self::$decoder->getElementContent());
if(!self::$decoder->getElementEndTag())
return false;
}
if (self::$decoder->getElementStartTag(SYNC_AIRSYNCBASE_PREVIEW)) {
$spa->BodyPartPreference($bpptype)->SetPreview(self::$decoder->getElementContent());
if(!self::$decoder->getElementEndTag())
return false;
}
if (!self::$decoder->getElementEndTag())
return false;
}
if (self::$decoder->getElementStartTag(SYNC_RIGHTSMANAGEMENT_SUPPORT)) {
$spa->SetRmSupport(self::$decoder->getElementContent());
if (!self::$decoder->getElementEndTag())
return false;
}
$e = self::$decoder->peek();
if($e[EN_TYPE] == EN_TYPE_ENDTAG) {
self::$decoder->getElementEndTag();
......
<?php
/***********************************************
* File : syncaccount.php
* Project : Z-Push
* Descr : WBXML account entities that can be
* parsed directly (as a stream) from WBXML.
* It is automatically decoded
* according to $mapping,
* and the Sync WBXML mappings
*
* Created : 18.05.2017
*
* Copyright 2017 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.
*
* 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
************************************************/
class SyncAccount extends SyncObject {
public $accountid;
public $accountname;
public $userdisplayname;
public $senddisabled;
public $emailaddresses;
public function __construct() {
$mapping = array (
SYNC_SETTINGS_ACCOUNTID => array ( self::STREAMER_VAR => "accountid"),
SYNC_SETTINGS_ACCOUNTNAME => array ( self::STREAMER_VAR => "accountname"),
SYNC_SETTINGS_USERDISPLAYNAME => array ( self::STREAMER_VAR => "userdisplayname"),
SYNC_SETTINGS_SENDDISABLED => array ( self::STREAMER_VAR => "senddisabled"),
SYNC_SETTINGS_EMAILADDRESSES => array ( self::STREAMER_VAR => "emailaddresses",
self::STREAMER_TYPE => "SyncEmailAddresses")
);
parent::__construct($mapping);
}
}
\ No newline at end of file
......@@ -61,6 +61,9 @@ class SyncAppointment extends SyncObject {
public $responsetype;
public $responserequested;
// AS 14.1 props
public $onlineMeetingConfLink;
public $onlineMeetingExternalLink;
function __construct() {
$mapping = array(
......@@ -211,6 +214,13 @@ class SyncAppointment extends SyncObject {
self::STREAMER_RONOTIFY => true);
}
if(Request::GetProtocolVersion() >= 14.1) {
$mapping[SYNC_POOMCAL_ONLINEMEETINGCONFLINK] = array ( self::STREAMER_VAR => "onlineMeetingConfLink",
self::STREAMER_RONOTIFY => true);
$mapping[SYNC_POOMCAL_ONLINEMEETINGEXTERNALLINK] = array ( self::STREAMER_VAR => "onlineMeetingExternalLink",
self::STREAMER_RONOTIFY => true);
}
parent::__construct($mapping);
// Indicates that this SyncObject supports the private flag and stripping of private data.
......
<?php
/***********************************************
* File : syncbasebodypart.php
* Project : Z-Push
* Descr : WBXML AirSyncBase body part entities that can be parsed
* directly (as a stream) from WBXML.
* It is automatically decoded according to $mapping,
* and the Sync WBXML mappings.
*
* Created : 11.07.2017
*
* Copyright 2017 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.
*
* 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
************************************************/
class SyncBaseBodyPart extends SyncObject {
public $status;
public $type; // Should be html (2)
public $estimatedDataSize;
public $truncated;
public $data;
public $preview;
function __construct() {
$mapping = array(
SYNC_AIRSYNCBASE_STATUS => array ( self::STREAMER_VAR => "status"),
SYNC_AIRSYNCBASE_TYPE => array ( self::STREAMER_VAR => "type"),
SYNC_AIRSYNCBASE_ESTIMATEDDATASIZE => array ( self::STREAMER_VAR => "estimatedDataSize",
self::STREAMER_PRIVATE => 0), // when stripping private we remove the body, so the size needs to be 0
SYNC_AIRSYNCBASE_TRUNCATED => array ( self::STREAMER_VAR => "truncated"),
SYNC_AIRSYNCBASE_DATA => array ( self::STREAMER_VAR => "data",
self::STREAMER_TYPE => self::STREAMER_TYPE_STREAM_ASPLAIN,
self::STREAMER_PROP => self::STREAMER_TYPE_MULTIPART,
self::STREAMER_RONOTIFY => true,
self::STREAMER_PRIVATE => true), // just remove the body when stripping private
SYNC_AIRSYNCBASE_PREVIEW => array ( self::STREAMER_VAR => "preview",
self::STREAMER_PRIVATE => true)
);
parent::__construct($mapping);
// Indicates that this SyncObject supports the private flag and stripping of private data.
$this->supportsPrivateStripping = true;
}
}
<?php
/***********************************************
* File : syncemailaddresses.php
* Project : Z-Push
* Descr : WBXML email adresses entities that can be
* parsed directly (as a stream) from WBXML.
* It is automatically decoded
* according to $mapping,
* and the Sync WBXML mappings
*
* Created : 18.05.2017
*
* Copyright 2017 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.
*
* 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
************************************************/
class SyncEmailAddresses extends SyncObject {
public $smtpaddress;
public $primarysmtpaddress;
public function __construct() {
$mapping = array (
SYNC_SETTINGS_SMPTADDRESS => array ( self::STREAMER_VAR => "smtpaddress",
self::STREAMER_PROP => self::STREAMER_TYPE_NO_CONTAINER,
self::STREAMER_ARRAY => SYNC_SETTINGS_SMPTADDRESS),
SYNC_SETTINGS_PRIMARYSMTPADDRESS => array ( self::STREAMER_VAR => "primarysmtpaddress"));
parent::__construct($mapping);
}
}
\ No newline at end of file
......@@ -69,6 +69,10 @@ class SyncMail extends SyncObject {
public $sender;
public $categories;
// AS 14.1 props
public $rightsManagementLicense;
public $asbodypart;
function __construct() {
$mapping = array (
SYNC_POOMMAIL_TO => array ( self::STREAMER_VAR => "to",
......@@ -182,7 +186,14 @@ class SyncMail extends SyncObject {
$mapping[SYNC_POOMMAIL_CATEGORIES] = array ( self::STREAMER_VAR => "categories",
self::STREAMER_ARRAY => SYNC_POOMMAIL_CATEGORY,
self::STREAMER_RONOTIFY => true);
//TODO bodypart, accountid, rightsmanagementlicense
//TODO bodypart, accountid
}
if (Request::GetProtocolVersion() >= 14.1) {
$mapping[SYNC_RIGHTSMANAGEMENT_LICENSE] = array ( self::STREAMER_VAR => "rightsManagementLicense",
self::STREAMER_TYPE => "SyncRightsManagementLicense");
$mapping[SYNC_AIRSYNCBASE_BODYPART] = array ( self::STREAMER_VAR => "asbodypart",
self::STREAMER_TYPE => "SyncBaseBodyPart");
}
parent::__construct($mapping);
......
......@@ -43,6 +43,7 @@ class SyncMeetingRequest extends SyncObject {
public $busystatus;
public $timezone;
public $globalobjid;
public $meetingmessagetype;
public $disallownewtimeproposal;
function __construct() {
......@@ -112,11 +113,27 @@ class SyncMeetingRequest extends SyncObject {
);
if (Request::GetProtocolVersion() >= 14.0) {
$mapping[SYNC_POOMMAIL_DISALLOWNEWTIMEPROPOSAL] = array ( self::STREAMER_VAR => "disallownewtimeproposal",
if (Request::GetProtocolVersion() >= 14.0) {
$mapping[SYNC_POOMMAIL_DISALLOWNEWTIMEPROPOSAL] = array ( self::STREAMER_VAR => "disallownewtimeproposal",
self::STREAMER_CHECKS => array( self::STREAMER_CHECK_REQUIRED => self::STREAMER_CHECK_SETZERO,
self::STREAMER_CHECK_ONEVALUEOF => array(0,1) ));
}
}
if (Request::GetProtocolVersion() >= 14.1) {
// MeetingMessageType values
// 0 = A silent update was performed, or the message type is unspecified.
// 1 = Initial meeting request.
// 2 = Full update.
// 3 = Informational update.
// 4 = Outdated. A newer meeting request or meeting update was received after this message.
// 5 = Identifies the delegator's copy of the meeting request.
// 6 = Identifies that the meeting request has been delegated and the meeting request cannot be responded to.
$mapping[SYNC_POOMMAIL2_MEETINGMESSAGETYPE] = array ( self::STREAMER_VAR => "meetingmessagetype",
self::STREAMER_CHECKS => array( self::STREAMER_CHECK_REQUIRED => self::STREAMER_CHECK_SETZERO,
self::STREAMER_CHECK_ONEVALUEOF => array(0,1,2,3,4,5,6) ));
}
parent::__construct($mapping);
}
}
......@@ -38,6 +38,7 @@ class SyncRecurrence extends SyncObject {
public $weekofmonth;
public $monthofyear;
public $calendartype;
public $firstdayofweek;
function __construct() {
$mapping = array (
......@@ -109,6 +110,21 @@ class SyncRecurrence extends SyncObject {
self::STREAMER_RONOTIFY => true);
}
if(Request::GetProtocolVersion() >= 14.1) {
// First day of the calendar week for recurrence.
// FirstDayOfWeek values:
// 0 = Sunday
// 1 = Monday
// 2 = Tuesday
// 3 = Wednesday
// 4 = Thursday
// 5 = Friday
// 6 = Saturday
$mapping[SYNC_POOMCAL_FIRSTDAYOFWEEK] = array ( self::STREAMER_VAR => "firstdayofweek",
self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1,2,3,4,5,6) ),
self::STREAMER_RONOTIFY => true);
}
parent::__construct($mapping);
// Indicates that this SyncObject supports the private flag and stripping of private data.
......
<?php
/***********************************************
* File : syncrightsmanagementlicense.php
* Project : Z-Push
* Descr : WBXML rights management license entities
* that can be parsed directly (as a stream)
* from WBXML.
* It is automatically decoded
* according to $mapping,
* and the Sync WBXML mappings
*
* Created : 26.06.2017
*
* Copyright 2017 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.
*
* 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
************************************************/
class SyncRightsManagementLicense extends SyncObject {
public $contentExpiryDate;
public $contentOwner;
public $editAllowed;
public $exportAllowed;
public $extractAllowed;
public $forwardAllowed;
public $modifyRecipientsAllowed;
public $owner;
public $printAllowed;
public $programmaticAccessAllowed;
public $replyAllAllowed;
public $replyAllowed;
public $description;
public $id;
public $name;
public function __construct() {
$mapping = array (
SYNC_RIGHTSMANAGEMENT_CONTENTEXPIRYDATE => array ( self::STREAMER_VAR => "contentExpiryDate",
self::STREAMER_TYPE => self::STREAMER_TYPE_DATE),
SYNC_RIGHTSMANAGEMENT_CONTENTOWNER => array ( self::STREAMER_VAR => "contentOwner",
self::STREAMER_CHECKS => array( self::STREAMER_CHECK_LENGTHMAX => 320 )),
SYNC_RIGHTSMANAGEMENT_EDITALLOWED => array ( self::STREAMER_VAR => "editAllowed",
self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )),
SYNC_RIGHTSMANAGEMENT_EXPORTALLOWED => array ( self::STREAMER_VAR => "exportAllowed",
self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )),
SYNC_RIGHTSMANAGEMENT_EXTRACTALLOWED => array ( self::STREAMER_VAR => "extractAllowed",
self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )),
SYNC_RIGHTSMANAGEMENT_FORWARDALLOWED => array ( self::STREAMER_VAR => "forwardAllowed",
self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )),
SYNC_RIGHTSMANAGEMENT_MODIFYRECIPIENTSALLOWED => array ( self::STREAMER_VAR => "modifyRecipientsAllowed",
self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )),
SYNC_RIGHTSMANAGEMENT_OWNER => array ( self::STREAMER_VAR => "owner",
self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )),
SYNC_RIGHTSMANAGEMENT_PRINTALLOWED => array ( self::STREAMER_VAR => "printAllowed",
self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )),
SYNC_RIGHTSMANAGEMENT_PROGRAMMATICACCESSALLOWED => array ( self::STREAMER_VAR => "programmaticAccessAllowed",
self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )),
SYNC_RIGHTSMANAGEMENT_REPLYALLALLOWED => array ( self::STREAMER_VAR => "replyAllAllowed",
self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )),
SYNC_RIGHTSMANAGEMENT_REPLYALLOWED => array ( self::STREAMER_VAR => "replyAllowed",
self::STREAMER_CHECKS => array( self::STREAMER_CHECK_ONEVALUEOF => array(0,1) )),
SYNC_RIGHTSMANAGEMENT_TEMPLATEDESCRIPTION => array ( self::STREAMER_VAR => "description",
self::STREAMER_CHECKS => array( self::STREAMER_CHECK_LENGTHMAX => 10240 )),
SYNC_RIGHTSMANAGEMENT_TEMPLATEID => array ( self::STREAMER_VAR => "id"),
SYNC_RIGHTSMANAGEMENT_TEMPLATENAME => array ( self::STREAMER_VAR => "name",
self::STREAMER_CHECKS => array( self::STREAMER_CHECK_LENGTHMAX => 256 )),
);
parent::__construct($mapping);
}
}
\ No newline at end of file
<?php
/***********************************************
* File : syncrightsmanagementtemplate.php
* Project : Z-Push
* Descr : WBXML rights management template entities
* that can be parsed directly (as a stream)
* from WBXML.
* It is automatically decoded
* according to $mapping,
* and the Sync WBXML mappings
*
* Created : 16.06.2017
*
* Copyright 2017 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.
*
* 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
************************************************/
class SyncRightsManagementTemplate extends SyncObject {
public $description;
public $id;
public $name;
public function __construct() {
$mapping = array (
SYNC_RIGHTSMANAGEMENT_TEMPLATEDESCRIPTION => array ( self::STREAMER_VAR => "description",
self::STREAMER_CHECKS => array( self::STREAMER_CHECK_LENGTHMAX => 10240 )),
SYNC_RIGHTSMANAGEMENT_TEMPLATEID => array ( self::STREAMER_VAR => "id"),
SYNC_RIGHTSMANAGEMENT_TEMPLATENAME => array ( self::STREAMER_VAR => "name",
self::STREAMER_CHECKS => array( self::STREAMER_CHECK_LENGTHMAX => 256 )),
);
parent::__construct($mapping);
}
}
\ No newline at end of file
<?php
/***********************************************
* File : syncrightsmanagementtemplates.php
* Project : Z-Push
* Descr : WBXML rights management templates entities
* that can be parsed directly (as a stream)
* from WBXML.
* It is automatically decoded
* according to $mapping,
* and the Sync WBXML mappings
*
* Created : 15.06.2017
*
* Copyright 2017 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.
*
* 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
************************************************/
class SyncRightsManagementTemplates extends SyncObject {
public $rmtemplates;
public $Status;
public function __construct() {
$mapping = array (
SYNC_RIGHTSMANAGEMENT_TEMPLATES => array ( self::STREAMER_VAR => "rmtemplates",
self::STREAMER_TYPE => "SyncRigtsManagementTemplate",
self::STREAMER_ARRAY => SYNC_RIGHTSMANAGEMENT_TEMPLATE,
self::STREAMER_PROP => self::STREAMER_TYPE_SEND_EMPTY),
SYNC_SETTINGS_PROP_STATUS => array ( self::STREAMER_VAR => "Status",
self::STREAMER_TYPE => self::STREAMER_TYPE_IGNORE)
);
parent::__construct($mapping);
}
}
\ No newline at end of file
......@@ -2,7 +2,7 @@
/***********************************************
* File : syncuserinformation.php
* Project : Z-Push
* Descr : WBXML appointment entities that can be
* Descr : WBXML user information entities that can be
* parsed directly (as a stream) from WBXML.
* It is automatically decoded
* according to $mapping,
......@@ -28,30 +28,26 @@
************************************************/
class SyncUserInformation extends SyncObject {
public $accountid;
public $accountname;
public $userdisplayname;
public $senddisabled;
public $emailaddresses;
public $accounts;
public $Status;
public function __construct() {
$mapping = array (
SYNC_SETTINGS_ACCOUNTID => array ( self::STREAMER_VAR => "accountid"),
SYNC_SETTINGS_ACCOUNTNAME => array ( self::STREAMER_VAR => "accountname"),
SYNC_SETTINGS_EMAILADDRESSES => array ( self::STREAMER_VAR => "emailaddresses",
self::STREAMER_ARRAY => SYNC_SETTINGS_SMPTADDRESS),
$mapping = array(SYNC_SETTINGS_PROP_STATUS => array ( self::STREAMER_VAR => "Status",
self::STREAMER_TYPE => self::STREAMER_TYPE_IGNORE));
SYNC_SETTINGS_PROP_STATUS => array ( self::STREAMER_VAR => "Status",
self::STREAMER_TYPE => self::STREAMER_TYPE_IGNORE)
);
if (Request::GetProtocolVersion() >= 12.1) {
$mapping[SYNC_SETTINGS_USERDISPLAYNAME] = array ( self::STREAMER_VAR => "userdisplayname");
// In AS protocoll versions 12.0, 12.1 and 14.0 EmailAddresses element is child of Get in UserSettings
// Since AS protocoll version 14.1 EmailAddresses element is child of Account element of Get in UserSettings
if (Request::GetProtocolVersion() >= 12.0) {
$mapping[SYNC_SETTINGS_EMAILADDRESSES] = array ( self::STREAMER_VAR => "emailaddresses",
self::STREAMER_ARRAY => SYNC_SETTINGS_SMPTADDRESS);
}
if (Request::GetProtocolVersion() >= 14.0) {
$mapping[SYNC_SETTINGS_SENDDISABLED] = array ( self::STREAMER_VAR => "senddisabled");
if (Request::GetProtocolVersion() >= 14.1) {
unset($mapping[SYNC_SETTINGS_EMAILADDRESSES]);
$mapping[SYNC_SETTINGS_ACCOUNTS] = array ( self::STREAMER_VAR => "accounts",
self::STREAMER_TYPE => "SyncAccount",
self::STREAMER_ARRAY => SYNC_SETTINGS_ACCOUNT);
}
parent::__construct($mapping);
......
This diff is collapsed.
......@@ -162,20 +162,22 @@ class WBXMLEncoder extends WBXMLDefs {
*
* @param resource $stream
* @param boolean $asBase64 if true, the data will be encoded as base64, default: false
* @param boolean $opaque if true, output the opaque data, default: false
*
* @access public
* @return
*/
public function contentStream($stream, $asBase64 = false) {
if (!$asBase64) {
public function contentStream($stream, $asBase64 = false, $opaque = false) {
// Do not append filters to opaque data as it might contain null char
if (!$asBase64 && !$opaque) {
stream_filter_register('replacenullchar', 'ReplaceNullcharFilter');
$rnc_filter = stream_filter_append($stream, 'replacenullchar');
}
$this->_outputStack();
$this->_contentStream($stream, $asBase64);
$this->_contentStream($stream, $asBase64, $opaque);
if (!$asBase64) {
if (!$asBase64 && !$opaque) {
stream_filter_remove($rnc_filter);
}
......@@ -286,9 +288,17 @@ class WBXMLEncoder extends WBXMLDefs {
* @param boolean $asBase64
* @return
*/
private function _contentStream($stream, $asBase64) {
private function _contentStream($stream, $asBase64, $opaque) {
$stat = fstat($stream);
// write full stream, including the finalizing terminator to the output stream (stuff outTermStr() would do)
$this->outByte(self::WBXML_STR_I);
if ($opaque) {
$this->outByte(self::WBXML_OPAQUE);
$this->outMBUInt($stat['size']);
}
else {
$this->outByte(self::WBXML_STR_I);
}
if ($asBase64) {
$out_filter = stream_filter_append($this->_out, 'convert.base64-encode');
}
......@@ -296,11 +306,12 @@ class WBXMLEncoder extends WBXMLDefs {
if ($asBase64) {
stream_filter_remove($out_filter);
}
fwrite($this->_out, chr(0));
if (!$opaque) {
fwrite($this->_out, chr(0));
}
if ($this->log) {
// data is out, do some logging
$stat = fstat($stream);
$this->logContent(sprintf("<<< written %d of %d bytes of %s data >>>", $written, $stat['size'], $asBase64 ? "base64 encoded":"plain"));
}
}
......@@ -330,24 +341,39 @@ class WBXMLEncoder extends WBXMLDefs {
}
/**
* Outputs a string table
* Output the multibyte integers to the stream.
*
* A multi-byte integer consists of a series of octets,
* where the most significant bit is the continuation flag
* and the remaining seven bits are a scalar value.
* The octets are arranged in a big-endian order,
* eg, the most significant seven bits are transmitted first.
*
* @param $uint
* @see https://www.w3.org/1999/06/NOTE-wbxml-19990624/#_Toc443384895
*
* @param int $uint
*
* @access private
* @return
* @return void
*/
private function outMBUInt($uint) {
while(1) {
if ($uint == 0x0) {
return $this->outByte($uint);
}
$out = '';
for ($i = 0; $uint != 0; $i++) {
$byte = $uint & 0x7f;
$uint = $uint >> 7;
if($uint == 0) {
$this->outByte($byte);
break;
} else {
$this->outByte($byte | 0x80);
if ($i == 0) {
$out = chr($byte) . $out;
}
else {
$out = chr($byte | 0x80) . $out;
}
}
fwrite($this->_out, $out);
}
/**
......
......@@ -33,6 +33,7 @@ return array(
'BackendZarafa' => $baseDir . '/backend/kopano/kopano.php',
'BaseException' => $baseDir . '/backend/kopano/mapi/class.baseexception.php',
'BaseRecurrence' => $baseDir . '/backend/kopano/mapi/class.baserecurrence.php',
'BodyPartPreference' => $baseDir . '/lib/core/bodypartpreference.php',
'BodyPreference' => $baseDir . '/lib/core/bodypreference.php',
'CalDAVClient' => $baseDir . '/include/z_caldav.php',
'CalendarInfo' => $baseDir . '/include/z_caldav.php',
......@@ -127,16 +128,19 @@ return array(
'Streamer' => $baseDir . '/lib/core/streamer.php',
'StringStreamWrapper' => $baseDir . '/lib/utils/stringstreamwrapper.php',
'Sync' => $baseDir . '/lib/request/sync.php',
'SyncAccount' => $baseDir . '/lib/syncobjects/syncaccount.php',
'SyncAppointment' => $baseDir . '/lib/syncobjects/syncappointment.php',
'SyncAppointmentException' => $baseDir . '/lib/syncobjects/syncappointmentexception.php',
'SyncAttachment' => $baseDir . '/lib/syncobjects/syncattachment.php',
'SyncAttendee' => $baseDir . '/lib/syncobjects/syncattendee.php',
'SyncBaseAttachment' => $baseDir . '/lib/syncobjects/syncbaseattachment.php',
'SyncBaseBody' => $baseDir . '/lib/syncobjects/syncbasebody.php',
'SyncBaseBodyPart' => $baseDir . '/lib/syncobjects/syncbasebodypart.php',
'SyncCollections' => $baseDir . '/lib/core/synccollections.php',
'SyncContact' => $baseDir . '/lib/syncobjects/synccontact.php',
'SyncDeviceInformation' => $baseDir . '/lib/syncobjects/syncdeviceinformation.php',
'SyncDevicePassword' => $baseDir . '/lib/syncobjects/syncdevicepassword.php',
'SyncEmailAddresses' => $baseDir . '/lib/syncobjects/syncemailaddresses.php',
'SyncFolder' => $baseDir . '/lib/syncobjects/syncfolder.php',
'SyncItemOperationsAttachment' => $baseDir . '/lib/syncobjects/syncitemoperationsattachment.php',
'SyncMail' => $baseDir . '/lib/syncobjects/syncmail.php',
......@@ -158,6 +162,9 @@ return array(
'SyncResolveRecipientsOptions' => $baseDir . '/lib/syncobjects/syncresolverecipientsoptions.php',
'SyncResolveRecipientsPicture' => $baseDir . '/lib/syncobjects/syncresolverecipientspicture.php',
'SyncResolveRecipientsResponse' => $baseDir . '/lib/syncobjects/syncresolverecipientsresponse.php',
'SyncRightsManagementLicense' => $baseDir . '/lib/syncobjects/syncrightsmanagementlicense.php',
'SyncRightsManagementTemplate' => $baseDir . '/lib/syncobjects/syncrightsmanagementtemplate.php',
'SyncRightsManagementTemplates' => $baseDir . '/lib/syncobjects/syncrightsmanagementtemplates.php',
'SyncSendMail' => $baseDir . '/lib/syncobjects/syncsendmail.php',
'SyncSendMailSource' => $baseDir . '/lib/syncobjects/syncsendmailsource.php',
'SyncTask' => $baseDir . '/lib/syncobjects/synctask.php',
......
......@@ -40,6 +40,7 @@ class ComposerStaticInitd6749fc2fb9944bbe86b2b7d79a7852f
'BackendZarafa' => __DIR__ . '/../..' . '/backend/kopano/kopano.php',
'BaseException' => __DIR__ . '/../..' . '/backend/kopano/mapi/class.baseexception.php',
'BaseRecurrence' => __DIR__ . '/../..' . '/backend/kopano/mapi/class.baserecurrence.php',
'BodyPartPreference' => __DIR__ . '/../..' . '/lib/core/bodypartpreference.php',
'BodyPreference' => __DIR__ . '/../..' . '/lib/core/bodypreference.php',
'CalDAVClient' => __DIR__ . '/../..' . '/include/z_caldav.php',
'CalendarInfo' => __DIR__ . '/../..' . '/include/z_caldav.php',
......@@ -134,16 +135,19 @@ class ComposerStaticInitd6749fc2fb9944bbe86b2b7d79a7852f
'Streamer' => __DIR__ . '/../..' . '/lib/core/streamer.php',
'StringStreamWrapper' => __DIR__ . '/../..' . '/lib/utils/stringstreamwrapper.php',
'Sync' => __DIR__ . '/../..' . '/lib/request/sync.php',
'SyncAccount' => __DIR__ . '/../..' . '/lib/syncobjects/syncaccount.php',
'SyncAppointment' => __DIR__ . '/../..' . '/lib/syncobjects/syncappointment.php',
'SyncAppointmentException' => __DIR__ . '/../..' . '/lib/syncobjects/syncappointmentexception.php',
'SyncAttachment' => __DIR__ . '/../..' . '/lib/syncobjects/syncattachment.php',
'SyncAttendee' => __DIR__ . '/../..' . '/lib/syncobjects/syncattendee.php',
'SyncBaseAttachment' => __DIR__ . '/../..' . '/lib/syncobjects/syncbaseattachment.php',
'SyncBaseBody' => __DIR__ . '/../..' . '/lib/syncobjects/syncbasebody.php',
'SyncBaseBodyPart' => __DIR__ . '/../..' . '/lib/syncobjects/syncbasebodypart.php',
'SyncCollections' => __DIR__ . '/../..' . '/lib/core/synccollections.php',
'SyncContact' => __DIR__ . '/../..' . '/lib/syncobjects/synccontact.php',
'SyncDeviceInformation' => __DIR__ . '/../..' . '/lib/syncobjects/syncdeviceinformation.php',
'SyncDevicePassword' => __DIR__ . '/../..' . '/lib/syncobjects/syncdevicepassword.php',
'SyncEmailAddresses' => __DIR__ . '/../..' . '/lib/syncobjects/syncemailaddresses.php',
'SyncFolder' => __DIR__ . '/../..' . '/lib/syncobjects/syncfolder.php',
'SyncItemOperationsAttachment' => __DIR__ . '/../..' . '/lib/syncobjects/syncitemoperationsattachment.php',
'SyncMail' => __DIR__ . '/../..' . '/lib/syncobjects/syncmail.php',
......@@ -165,6 +169,9 @@ class ComposerStaticInitd6749fc2fb9944bbe86b2b7d79a7852f
'SyncResolveRecipientsOptions' => __DIR__ . '/../..' . '/lib/syncobjects/syncresolverecipientsoptions.php',
'SyncResolveRecipientsPicture' => __DIR__ . '/../..' . '/lib/syncobjects/syncresolverecipientspicture.php',
'SyncResolveRecipientsResponse' => __DIR__ . '/../..' . '/lib/syncobjects/syncresolverecipientsresponse.php',
'SyncRightsManagementLicense' => __DIR__ . '/../..' . '/lib/syncobjects/syncrightsmanagementlicense.php',
'SyncRightsManagementTemplate' => __DIR__ . '/../..' . '/lib/syncobjects/syncrightsmanagementtemplate.php',
'SyncRightsManagementTemplates' => __DIR__ . '/../..' . '/lib/syncobjects/syncrightsmanagementtemplates.php',
'SyncSendMail' => __DIR__ . '/../..' . '/lib/syncobjects/syncsendmail.php',
'SyncSendMailSource' => __DIR__ . '/../..' . '/lib/syncobjects/syncsendmailsource.php',
'SyncTask' => __DIR__ . '/../..' . '/lib/syncobjects/synctask.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