mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 00:13:35 +01:00
stuff to try to fix problems on header retrieval
This commit is contained in:
parent
f6420e9572
commit
bb12e99a8b
@ -681,7 +681,7 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send
|
||||
$this->mail->reopen($folder);
|
||||
// not needed, as the original header is always transmitted
|
||||
/*
|
||||
$headers = $this->mail->getMessageEnvelope($uid, $_partID, true);
|
||||
$headers = $this->mail->getMessageEnvelope($uid, $_partID, true, $folder);
|
||||
if ($this->debugLevel>0) debugLog(__METHOD__.__LINE__." Headers of Message with UID:$uid ->".array2string($headers));
|
||||
$body .= $this->mail->createHeaderInfoSection($headers,lang("original message"));
|
||||
*/
|
||||
@ -737,7 +737,7 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send
|
||||
$this->mail->reopen($folder);
|
||||
// receive entire mail (header + body)
|
||||
// get message headers for specified message
|
||||
$headers = $this->mail->getMessageEnvelope($uid, $_partID, true);
|
||||
$headers = $this->mail->getMessageEnvelope($uid, $_partID, true, $folder);
|
||||
|
||||
// build a new mime message, forward entire old mail as file
|
||||
if ($preferencesArray['message_forwarding'] == 'asmail')
|
||||
|
@ -1665,6 +1665,7 @@ class mail_bo
|
||||
else
|
||||
{
|
||||
$_string = translation::decodeMailHeader($_string,self::$displayCharset);
|
||||
//$_tryIDNConversion=false;
|
||||
if ($_tryIDNConversion===true && stripos($_string,'@')!==false)
|
||||
{
|
||||
$rfcAddr = imap_rfc822_parse_adrlist(str_replace(',','\,',$_string),'');
|
||||
@ -3975,12 +3976,15 @@ class mail_bo
|
||||
* @param string/int $_uid the messageuid,
|
||||
* @param string/int $_partID='' , the partID, may be omitted
|
||||
* @param boolean $decode flag to do the decoding on the fly
|
||||
* @param string $_folder folder to work on
|
||||
* @return array the message header
|
||||
*/
|
||||
function getMessageEnvelope($_uid, $_partID = '',$decode=false)
|
||||
function getMessageEnvelope($_uid, $_partID = '',$decode=false, $_folder='')
|
||||
{
|
||||
if($_partID == '') {
|
||||
$_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
|
||||
//error_log(__METHOD__.__LINE__.":$_uid,$_partID,$decode,$_folder".function_backtrace());
|
||||
if (empty($_folder)) $_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
|
||||
//error_log(__METHOD__.__LINE__.":$_uid,$_partID,$decode,$_folder");
|
||||
if(empty($_partID)) {
|
||||
$uidsToFetch = new Horde_Imap_Client_Ids();
|
||||
$uidsToFetch->add((array)$_uid);
|
||||
|
||||
@ -4034,8 +4038,10 @@ class mail_bo
|
||||
//error_log(__METHOD__.__LINE__.array2string($envelope));
|
||||
return ($decode ? self::decode_header($envelope,true): $envelope);
|
||||
} else {
|
||||
$headers = $this->getMessageHeader($_uid, $_partID, true,true);
|
||||
//error_log(__METHOD__.__LINE__.array2string($headers));
|
||||
|
||||
$headers = $this->getMessageHeader($_uid, $_partID, true,true,$_folder);
|
||||
|
||||
//print_r(__METHOD__.__LINE__.':'.array2string($headers),true);
|
||||
//_debug_array($headers);
|
||||
$newData = array(
|
||||
'DATE' => $headers['DATE'],
|
||||
@ -4083,10 +4089,12 @@ class mail_bo
|
||||
* @param string/int $_partID='' , the partID, may be omitted
|
||||
* @param boolean $decode flag to do the decoding on the fly
|
||||
* @param boolean $preserveUnSeen flag to preserve the seen flag where applicable
|
||||
* @param string $_folder folder to work on
|
||||
* @return array the message header
|
||||
*/
|
||||
function getMessageHeader($_uid, $_partID = '',$decode=false, $preserveUnSeen=false, $_folder='')
|
||||
{
|
||||
//error_log(__METHOD__.__LINE__.':'.$_uid.', '.$_partID.', '.$decode.', '.$preserveUnSeen.', '.$_folder);
|
||||
if (empty($_folder)) $_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
|
||||
$uidsToFetch = new Horde_Imap_Client_Ids();
|
||||
$uidsToFetch->add((array)$_uid);
|
||||
@ -4120,6 +4128,7 @@ class mail_bo
|
||||
{
|
||||
$retValue['SUBJECT'] = $retValue['SUBJECT'][count($retValue['SUBJECT'])-1];
|
||||
}
|
||||
//error_log(__METHOD__.__LINE__.':'.array2string($decode ? self::decode_header($retValue,true):$retValue));
|
||||
return ($decode ? self::decode_header($retValue,true):$retValue);
|
||||
}
|
||||
|
||||
@ -4128,19 +4137,20 @@ class mail_bo
|
||||
* get messages raw header data
|
||||
* @param string/int $_uid the messageuid,
|
||||
* @param string/int $_partID='' , the partID, may be omitted
|
||||
* @param string $_folder folder to work on
|
||||
* @return string the message header
|
||||
*/
|
||||
function getMessageRawHeader($_uid, $_partID = '')
|
||||
function getMessageRawHeader($_uid, $_partID = '', $_folder = '')
|
||||
{
|
||||
static $rawHeaders;
|
||||
$_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
|
||||
if (empty($_folder)) $_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
|
||||
//error_log(__METHOD__.__LINE__." Try Using Cache for raw Header $_uid, $_partID in Folder $_folder");
|
||||
|
||||
if (is_null($rawHeaders)) $rawHeaders = egw_cache::getCache(egw_cache::INSTANCE,'email','rawHeadersCache'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*60*1);
|
||||
if (isset($rawHeaders[$this->icServer->ImapServerId][$_folder][$_uid][($_partID==''?'NIL':$_partID)]))
|
||||
if (isset($rawHeaders[$this->icServer->ImapServerId][$_folder][$_uid][(empty($_partID)?'NIL':$_partID)]))
|
||||
{
|
||||
//error_log(__METHOD__.__LINE__." Using Cache for raw Header $_uid, $_partID in Folder $_folder");
|
||||
return $rawHeaders[$this->icServer->ImapServerId][$_folder][$_uid][($_partID==''?'NIL':$_partID)];
|
||||
return $rawHeaders[$this->icServer->ImapServerId][$_folder][$_uid][(empty($_partID)?'NIL':$_partID)];
|
||||
}
|
||||
$uidsToFetch = new Horde_Imap_Client_Ids();
|
||||
$uidsToFetch->add((array)$_uid);
|
||||
@ -4167,7 +4177,7 @@ class mail_bo
|
||||
}
|
||||
}
|
||||
}
|
||||
$rawHeaders[$this->icServer->ImapServerId][$_folder][$_uid][($_partID==''?'NIL':$_partID)]=$retValue;
|
||||
$rawHeaders[$this->icServer->ImapServerId][$_folder][$_uid][(empty($_partID)?'NIL':$_partID)]=$retValue;
|
||||
egw_cache::setCache(egw_cache::INSTANCE,'email','rawHeadersCache'.trim($GLOBALS['egw_info']['user']['account_id']),$rawHeaders,$expiration=60*60*1);
|
||||
return $retValue;
|
||||
}
|
||||
@ -4250,10 +4260,10 @@ class mail_bo
|
||||
if (is_null($rawBody)) $rawBody = array();
|
||||
|
||||
$_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
|
||||
if (isset($rawBody[$this->icServer->ImapServerId][$_folder][$_uid][($_partID==''?'NIL':$_partID)]))
|
||||
if (isset($rawBody[$this->icServer->ImapServerId][$_folder][$_uid][(empty($_partID)?'NIL':$_partID)]))
|
||||
{
|
||||
//error_log(__METHOD__.__LINE__." Using Cache for raw Body $_uid, $_partID in Folder $_folder");
|
||||
return $rawBody[$this->icServer->ImapServerId][$_folder][$_uid][($_partID==''?'NIL':$_partID)];
|
||||
return $rawBody[$this->icServer->ImapServerId][$_folder][$_uid][(empty($_partID)?'NIL':$_partID)];
|
||||
}
|
||||
|
||||
$uidsToFetch = new Horde_Imap_Client_Ids();
|
||||
@ -4317,7 +4327,7 @@ class mail_bo
|
||||
}
|
||||
}
|
||||
|
||||
$rawBody[$this->icServer->ImapServerId][$_folder][$_uid][($_partID==''?'NIL':$_partID)] = $body;
|
||||
$rawBody[$this->icServer->ImapServerId][$_folder][$_uid][(empty($_partID)?'NIL':$_partID)] = $body;
|
||||
return $body;
|
||||
}
|
||||
|
||||
|
@ -1777,8 +1777,8 @@ unset($query['actions']);
|
||||
$error_msg[] = array2string($headers->backtrace[0]);
|
||||
}
|
||||
if (!empty($uid)) $flags = $this->mail_bo->getFlags($uid);
|
||||
$envelope = $this->mail_bo->getMessageEnvelope($uid, $partID,true);
|
||||
$rawheaders = $this->mail_bo->getMessageRawHeader($uid, $partID);
|
||||
$envelope = $this->mail_bo->getMessageEnvelope($uid, $partID,true,$mailbox);
|
||||
$rawheaders = $this->mail_bo->getMessageRawHeader($uid, $partID,$mailbox);
|
||||
$fetchEmbeddedImages = false;
|
||||
if ($htmlOptions !='always_display') $fetchEmbeddedImages = true;
|
||||
$attachments = $this->mail_bo->getMessageAttachments($uid, $partID, null, $fetchEmbeddedImages);
|
||||
|
Loading…
Reference in New Issue
Block a user