Commit 59563d85 authored by Sebastian Kummer's avatar Sebastian Kummer

ZO-83 handle KOP forward/reply flags in SendMail request processor, send

email when replacemime is set even if fwmessage (source message) can not
be opened.
parent 800eb79a
This diff is collapsed.
...@@ -87,6 +87,28 @@ class SendMail extends RequestProcessor { ...@@ -87,6 +87,28 @@ class SendMail extends RequestProcessor {
// no wbxml output is provided, only a http OK // no wbxml output is provided, only a http OK
$sm->saveinsent = Request::GetGETSaveInSent(); $sm->saveinsent = Request::GetGETSaveInSent();
} }
// KOP ZO-6: grep for the OL header and set flags accordingly.
// The header has the values verb/message-source-key/folder-source-key
if (preg_match("/X-Push-Flags: (\d{3})\/([\da-f]+)\/([\da-f]+)/i", $sm->mime, $ol_flags)) {
// "reply" and "reply-all" are handled as "reply"
if ($ol_flags[1] == 102 || $ol_flags[1] == 103) {
$reply = true;
}
else if ($ol_flags[1] == 104) {
$forward = true;
}
// set source folder+item and replacemime
if (!isset($sm->source)) {
$sm->source = new SyncSendMailSource();
}
$sm->source->itemid = $ol_flags[2];
$sm->source->folderid = $ol_flags[3];
$sm->replacemime = true;
ZLog::Write(LOGLEVEL_DEBUG, "SendMail(): KOP support: overwrite reply/forward flag, set parent-id and item-id, replacemime - original message should not be attached.");
}
// Check if it is a reply or forward. Two cases are possible: // Check if it is a reply or forward. Two cases are possible:
// 1. Either $smartreply or $smartforward are set after reading WBXML // 1. Either $smartreply or $smartforward are set after reading WBXML
// 2. Either $reply or $forward are set after geting the request parameters // 2. Either $reply or $forward are set after geting the request parameters
...@@ -111,10 +133,10 @@ class SendMail extends RequestProcessor { ...@@ -111,10 +133,10 @@ class SendMail extends RequestProcessor {
$sm->forwardflag = true; $sm->forwardflag = true;
if (!isset($sm->source->folderid)) if (!isset($sm->source->folderid))
ZLog::Write(LOGLEVEL_ERROR, sprintf("No parent folder id while replying or forwarding message:'%s'", (($reply) ? $reply : $forward))); ZLog::Write(LOGLEVEL_ERROR, sprintf("SendMail(): No parent folder id while replying or forwarding message:'%s'", (($reply) ? $reply : $forward)));
} }
self::$topCollector->AnnounceInformation(sprintf("Sending email with %d bytes", strlen($sm->mime)), true); self::$topCollector->AnnounceInformation(sprintf("SendMail(): Sending email with %d bytes", strlen($sm->mime)), true);
try { try {
$status = self::$backend->SendMail($sm); $status = self::$backend->SendMail($sm);
......
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