mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
* eSync: fix not synced subject and other headers, after RC3 Outlook memory reduction
This commit is contained in:
parent
92c358f6f6
commit
f89142629a
@ -1450,7 +1450,7 @@ class Mail
|
|||||||
// Pre-cache the headers we want, 'fetchHeaders' is a label into the cache
|
// Pre-cache the headers we want, 'fetchHeaders' is a label into the cache
|
||||||
$fquery->headers('fetchHeaders',array(
|
$fquery->headers('fetchHeaders',array(
|
||||||
'DISPOSITION-NOTIFICATION-TO','RETURN-RECEIPT-TO','X-CONFIRM-READING-TO',
|
'DISPOSITION-NOTIFICATION-TO','RETURN-RECEIPT-TO','X-CONFIRM-READING-TO',
|
||||||
'DATE','SUBJECT','FROM','TO','CC',
|
'DATE','SUBJECT','FROM','TO','CC','REPLY-TO',
|
||||||
'X-PRIORITY'
|
'X-PRIORITY'
|
||||||
),array(
|
),array(
|
||||||
// Cache headers, we'll look at them below
|
// Cache headers, we'll look at them below
|
||||||
@ -1545,8 +1545,9 @@ class Mail
|
|||||||
$headerObject['FROM'] = (array)($headerForPrio['FROM']?$headerForPrio['FROM']:($headerForPrio['REPLY-TO']?$headerForPrio['REPLY-TO']:$headerForPrio['RETURN-PATH']));
|
$headerObject['FROM'] = (array)($headerForPrio['FROM']?$headerForPrio['FROM']:($headerForPrio['REPLY-TO']?$headerForPrio['REPLY-TO']:$headerForPrio['RETURN-PATH']));
|
||||||
$headerObject['TO'] = (array)$headerForPrio['TO'];
|
$headerObject['TO'] = (array)$headerForPrio['TO'];
|
||||||
$headerObject['CC'] = isset($headerForPrio['CC'])?(array)$headerForPrio['CC']:array();
|
$headerObject['CC'] = isset($headerForPrio['CC'])?(array)$headerForPrio['CC']:array();
|
||||||
|
$headerObject['REPLY-TO'] = isset($headerForPrio['REPLY-TO'])?(array)$headerForPrio['REPLY-TO']:array();
|
||||||
$headerObject['PRIORITY'] = isset($headerForPrio['X-PRIORITY'])?$headerForPrio['X-PRIORITY']:null;
|
$headerObject['PRIORITY'] = isset($headerForPrio['X-PRIORITY'])?$headerForPrio['X-PRIORITY']:null;
|
||||||
foreach (array('FROM','TO','CC') as $key)
|
foreach (array('FROM','TO','CC','REPLY-TO') as $key)
|
||||||
{
|
{
|
||||||
$address = array();
|
$address = array();
|
||||||
foreach ($headerObject[$key] as $k => $ad)
|
foreach ($headerObject[$key] as $k => $ad)
|
||||||
@ -1702,6 +1703,9 @@ class Mail
|
|||||||
if(is_array($headerObject['FROM']) && $headerObject['FROM'][0]) {
|
if(is_array($headerObject['FROM']) && $headerObject['FROM'][0]) {
|
||||||
$retValue['header'][$sortOrder[$uid]]['sender_address'] = self::decode_header($headerObject['FROM'][0],true);
|
$retValue['header'][$sortOrder[$uid]]['sender_address'] = self::decode_header($headerObject['FROM'][0],true);
|
||||||
}
|
}
|
||||||
|
if(is_array($headerObject['REPLY-TO']) && $headerObject['REPLY-TO'][0]) {
|
||||||
|
$retValue['header'][$sortOrder[$uid]]['reply_to_address'] = self::decode_header($headerObject['REPLY-TO'][0],true);
|
||||||
|
}
|
||||||
if(is_array($headerObject['TO']) && $headerObject['TO'][0]) {
|
if(is_array($headerObject['TO']) && $headerObject['TO'][0]) {
|
||||||
$retValue['header'][$sortOrder[$uid]]['to_address'] = self::decode_header($headerObject['TO'][0],true);
|
$retValue['header'][$sortOrder[$uid]]['to_address'] = self::decode_header($headerObject['TO'][0],true);
|
||||||
if (count($headerObject['TO'])>1)
|
if (count($headerObject['TO'])>1)
|
||||||
|
@ -864,20 +864,15 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
|
|||||||
$account = $_folderName = $xid = null;
|
$account = $_folderName = $xid = null;
|
||||||
$this->splitID($folderid,$account,$_folderName,$xid);
|
$this->splitID($folderid,$account,$_folderName,$xid);
|
||||||
$this->mail->reopen($_folderName);
|
$this->mail->reopen($_folderName);
|
||||||
$stat = $this->StatMessage($folderid, $id);
|
$messages = $this->fetchMessages($folderid, NULL, $id, true); // true: return all headers
|
||||||
if ($this->debugLevel>3) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__.array2string($stat));
|
$headers = $messages[$id];
|
||||||
|
if ($this->debugLevel>3) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__.array2string($headers));
|
||||||
// StatMessage should reopen the folder in question, so we dont need folderids in the following statements.
|
// StatMessage should reopen the folder in question, so we dont need folderids in the following statements.
|
||||||
if ($stat)
|
if ($headers)
|
||||||
{
|
{
|
||||||
ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__." Message $id with stat ".array2string($stat));
|
ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__." Message $id with stat ".array2string($headers));
|
||||||
// initialize the object
|
// initialize the object
|
||||||
$output = new SyncMail();
|
$output = new SyncMail();
|
||||||
$headers = $this->mail->getMessageHeader($id,'',true,true,$_folderName);
|
|
||||||
if (empty($headers))
|
|
||||||
{
|
|
||||||
error_log(__METHOD__.__LINE__.' Retrieval of Headers Failed! for .'.$this->account.'/'.$GLOBALS['egw_info']['user']['account_lid'].' ServerID:'.self::$profileID.'FolderID:'.$folderid.'/'.$_folderName.' ID:'.$id.' TruncSize:'.$truncsize.' Bodypreference: '.array2string($bodypreference).' Stat was:'.array2string($stat));
|
|
||||||
return $output;//empty object
|
|
||||||
}
|
|
||||||
//$rawHeaders = $this->mail->getMessageRawHeader($id);
|
//$rawHeaders = $this->mail->getMessageRawHeader($id);
|
||||||
// simple style
|
// simple style
|
||||||
// start AS12 Stuff (bodypreference === false) case = old behaviour
|
// start AS12 Stuff (bodypreference === false) case = old behaviour
|
||||||
@ -1049,40 +1044,38 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// end AS12 Stuff
|
// end AS12 Stuff
|
||||||
ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__.' gather Header info:'.$headers['SUBJECT'].' from:'.$headers['DATE']);
|
ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__.' gather Header info:'.$headers['subject'].' from:'.$headers['date']);
|
||||||
$output->read = $stat["flags"];
|
$output->read = $headers["flags"];
|
||||||
|
|
||||||
$output->flag = new SyncMailFlags();
|
$output->flag = new SyncMailFlags();
|
||||||
if ($stat['flagged'] == 1)
|
if ($headers['flagged'] == 1)
|
||||||
{
|
{
|
||||||
$output->flag->flagstatus = 2;
|
$output->flag->flagstatus = 2;
|
||||||
//$output->flag->flagtype = "Flag for Follow up";
|
//$output->flag->flagtype = "Flag for Follow up";
|
||||||
} else {
|
} else {
|
||||||
$output->flag->flagstatus = 0;
|
$output->flag->flagstatus = 0;
|
||||||
}
|
}
|
||||||
if ($stat['answered'])
|
if ($headers['answered'])
|
||||||
{
|
{
|
||||||
$output->lastverexecuted = AS_REPLYTOSENDER;
|
$output->lastverexecuted = AS_REPLYTOSENDER;
|
||||||
}
|
}
|
||||||
elseif ($stat['forwarded'])
|
elseif ($headers['forwarded'])
|
||||||
{
|
{
|
||||||
$output->lastverexecuted = AS_FORWARD;
|
$output->lastverexecuted = AS_FORWARD;
|
||||||
}
|
}
|
||||||
$output->subject = $stat['subject'];
|
$output->subject = $headers['subject'];
|
||||||
$output->importance = $stat['priority'] > 3 ? 0 :
|
$output->importance = $headers['priority'] > 3 ? 0 :
|
||||||
($stat['priority'] < 3 ? 2 : 1) ;
|
($headers['priority'] < 3 ? 2 : 1) ;
|
||||||
$output->datereceived = $this->mail->_strtotime($headers['DATE'],'ts',true);
|
$output->datereceived = $this->mail->_strtotime($headers['date'],'ts',true);
|
||||||
//error_log(__METHOD__.__LINE__.' To:'.$headers['TO']);
|
$output->to = $headers['to_address'];
|
||||||
$output->to = $headers['TO'];
|
if ($headers['to']) $output->displayto = $headers['to_address']; //$headers['FETCHED_HEADER']['to_name']
|
||||||
if ($headers['TO']) $output->displayto = ($headers['TO'] ? $headers['TO']:null); //$stat['FETCHED_HEADER']['to_name']
|
$output->from = $headers['sender_address'];
|
||||||
//error_log(__METHOD__.__LINE__.' From:'.$headers['FROM']);
|
if (isset($headers['cc_addresses']) && $headers['cc_addresses']) $output->cc = $headers['cc_addresses'];
|
||||||
$output->from = $headers['FROM'];
|
if (isset($headers['reply_to_address']) && $headers['reply_to_address']) $output->reply_to = $headers['reply_to_address'];
|
||||||
if (isset($headers['CC']) && $headers['CC']) $output->cc = ($headers['CC'] ? $headers['CC']:null);
|
|
||||||
if (isset($headers['REPLY_TO']) && $headers['REPLY_TO']) $output->reply_to = ($headers['REPLY_TO']?$headers['REPLY_TO']:null);
|
|
||||||
|
|
||||||
$output->messageclass = "IPM.Note";
|
$output->messageclass = "IPM.Note";
|
||||||
if (stripos($stat['mimetype'],'multipart')!== false &&
|
if (stripos($headers['mimetype'],'multipart')!== false &&
|
||||||
stripos($stat['mimetype'],'signed')!== false)
|
stripos($headers['mimetype'],'signed')!== false)
|
||||||
{
|
{
|
||||||
$output->messageclass = "IPM.Note.SMIME.MultipartSigned";
|
$output->messageclass = "IPM.Note.SMIME.MultipartSigned";
|
||||||
}
|
}
|
||||||
@ -1397,9 +1390,10 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
|
|||||||
* @param int $folderid
|
* @param int $folderid
|
||||||
* @param int $cutoffdate timestamp with cutoffdate
|
* @param int $cutoffdate timestamp with cutoffdate
|
||||||
* @param string $_id =null uid of single message to fetch
|
* @param string $_id =null uid of single message to fetch
|
||||||
|
* @param boolean $return_all_headers =false true: additinal contain all headers eg. "subject"
|
||||||
* @return array uid => array StatMessage($folderid, $_id)
|
* @return array uid => array StatMessage($folderid, $_id)
|
||||||
*/
|
*/
|
||||||
private function fetchMessages($folderid, $cutoffdate=NULL, $_id=NULL)
|
private function fetchMessages($folderid, $cutoffdate=NULL, $_id=NULL, $return_all_headers=false)
|
||||||
{
|
{
|
||||||
static $headers = array();
|
static $headers = array();
|
||||||
|
|
||||||
@ -1457,6 +1451,7 @@ class mail_zpush implements activesync_plugin_write, activesync_plugin_sendmail,
|
|||||||
if (!empty($vars['deleted'])) continue; // cut of deleted messages
|
if (!empty($vars['deleted'])) continue; // cut of deleted messages
|
||||||
if ($cutoffdate && $vars['date'] < $cutoffdate) continue; // message is out of range for cutoffdate, ignore it
|
if ($cutoffdate && $vars['date'] < $cutoffdate) continue; // message is out of range for cutoffdate, ignore it
|
||||||
if ($this->debugLevel>0) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__.' ID to report:'.$vars['uid'].' Subject:'.$vars['subject']);
|
if ($this->debugLevel>0) ZLog::Write(LOGLEVEL_DEBUG,__METHOD__.__LINE__.' ID to report:'.$vars['uid'].' Subject:'.$vars['subject']);
|
||||||
|
$mess = $return_all_headers ? $vars : array();
|
||||||
$mess["mod"] = self::doFlagsMod($vars).$vars['date'];
|
$mess["mod"] = self::doFlagsMod($vars).$vars['date'];
|
||||||
$mess["id"] = $vars['uid'];
|
$mess["id"] = $vars['uid'];
|
||||||
// 'seen' aka 'read' is the only flag we want to know about
|
// 'seen' aka 'read' is the only flag we want to know about
|
||||||
|
Loading…
Reference in New Issue
Block a user