Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
z-push
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Björn Fischer
z-push
Commits
fbf359bd
Commit
fbf359bd
authored
Dec 23, 2016
by
Manfred Kutas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZP-1128 Do not sync undesired folders.
Released under the Affero GNU General Public License (AGPL) version 3.
parent
e6736c56
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
24 deletions
+45
-24
mapiprovider.php
src/backend/kopano/mapiprovider.php
+45
-24
No files found.
src/backend/kopano/mapiprovider.php
View file @
fbf359bd
...
@@ -31,6 +31,7 @@ class MAPIProvider {
...
@@ -31,6 +31,7 @@ class MAPIProvider {
private
$storeProps
;
private
$storeProps
;
private
$inboxProps
;
private
$inboxProps
;
private
$rootProps
;
private
$rootProps
;
private
$specialFoldersData
;
/**
/**
* Constructor of the MAPI Provider
* Constructor of the MAPI Provider
...
@@ -899,34 +900,13 @@ class MAPIProvider {
...
@@ -899,34 +900,13 @@ class MAPIProvider {
return
false
;
return
false
;
}
}
// ignore certain undesired folders, like "RSS Feeds"
// ignore certain undesired folders, like "RSS Feeds" and "Suggested contacts"
if
(
isset
(
$folderprops
[
PR_CONTAINER_CLASS
])
&&
$folderprops
[
PR_CONTAINER_CLASS
]
==
"IPF.Note.OutlookHomepage"
)
{
if
((
isset
(
$folderprops
[
PR_CONTAINER_CLASS
])
&&
$folderprops
[
PR_CONTAINER_CLASS
]
==
"IPF.Note.OutlookHomepage"
)
||
in_array
(
$folderprops
[
PR_ENTRYID
],
$this
->
getSpecialFoldersData
()))
{
ZLog
::
Write
(
LOGLEVEL_DEBUG
,
sprintf
(
"MAPIProvider->GetFolder(): folder '%s' should not be synchronized"
,
$folderprops
[
PR_DISPLAY_NAME
]));
ZLog
::
Write
(
LOGLEVEL_DEBUG
,
sprintf
(
"MAPIProvider->GetFolder(): folder '%s' should not be synchronized"
,
$folderprops
[
PR_DISPLAY_NAME
]));
return
false
;
return
false
;
}
}
// ignore suggested contacts folder
// The persist data of an entry in PR_IPM_OL2007_ENTRYIDS consists of:
// PersistId - e.g. RSF_PID_SUGGESTED_CONTACTS (2 bytes)
// DataElementsSize - size of DataElements field (2 bytes)
// DataElements - array of PersistElement structures (variable size)
// PersistElement Structure consists of
// ElementID - e.g. RSF_ELID_ENTRYID (2 bytes)
// ElementDataSize - size of ElementData (2 bytes)
// ElementData - The data for the special folder identified by the PersistID (variable size)
$rootProps
=
$this
->
getRootProps
();
if
(
isset
(
$rootProps
[
PR_IPM_OL2007_ENTRYIDS
]))
{
$scPos
=
strpos
(
$rootProps
[
PR_IPM_OL2007_ENTRYIDS
],
RSF_PID_SUGGESTED_CONTACTS
);
// check RSF_ELID_ENTRYID with strpos, in order to avoid unpack or chr hassle
if
(
$scPos
!==
false
&&
strpos
(
substr
(
$rootProps
[
PR_IPM_OL2007_ENTRYIDS
],
$scPos
+
4
,
2
),
RSF_ELID_ENTRYID
)
!==
false
)
{
// size of ElementDataSize is an unsigned short in little endian order
$elDataSize
=
unpack
(
"v"
,
substr
(
$rootProps
[
PR_IPM_OL2007_ENTRYIDS
],
$scPos
+
6
,
2
));
if
(
isset
(
$elDataSize
[
1
])
&&
substr
(
$rootProps
[
PR_IPM_OL2007_ENTRYIDS
],
$scPos
+
8
,
$elDataSize
[
1
])
==
$folderprops
[
PR_ENTRYID
])
{
ZLog
::
Write
(
LOGLEVEL_DEBUG
,
sprintf
(
"MAPIProvider->GetFolder(): folder '%s' should not be synchronized"
,
$folderprops
[
PR_DISPLAY_NAME
]));
}
}
}
$folder
->
BackendId
=
bin2hex
(
$folderprops
[
PR_SOURCE_KEY
]);
$folder
->
BackendId
=
bin2hex
(
$folderprops
[
PR_SOURCE_KEY
]);
$folder
->
serverid
=
ZPush
::
GetDeviceManager
()
->
GetFolderIdForBackendId
(
$folder
->
BackendId
,
true
,
DeviceManager
::
FLD_ORIGIN_USER
,
$folderprops
[
PR_DISPLAY_NAME
]);
$folder
->
serverid
=
ZPush
::
GetDeviceManager
()
->
GetFolderIdForBackendId
(
$folder
->
BackendId
,
true
,
DeviceManager
::
FLD_ORIGIN_USER
,
$folderprops
[
PR_DISPLAY_NAME
]);
if
(
$folderprops
[
PR_PARENT_ENTRYID
]
==
$storeprops
[
PR_IPM_SUBTREE_ENTRYID
])
{
if
(
$folderprops
[
PR_PARENT_ENTRYID
]
==
$storeprops
[
PR_IPM_SUBTREE_ENTRYID
])
{
...
@@ -2868,6 +2848,47 @@ class MAPIProvider {
...
@@ -2868,6 +2848,47 @@ class MAPIProvider {
return
$this
->
rootProps
;
return
$this
->
rootProps
;
}
}
/**
* Returns an array with entryids of some special folders.
*
* @access private
* @return array
*/
private
function
getSpecialFoldersData
()
{
// The persist data of an entry in PR_IPM_OL2007_ENTRYIDS consists of:
// PersistId - e.g. RSF_PID_SUGGESTED_CONTACTS (2 bytes)
// DataElementsSize - size of DataElements field (2 bytes)
// DataElements - array of PersistElement structures (variable size)
// PersistElement Structure consists of
// ElementID - e.g. RSF_ELID_ENTRYID (2 bytes)
// ElementDataSize - size of ElementData (2 bytes)
// ElementData - The data for the special folder identified by the PersistID (variable size)
if
(
empty
(
$this
->
specialFoldersData
))
{
$this
->
specialFoldersData
=
array
();
$rootProps
=
$this
->
getRootProps
();
if
(
isset
(
$rootProps
[
PR_IPM_OL2007_ENTRYIDS
]))
{
$persistData
=
$rootProps
[
PR_IPM_OL2007_ENTRYIDS
];
while
(
strlen
(
$persistData
)
>
0
)
{
// PERSIST_SENTINEL marks the end of the persist data
if
(
strlen
(
$persistData
)
==
4
&&
$persistData
==
PERSIST_SENTINEL
)
{
break
;
}
$unpackedData
=
unpack
(
"vdataSize/velementID/velDataSize"
,
substr
(
$persistData
,
2
,
6
));
if
(
isset
(
$unpackedData
[
'dataSize'
])
&&
isset
(
$unpackedData
[
'elementID'
])
&&
$unpackedData
[
'elementID'
]
==
RSF_ELID_ENTRYID
&&
isset
(
$unpackedData
[
'elDataSize'
]))
{
$this
->
specialFoldersData
[]
=
substr
(
$persistData
,
8
,
$unpackedData
[
'elDataSize'
]);
// Add PersistId and DataElementsSize lenghts to the data size as they're not part of it
$persistData
=
substr
(
$persistData
,
$unpackedData
[
'dataSize'
]
+
4
);
}
else
{
ZLog
::
Write
(
LOGLEVEL_INFO
,
"MAPIProvider->getSpecialFoldersData(): persistent data is not valid"
);
break
;
}
}
}
}
return
$this
->
specialFoldersData
;
}
/**
/**
* Returns categories for a message.
* Returns categories for a message.
*
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment