Commit 64038d91 authored by mku's avatar mku

ZP-567 #comment Cache store and inbox properties for FolderSync, use folders'...

ZP-567 #comment Cache store and inbox properties for FolderSync, use folders' properties instead of opening them

git-svn-id: https://z-push.org/svn/z-push/trunk@1929 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 22e722d5
......@@ -189,16 +189,13 @@ class PHPWrapper {
/**
* Imports a single folder change
*
* @param mixed $props sourcekey of the changed folder
* @param array $props properties of the changed folder
*
* @access public
* @return
*/
function ImportFolderChange($props) {
$sourcekey = $props[PR_SOURCE_KEY];
$entryid = mapi_msgstore_entryidfromsourcekey($this->store, $sourcekey);
$mapifolder = mapi_msgstore_openentry($this->store, $entryid);
$folder = $this->mapiprovider->GetFolder($mapifolder);
$folder = $this->mapiprovider->GetFolder($props);
// do not import folder if there is something "wrong" with it
if ($folder === false)
......
......@@ -46,6 +46,8 @@ class MAPIProvider {
private $store;
private $zRFC822;
private $addressbook;
private $storeProps;
private $inboxProps;
/**
* Constructor of the MAPI Provider
......@@ -789,18 +791,17 @@ class MAPIProvider {
}
/**
* Reads a folder object from MAPI
* Creates a SyncFolder from MAPI properties.
*
* @param mixed $mapimessage
* @param mixed $folderprops
*
* @access public
* @return SyncFolder
*/
public function GetFolder($mapifolder) {
public function GetFolder($folderprops) {
$folder = new SyncFolder();
$folderprops = mapi_getprops($mapifolder, array(PR_DISPLAY_NAME, PR_PARENT_ENTRYID, PR_SOURCE_KEY, PR_PARENT_SOURCE_KEY, PR_ENTRYID, PR_CONTAINER_CLASS, PR_ATTR_HIDDEN));
$storeprops = mapi_getprops($this->store, array(PR_IPM_SUBTREE_ENTRYID));
$storeprops = $this->getStoreProps();
if(!isset($folderprops[PR_DISPLAY_NAME]) ||
!isset($folderprops[PR_PARENT_ENTRYID]) ||
......@@ -840,9 +841,8 @@ class MAPIProvider {
* @return long
*/
public function GetFolderType($entryid, $class = false) {
$storeprops = mapi_getprops($this->store, array(PR_IPM_OUTBOX_ENTRYID, PR_IPM_WASTEBASKET_ENTRYID, PR_IPM_SENTMAIL_ENTRYID));
$inbox = mapi_msgstore_getreceivefolder($this->store);
$inboxprops = mapi_getprops($inbox, array(PR_ENTRYID, PR_IPM_DRAFTS_ENTRYID, PR_IPM_TASK_ENTRYID, PR_IPM_APPOINTMENT_ENTRYID, PR_IPM_CONTACT_ENTRYID, PR_IPM_NOTE_ENTRYID, PR_IPM_JOURNAL_ENTRYID));
$storeprops = $this->getStoreProps();
$inboxprops = $this->getInboxProps();
if($entryid == $inboxprops[PR_ENTRYID])
return SYNC_FOLDER_TYPE_INBOX;
......@@ -1255,6 +1255,7 @@ class MAPIProvider {
$representingprops = $this->getProps($mapimessage, $p);
if (!isset($representingprops[$appointmentprops["representingentryid"]])) {
// TODO use getStoreProps
$storeProps = mapi_getprops($this->store, array(PR_MAILBOX_OWNER_ENTRYID));
$props[$appointmentprops["representingentryid"]] = $storeProps[PR_MAILBOX_OWNER_ENTRYID];
$displayname = $this->getFullnameFromEntryID($storeProps[PR_MAILBOX_OWNER_ENTRYID]);
......@@ -2628,6 +2629,35 @@ class MAPIProvider {
}
return $this->addressbook;
}
/**
* Gets the required store properties.
*
* @access private
* @return array
*/
private function getStoreProps() {
if (!isset($this->storeProps) || empty($this->storeProps)) {
ZLog::Write(LOGLEVEL_DEBUG, "MAPIProvider->getStoreProps(): Getting store properties.");
$this->storeProps = mapi_getprops($this->store, array(PR_IPM_SUBTREE_ENTRYID, PR_IPM_OUTBOX_ENTRYID, PR_IPM_WASTEBASKET_ENTRYID, PR_IPM_SENTMAIL_ENTRYID, PR_ENTRYID, PR_IPM_PUBLIC_FOLDERS_ENTRYID, PR_IPM_FAVORITES_ENTRYID, PR_MAILBOX_OWNER_ENTRYID));
}
return $this->storeProps;
}
/**
* Gets the required inbox properties.
*
* @access private
* @return array
*/
private function getInboxProps() {
if (!isset($this->inboxProps) || empty($this->inboxProps)) {
ZLog::Write(LOGLEVEL_DEBUG, "MAPIProvider->getInboxProps(): Getting inbox properties.");
$inbox = mapi_msgstore_getreceivefolder($this->store);
$this->inboxProps = mapi_getprops($inbox, array(PR_ENTRYID, PR_IPM_DRAFTS_ENTRYID, PR_IPM_TASK_ENTRYID, PR_IPM_APPOINTMENT_ENTRYID, PR_IPM_CONTACT_ENTRYID, PR_IPM_NOTE_ENTRYID, PR_IPM_JOURNAL_ENTRYID));
}
return $this->inboxProps;
}
}
?>
\ No newline at end of file
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