fix for rare problem on toggle html2text resulting in empty content; preparation for REFERENCES and IN-REPLY-TO

This commit is contained in:
Klaus Leithoff 2014-09-09 14:06:24 +00:00
parent 20ecbdf335
commit 757d0e9c38
2 changed files with 12 additions and 4 deletions

View File

@ -4624,6 +4624,8 @@ class emailadmin_imapbase
'SUBJECT' => ($decode ? self::decode_header($headers['SUBJECT']):$headers['SUBJECT']),
'MESSAGE_ID' => $headers['MESSAGE-ID']
);
if (isset($headers['IN-REPLY-TO'])) $newData['IN-REPLY-TO'] = $headers['IN-REPLY-TO'];
if (isset($headers['REFERENCES'])) $newData['REFERENCES'] = $headers['REFERENCES'];
//_debug_array($newData);
$recepientList = array('FROM', 'TO', 'CC', 'BCC', 'SENDER', 'REPLY-TO');
foreach($recepientList as $recepientType) {

View File

@ -479,11 +479,14 @@ class mail_compose
if (stripos($content['mail_htmltext'],'<pre>')!==false)
{
$contentArr = html::splithtmlByPRE($content['mail_htmltext']);
foreach ($contentArr as $k =>&$elem)
if (is_array($contentArr))
{
if (stripos($elem,'<pre>')!==false) $elem = str_replace(array("\r\n","\n","\r"),array("<br>","<br>","<br>"),$elem);
foreach ($contentArr as $k =>&$elem)
{
if (stripos($elem,'<pre>')!==false) $elem = str_replace(array("\r\n","\n","\r"),array("<br>","<br>","<br>"),$elem);
}
$content['mail_htmltext'] = implode('',$contentArr);
}
$content['mail_htmltext'] = implode('',$contentArr);
}
$content['mail_htmltext'] = $this->_getCleanHTML($content['mail_htmltext'], false, false);
$content['mail_htmltext'] = translation::convertHTMLToText($content['mail_htmltext'],$charset=false,$stripcrl=false,$stripalltags=true);
@ -1305,6 +1308,8 @@ class mail_compose
$preserv['serverID'] = $content['serverID'];
$preserv['lastDrafted'] = $content['lastDrafted'];
$preserv['processedmail_id'] = $content['processedmail_id'];
$preserv['references'] = $content['references'];
$preserv['in-reply-to'] = $content['in-reply-to'];
$preserv['mode'] = $content['mode'];
// convert it back to checkbox expectations
if($content['mimeType'] == 'html') {
@ -1945,7 +1950,8 @@ class mail_compose
//$headers = $mail_bo->getMessageHeader($_uid, $_partID, true, true, $_folder);
$this->sessionData['uid'] = $_uid;
$this->sessionData['messageFolder'] = $_folder;
$this->sessionData['in-reply-to'] = $headers['MESSAGE_ID'];
$this->sessionData['in-reply-to'] = ($headers['IN-REPLY-TO']?$headers['IN-REPLY-TO']:$headers['MESSAGE_ID']);
$this->sessionData['references'] = ($headers['REFERENCES']?$headers['REFERENCES']:$headers['MESSAGE_ID']);
//error_log(__METHOD__.__LINE__.' Mode:'.$_mode.':'.array2string($headers));
// check for Reply-To: header and use if available
if(!empty($headers['REPLY-TO']) && ($headers['REPLY-TO'] != $headers['FROM'])) {