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
6a48f14e
Commit
6a48f14e
authored
Sep 14, 2015
by
Sebastian Kummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZP-707 Initial implementation. Needs fixing.
Released under the Affero GNU General Public License (AGPL) version 3.
parent
897be774
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
mapiprovider.php
src/backend/zarafa/mapiprovider.php
+17
-10
No files found.
src/backend/zarafa/mapiprovider.php
View file @
6a48f14e
...
@@ -798,7 +798,8 @@ class MAPIProvider {
...
@@ -798,7 +798,8 @@ class MAPIProvider {
ZLog
::
Write
(
LOGLEVEL_DEBUG
,
"Attach the transport message headers to a signed message"
);
ZLog
::
Write
(
LOGLEVEL_DEBUG
,
"Attach the transport message headers to a signed message"
);
$transportHeaders
=
array
(
PR_TRANSPORT_MESSAGE_HEADERS_W
);
$transportHeaders
=
array
(
PR_TRANSPORT_MESSAGE_HEADERS_W
);
$messageHeaders
=
$this
->
getProps
(
$mapimessage
,
$transportHeaders
);
$messageHeaders
=
$this
->
getProps
(
$mapimessage
,
$transportHeaders
);
$message
->
asbody
->
data
=
$messageHeaders
[
PR_TRANSPORT_MESSAGE_HEADERS
]
.
"
\r\n\r\n
"
.
$message
->
asbody
->
data
;
// TODO fix, this is ugly as f*ck! Use a prepend filter?
$message
->
asbody
->
data
=
StringStreamWrapper
::
Open
(
$messageHeaders
[
PR_TRANSPORT_MESSAGE_HEADERS
]
.
"
\r\n\r\n
"
.
stream_get_contents
(
$message
->
asbody
->
data
));
}
}
return
$message
;
return
$message
;
...
@@ -2349,11 +2350,12 @@ class MAPIProvider {
...
@@ -2349,11 +2350,12 @@ class MAPIProvider {
$message
->
asbody
=
new
SyncBaseBody
();
$message
->
asbody
=
new
SyncBaseBody
();
$message
->
asbody
->
type
=
$bpReturnType
;
$message
->
asbody
->
type
=
$bpReturnType
;
if
(
$bpReturnType
==
SYNC_BODYPREFERENCE_RTF
)
if
(
$bpReturnType
==
SYNC_BODYPREFERENCE_RTF
)
$message
->
asbody
->
data
=
base64_encode
(
$body
);
$message
->
asbody
->
data
=
StringStreamWrapper
::
Open
(
base64_encode
(
$body
)
);
elseif
(
isset
(
$message
->
internetcpid
)
&&
$bpReturnType
==
SYNC_BODYPREFERENCE_HTML
)
elseif
(
isset
(
$message
->
internetcpid
)
&&
$bpReturnType
==
SYNC_BODYPREFERENCE_HTML
)
$message
->
asbody
->
data
=
Utils
::
ConvertCodepageStringToUtf8
(
$message
->
internetcpid
,
$body
);
$message
->
asbody
->
data
=
StringStreamWrapper
::
Open
(
Utils
::
ConvertCodepageStringToUtf8
(
$message
->
internetcpid
,
$body
)
);
else
else
$message
->
asbody
->
data
=
w2u
(
$body
);
$message
->
asbody
->
data
=
StringStreamWrapper
::
Open
(
$body
);
// TODO fix
$message
->
asbody
->
estimatedDataSize
=
strlen
(
$message
->
asbody
->
data
);
$message
->
asbody
->
estimatedDataSize
=
strlen
(
$message
->
asbody
->
data
);
}
}
else
{
else
{
...
@@ -2401,8 +2403,7 @@ class MAPIProvider {
...
@@ -2401,8 +2403,7 @@ class MAPIProvider {
if
(
Request
::
GetProtocolVersion
()
>=
12.0
)
{
if
(
Request
::
GetProtocolVersion
()
>=
12.0
)
{
if
(
!
isset
(
$message
->
asbody
))
if
(
!
isset
(
$message
->
asbody
))
$message
->
asbody
=
new
SyncBaseBody
();
$message
->
asbody
=
new
SyncBaseBody
();
//TODO data should be wrapped in a MapiStreamWrapper
$message
->
asbody
->
data
=
MapiStreamWrapper
::
Open
(
$stream
);
$message
->
asbody
->
data
=
mapi_stream_read
(
$stream
,
$streamsize
);
$message
->
asbody
->
estimatedDataSize
=
$streamsize
;
$message
->
asbody
->
estimatedDataSize
=
$streamsize
;
$message
->
asbody
->
truncated
=
0
;
$message
->
asbody
->
truncated
=
0
;
}
}
...
@@ -2451,7 +2452,12 @@ class MAPIProvider {
...
@@ -2451,7 +2452,12 @@ class MAPIProvider {
$message
->
asbody
->
estimatedDataSize
>
$bpo
->
GetTruncationSize
()
&&
$message
->
asbody
->
estimatedDataSize
>
$bpo
->
GetTruncationSize
()
&&
$contentparameters
->
GetTruncation
()
!=
SYNC_TRUNCATION_ALL
// do not truncate message if the whole is requested, e.g. on fetch
$contentparameters
->
GetTruncation
()
!=
SYNC_TRUNCATION_ALL
// do not truncate message if the whole is requested, e.g. on fetch
)
{
)
{
$message
->
asbody
->
data
=
Utils
::
Utf8_truncate
(
$message
->
asbody
->
data
,
$bpo
->
GetTruncationSize
());
// read the data from the stream, 10 bytes more than requested
// TODO this should be done better! We could give another parameter (length) to the Stream wrappers so they truncate automatically after X bytes.
$dataChunk
=
fread
(
$message
->
asbody
->
data
,
$bpo
->
GetTruncationSize
()
+
10
);
$dataTruncated
=
Utils
::
Utf8_truncate
(
$dataChunk
,
$bpo
->
GetTruncationSize
());
$message
->
asbody
->
data
=
StringStreamWrapper
::
Open
(
$dataTruncated
);
$message
->
asbody
->
truncated
=
1
;
$message
->
asbody
->
truncated
=
1
;
}
}
...
@@ -2610,15 +2616,16 @@ class MAPIProvider {
...
@@ -2610,15 +2616,16 @@ class MAPIProvider {
* @return void
* @return void
*/
*/
private
function
setASbody
(
$asbody
,
&
$props
,
$appointmentprops
)
{
private
function
setASbody
(
$asbody
,
&
$props
,
$appointmentprops
)
{
if
(
isset
(
$asbody
->
type
)
&&
isset
(
$asbody
->
data
)
&&
strlen
(
$asbody
->
data
)
>
0
)
{
// TODO: fix checking for the length
if
(
isset
(
$asbody
->
type
)
&&
isset
(
$asbody
->
data
)
/*&& strlen($asbody->data) > 0*/
)
{
switch
(
$asbody
->
type
)
{
switch
(
$asbody
->
type
)
{
case
SYNC_BODYPREFERENCE_PLAIN
:
case
SYNC_BODYPREFERENCE_PLAIN
:
default
:
default
:
//set plain body if the type is not in valid range
//set plain body if the type is not in valid range
$props
[
$appointmentprops
[
"body"
]]
=
u2w
(
$asbody
->
data
);
$props
[
$appointmentprops
[
"body"
]]
=
stream_get_contents
(
$asbody
->
data
);
break
;
break
;
case
SYNC_BODYPREFERENCE_HTML
:
case
SYNC_BODYPREFERENCE_HTML
:
$props
[
$appointmentprops
[
"html"
]]
=
u2w
(
$asbody
->
data
);
$props
[
$appointmentprops
[
"html"
]]
=
stream_get_contents
(
$asbody
->
data
);
break
;
break
;
case
SYNC_BODYPREFERENCE_RTF
:
case
SYNC_BODYPREFERENCE_RTF
:
break
;
break
;
...
...
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