Commit 19243667 authored by mku's avatar mku

ZP-364 #comment Forwarding an email loses attachments #time 1h

git-svn-id: https://z-push.org/svn/z-push/trunk@1696 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 98957486
...@@ -1402,28 +1402,8 @@ class BackendZarafa implements IBackend, ISearchProvider { ...@@ -1402,28 +1402,8 @@ class BackendZarafa implements IBackend, ISearchProvider {
foreach($rows as $row) { foreach($rows as $row) {
if(isset($row[PR_ATTACH_NUM])) { if(isset($row[PR_ATTACH_NUM])) {
$attach = mapi_message_openattach($fromMessage, $row[PR_ATTACH_NUM]); $attach = mapi_message_openattach($fromMessage, $row[PR_ATTACH_NUM]);
$newattach = mapi_message_createattach($toMessage); $newattach = mapi_message_createattach($toMessage);
mapi_copyto($attach, array(), array(), $newattach, 0);
// Copy all attachments from old to new attachment
$attachprops = mapi_getprops($attach);
mapi_setprops($newattach, $attachprops);
if(isset($attachprops[mapi_prop_tag(PT_ERROR, mapi_prop_id(PR_ATTACH_DATA_BIN))])) {
// Data is in a stream
$srcstream = mapi_openpropertytostream($attach, PR_ATTACH_DATA_BIN);
$dststream = mapi_openpropertytostream($newattach, PR_ATTACH_DATA_BIN, MAPI_MODIFY | MAPI_CREATE);
while(1) {
$data = mapi_stream_read($srcstream, 4096);
if(strlen($data) == 0)
break;
mapi_stream_write($dststream, $data);
}
mapi_stream_commit($dststream);
}
mapi_savechanges($newattach); mapi_savechanges($newattach);
} }
} }
......
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