Commit 481dff2e authored by skummer's avatar skummer

ZP-474 #comment fixed switched charset conversion, added additional log lines...

ZP-474 #comment fixed switched charset conversion, added additional log lines for monitoring of executed conversions

git-svn-id: https://z-push.org/svn/z-push/trunk@1777 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 53ae2130
...@@ -503,29 +503,41 @@ class BackendZarafa implements IBackend, ISearchProvider { ...@@ -503,29 +503,41 @@ class BackendZarafa implements IBackend, ISearchProvider {
// regarding the conversion @see ZP-470 // regarding the conversion @see ZP-470
if (strlen($body) > 0) { if (strlen($body) > 0) {
$fwbody = MAPIUtils::readPropStream($fwmessage, PR_BODY); $fwbody = MAPIUtils::readPropStream($fwmessage, PR_BODY);
// if both cpids are set to the charset to charset conversion // if both cpids are set convert from the existing charset to the new charset
if (isset($cpid[$sendMailProps["internetcpid"]]) && isset($props[$sendMailProps["internetcpid"]])) if (isset($cpid[$sendMailProps["internetcpid"]]) && isset($props[$sendMailProps["internetcpid"]])) {
$fwbody = Utils::ConvertCodepage($props[$sendMailProps["internetcpid"]], $cpid[$sendMailProps["internetcpid"]], $fwbody); ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZarafaBackend->SendMail(): convert plain forwarded message charset (both set) from '%s' to '%s'", $cpid[$sendMailProps["internetcpid"]], $props[$sendMailProps["internetcpid"]]));
// if only new message's cpid is set, convert to UTF-8 $fwbody = Utils::ConvertCodepage($cpid[$sendMailProps["internetcpid"]], $props[$sendMailProps["internetcpid"]], $fwbody);
elseif (isset($cpid[$sendMailProps["internetcpid"]])) }
// if only the old message's cpid is set, convert from old charset to utf-8
elseif (isset($cpid[$sendMailProps["internetcpid"]])) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZarafaBackend->SendMail(): convert plain forwarded message charset (only fw set) from '%s' to '65001'", $cpid[$sendMailProps["internetcpid"]]));
$fwbody = Utils::ConvertCodepageStringToUtf8($cpid[$sendMailProps["internetcpid"]], $fwbody); $fwbody = Utils::ConvertCodepageStringToUtf8($cpid[$sendMailProps["internetcpid"]], $fwbody);
}
// otherwise to the general conversion // otherwise to the general conversion
else else {
ZLog::Write(LOGLEVEL_DEBUG, "ZarafaBackend->SendMail(): no charset conversion done for plain forwarded message");
$fwbody = w2u($fwbody); $fwbody = w2u($fwbody);
}
$mapiprops[$sendMailProps["body"]] = $body."\r\n\r\n".$fwbody; $mapiprops[$sendMailProps["body"]] = $body."\r\n\r\n".$fwbody;
} }
if (strlen($bodyHtml) > 0) { if (strlen($bodyHtml) > 0) {
$fwbodyHtml = MAPIUtils::readPropStream($fwmessage, PR_HTML); $fwbodyHtml = MAPIUtils::readPropStream($fwmessage, PR_HTML);
if (isset($cpid[$sendMailProps["internetcpid"]]) && isset($props[$sendMailProps["internetcpid"]])) if (isset($cpid[$sendMailProps["internetcpid"]]) && isset($props[$sendMailProps["internetcpid"]])) {
$fwbodyHtml = Utils::ConvertCodepage($props[$sendMailProps["internetcpid"]], $cpid[$sendMailProps["internetcpid"]], $fwbodyHtml); ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZarafaBackend->SendMail(): convert html forwarded message charset (both set) from '%s' to '%s'", $cpid[$sendMailProps["internetcpid"]], $props[$sendMailProps["internetcpid"]]));
$fwbodyHtml = Utils::ConvertCodepage( $cpid[$sendMailProps["internetcpid"]], $props[$sendMailProps["internetcpid"]], $fwbodyHtml);
}
// if only new message's cpid is set, convert to UTF-8 // if only new message's cpid is set, convert to UTF-8
elseif (isset($cpid[$sendMailProps["internetcpid"]])) elseif (isset($cpid[$sendMailProps["internetcpid"]])) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("ZarafaBackend->SendMail(): convert html forwarded message charset (only fw set) from '%s' to '65001'", $cpid[$sendMailProps["internetcpid"]]));
$fwbodyHtml = Utils::ConvertCodepageStringToUtf8($cpid[$sendMailProps["internetcpid"]], $fwbodyHtml); $fwbodyHtml = Utils::ConvertCodepageStringToUtf8($cpid[$sendMailProps["internetcpid"]], $fwbodyHtml);
}
// otherwise to the general conversion // otherwise to the general conversion
else else {
ZLog::Write(LOGLEVEL_DEBUG, "ZarafaBackend->SendMail(): no charset conversion done for html forwarded message");
$fwbodyHtml = w2u($fwbodyHtml); $fwbodyHtml = w2u($fwbodyHtml);
}
$mapiprops[$sendMailProps["html"]] = $bodyHtml."<br><br>".$fwbodyHtml; $mapiprops[$sendMailProps["html"]] = $bodyHtml."<br><br>".$fwbodyHtml;
} }
......
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