Commit 766866f1 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #82 in ZP/z-push from...

Merge pull request #82 in ZP/z-push from bugfix/ZP-738-verify-previous-fixes-to-display-signed to develop

* commit 'b856384a':
  ZP-738 Remove uneccessary previous fixes to display signed messages correctly.
parents 0c1c79c0 b856384a
......@@ -515,8 +515,10 @@ class MAPIProvider {
private function getEmail($mapimessage, $contentparameters) {
// This workaround fixes ZP-729 and still works with Outlook.
// FIXME: It should be properly fixed when refactoring.
$bpReturnType = Utils::GetBodyPreferenceBestMatch($contentparameters->GetBodyPreference());
if (($contentparameters->GetMimeSupport() == SYNC_MIMESUPPORT_NEVER) ||
($key = array_search(SYNC_BODYPREFERENCE_MIME, $contentparameters->GetBodyPreference()) === false)) {
($key = array_search(SYNC_BODYPREFERENCE_MIME, $contentparameters->GetBodyPreference()) === false) ||
$bpReturnType != SYNC_BODYPREFERENCE_MIME) {
MAPIUtils::ParseSmime($this->session, $this->store, $this->getAddressbook(), $mapimessage);
}
......@@ -807,18 +809,6 @@ class MAPIProvider {
$message->lastverbexecuted = Utils::GetLastVerbExecuted($message->lastverbexecuted);
}
// OL 2013 doesn't show sender and subject for signed emails because the headers are missing
if(isset($message->messageclass) && strpos($message->messageclass, "IPM.Note.SMIME.MultipartSigned") === 0 &&
isset($message->asbody->type) && $message->asbody->type == SYNC_BODYPREFERENCE_MIME) {
$transportHeaders = array(PR_TRANSPORT_MESSAGE_HEADERS_W);
$messageHeaders = $this->getProps($mapimessage, $transportHeaders);
if (isset($messageHeaders[PR_TRANSPORT_MESSAGE_HEADERS]) && $messageHeaders[PR_TRANSPORT_MESSAGE_HEADERS]) {
ZLog::Write(LOGLEVEL_DEBUG, "Prepend the transport message headers to a signed message");
// the retrieved data already contains headers, so we just prepend the transport headers here
$message->asbody->data = $messageHeaders[PR_TRANSPORT_MESSAGE_HEADERS] . $message->asbody->data;
}
}
return $message;
}
......@@ -2393,50 +2383,35 @@ class MAPIProvider {
* @return boolean
*/
private function imtoinet($mapimessage, &$message) {
// if it is a signed message get a full attachment generated by ZCP
$props = mapi_getprops($mapimessage, array(PR_MESSAGE_CLASS, PR_TRANSPORT_MESSAGE_HEADERS_W));
if (isset($props[PR_MESSAGE_CLASS]) && $props[PR_MESSAGE_CLASS] && strpos(strtolower($props[PR_MESSAGE_CLASS]), 'multipartsigned') &&
isset($props[PR_TRANSPORT_MESSAGE_HEADERS]) && $props[PR_TRANSPORT_MESSAGE_HEADERS]) {
// find the required attachment
$attachtable = mapi_message_getattachmenttable($mapimessage);
mapi_table_restrict($attachtable, MAPIUtils::GetSignedAttachmentRestriction());
if (mapi_table_getrowcount($attachtable) == 1) {
$rows = mapi_table_queryrows($attachtable, array(PR_ATTACH_NUM, PR_ATTACH_SIZE), 0, 1);
if (isset($rows[0][PR_ATTACH_NUM])) {
$mapiattach = mapi_message_openattach($mapimessage, $rows[0][PR_ATTACH_NUM]);
$stream = mapi_openpropertytostream($mapiattach, PR_ATTACH_DATA_BIN);
$streamsize = $rows[0][PR_ATTACH_SIZE];
}
}
}
elseif (function_exists("mapi_inetmapi_imtoinet")) {
if (function_exists("mapi_inetmapi_imtoinet")) {
$addrbook = $this->getAddressbook();
$stream = mapi_inetmapi_imtoinet($this->session, $addrbook, $mapimessage, array('use_tnef' => -1));
$mstreamstat = mapi_stream_stat($stream);
$streamsize = $mstreamstat["cb"];
}
if (isset($stream) && isset($streamsize)) {
if (Request::GetProtocolVersion() >= 12.0) {
if (!isset($message->asbody))
$message->asbody = new SyncBaseBody();
//TODO data should be wrapped in a MapiStreamWrapper
$message->asbody->data = mapi_stream_read($stream, $streamsize);
$message->asbody->estimatedDataSize = $streamsize;
$message->asbody->truncated = 0;
if (isset($stream) && isset($streamsize)) {
if (Request::GetProtocolVersion() >= 12.0) {
if (!isset($message->asbody))
$message->asbody = new SyncBaseBody();
//TODO data should be wrapped in a MapiStreamWrapper
$message->asbody->data = mapi_stream_read($stream, $streamsize);
$message->asbody->estimatedDataSize = $streamsize;
$message->asbody->truncated = 0;
}
else {
$message->mimetruncated = 0;
//TODO mimedata should be a wrapped in a MapiStreamWrapper
$message->mimedata = mapi_stream_read($stream, $streamsize);
$message->mimesize = $streamsize;
}
unset($message->body, $message->bodytruncated);
return true;
}
else {
$message->mimetruncated = 0;
//TODO mimedata should be a wrapped in a MapiStreamWrapper
$message->mimedata = mapi_stream_read($stream, $streamsize);
$message->mimesize = $streamsize;
ZLog::Write(LOGLEVEL_ERROR, sprintf("Error opening attachment for imtoinet"));
}
unset($message->body, $message->bodytruncated);
return true;
}
else {
ZLog::Write(LOGLEVEL_ERROR, sprintf("Error opening attachment for imtoinet"));
}
return false;
}
......
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