throw out attachment type (if present) in preview (on request of sb);fix preserve seen for activesync

This commit is contained in:
Klaus Leithoff 2014-01-15 08:45:05 +00:00
parent c95c10a145
commit 4b2dbc6526
4 changed files with 9 additions and 146 deletions

View File

@ -1023,7 +1023,7 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send
debugLog(__METHOD__.__LINE__." Message $id with stat ".array2string($stat));
// initialize the object
$output = new SyncMail();
$headers = $this->mail->getMessageHeader($id,'',true);
$headers = $this->mail->getMessageHeader($id,'',true,true);
if (empty($headers))
{
error_log(__METHOD__.__LINE__.' Retrieval of Headers Failed! for .'.$this->account.' ServerID:'.self::$profileID.'FolderID:'.$folderid.' ID:'.$id.' TruncSize:'.$truncsize.' Bodypreference: '.array2string($bodypreference).' Stat was:'.array2string($stat));
@ -1305,7 +1305,7 @@ class mail_activesync implements activesync_plugin_write, activesync_plugin_send
// $output->from = $this->messages[$id]['sender_address']; //$stat['FETCHED_HEADER']['sender_name']
//error_log(__METHOD__.__LINE__.' To:'.$headers['TO']);
$output->to = $headers['TO'];
//error_log(__METHOD__.__LINE__.' From:'.$headers['FROM'].' Charset:'.$this->mail->detect_encoding($headers['FROM']));
error_log(__METHOD__.__LINE__.' From:'.$headers['FROM']);
$output->from = $headers['FROM'];
$output->cc = ($headers['CC'] ? $headers['CC']:null);
$output->reply_to = ($headers['REPLY_TO']?$headers['REPLY_TO']:null);

View File

@ -2758,24 +2758,6 @@ class mail_bo
$this->icServer->expunge($_folder);
break;
}
if ($updateCache)
{
$structure = egw_cache::getCache(egw_cache::INSTANCE,'email','structureCache'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*60*1);
$cachemodified = false;
if (is_null($_messageUID)) $_messageUID='all';
foreach ((array)$_messageUID as $k => $_uid)
{
if (isset($structure[$this->icServer->ImapServerId][$_folder][$_uid]) || $_uid=='all')
{
$cachemodified = true;
if ($_uid=='all')
unset($structure[$this->icServer->ImapServerId][$_folder]);
else
unset($structure[$this->icServer->ImapServerId][$_folder][$_uid]);
}
}
if ($cachemodified) egw_cache::setCache(egw_cache::INSTANCE,'email','structureCache'.trim($GLOBALS['egw_info']['user']['account_id']),$structure,$expiration=60*60*1);
}
if($oldMailbox != '') {
$this->icServer->openMailbox($oldMailbox);
}
@ -3048,23 +3030,6 @@ class mail_bo
return false;
}
}
if ($deleteAfterMove === true)
{
if($deleteOptions != "mark_as_deleted")
{
$structure = egw_cache::getCache(egw_cache::INSTANCE,'email','structureCache'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*60*1);
$cachemodified = false;
foreach ((array)$_messageUID as $k => $_uid)
{
if (isset($structure[$this->icServer->ImapServerId][(!empty($currentFolder)?$currentFolder: $this->sessionData['mailbox'])][$_uid]))
{
$cachemodified = true;
unset($structure[$this->icServer->ImapServerId][(!empty($currentFolder)?$currentFolder: $this->sessionData['mailbox'])][$_uid]);
}
}
if ($cachemodified) egw_cache::setCache(egw_cache::INSTANCE,'email','structureCache'.trim($GLOBALS['egw_info']['user']['account_id']),$structure,$expiration=60*60*1);
}
}
//error_log(__METHOD__.__LINE__.array2string($retUid));
return ($returnUIDs ? $retUid : true);
@ -3223,106 +3188,6 @@ class mail_bo
* Header and Bodystructure stuff
*/
/**
* _getStructure
* fetch the structure of a mail, represented by uid
* @param string/int $_uid the messageuid,
* @param boolean $byUid=true, is the messageuid given by UID or ID
* @param boolean $_ignoreCache=false, use or disregard cache, when fetching
* @param string $_folder='', if given search within that folder for the given $_uid, else use sessionData['mailbox'], or servers getCurrentMailbox
* @return array an structured array of information about the mail
*/
function _getStructure($_uid, $byUid=true, $_ignoreCache=false, $_folder = '')
{
static $structure;
if (empty($_folder)) $_folder = ($this->sessionData['mailbox']? $this->sessionData['mailbox'] : $this->icServer->getCurrentMailbox());
//error_log(__METHOD__.__LINE__.'User:'.trim($GLOBALS['egw_info']['user']['account_id'])." UID: $_uid, ".$this->icServer->ImapServerId.','.$_folder);
if (is_null($structure)) $structure = egw_cache::getCache(egw_cache::INSTANCE,'email','structureCache'.trim($GLOBALS['egw_info']['user']['account_id']),$callback=null,$callback_params=array(),$expiration=60*60*1);
//error_log(__METHOD__.__LINE__." UID: $_uid, ".$this->icServer->ImapServerId.','.$_folder.'->'.array2string(array_keys($structure)));
if (isset($structure[$this->icServer->ImapServerId]) && !empty($structure[$this->icServer->ImapServerId]) &&
isset($structure[$this->icServer->ImapServerId][$_folder]) && !empty($structure[$this->icServer->ImapServerId][$_folder]) &&
isset($structure[$this->icServer->ImapServerId][$_folder][$_uid]) && !empty($structure[$this->icServer->ImapServerId][$_folder][$_uid]))
{
if ($_ignoreCache===false)
{
//error_log(__METHOD__.__LINE__.' Using cache for structure on Server:'.$this->icServer->ImapServerId.' for uid:'.$_uid." in Folder:".$_folder.'->'.array2string($structure[$this->icServer->ImapServerId][$_folder][$_uid]));
return $structure[$this->icServer->ImapServerId][$_folder][$_uid];
}
}
$structure[$this->icServer->ImapServerId][$_folder][$_uid] = $this->icServer->getStructure($_uid, $byUid);
egw_cache::setCache(egw_cache::INSTANCE,'email','structureCache'.trim($GLOBALS['egw_info']['user']['account_id']),$structure,$expiration=60*60*1);
//error_log(__METHOD__.__LINE__.' Using query for structure on Server:'.$this->icServer->ImapServerId.' for uid:'.$_uid." in Folder:".$_folder.'->'.array2string($structure[$this->icServer->ImapServerId][$_folder][$_uid]));
return $structure[$this->icServer->ImapServerId][$_folder][$_uid];
}
/**
* _getSubStructure
* fetch the substructure of a mail, by given structure and partid
* @param array $_structure='', if given use structure for parsing
* @param string/int $_partID the partid,
* @return array an structured array of information about the mail
*/
function _getSubStructure($_structure, $_partID)
{
$tempID = '';
$structure = $_structure;
if (empty($_partID)) $_partID=1;
$imapPartIDs = explode('.',$_partID);
#error_log(print_r($structure,true));
#error_log(print_r($_partID,true));
if($_partID != 1) {
foreach($imapPartIDs as $imapPartID) {
if(!empty($tempID)) {
$tempID .= '.';
}
$tempID .= $imapPartID;
#error_log(print_r( "TEMPID: $tempID<br>",true));
//_debug_array($structure);
if($structure->subParts[$tempID]->type == 'MESSAGE' && $structure->subParts[$tempID]->subType == 'RFC822' &&
count($structure->subParts[$tempID]->subParts) == 1 &&
$structure->subParts[$tempID]->subParts[$tempID]->type == 'MULTIPART' &&
($structure->subParts[$tempID]->subParts[$tempID]->subType == 'MIXED' ||
$structure->subParts[$tempID]->subParts[$tempID]->subType == 'ALTERNATIVE' ||
$structure->subParts[$tempID]->subParts[$tempID]->subType == 'RELATED' ||
$structure->subParts[$tempID]->subParts[$tempID]->subType == 'REPORT'))
{
$structure = $structure->subParts[$tempID]->subParts[$tempID];
} else {
$structure = $structure->subParts[$tempID];
}
}
}
if($structure->partID != $_partID) {
foreach($imapPartIDs as $imapPartID) {
if(!empty($tempID)) {
$tempID .= '.';
}
$tempID .= $imapPartID;
//print "TEMPID: $tempID<br>";
//_debug_array($structure);
if($structure->subParts[$tempID]->type == 'MESSAGE' && $structure->subParts[$tempID]->subType == 'RFC822' &&
count($structure->subParts[$tempID]->subParts) == 1 &&
$structure->subParts[$tempID]->subParts[$tempID]->type == 'MULTIPART' &&
($structure->subParts[$tempID]->subParts[$tempID]->subType == 'MIXED' ||
$structure->subParts[$tempID]->subParts[$tempID]->subType == 'ALTERNATIVE' ||
$structure->subParts[$tempID]->subParts[$tempID]->subType == 'RELATED' ||
$structure->subParts[$tempID]->subParts[$tempID]->subType == 'REPORT')) {
$structure = $structure->subParts[$tempID]->subParts[$tempID];
} else {
$structure = $structure->subParts[$tempID];
}
}
if($structure->partID != $_partID) {
error_log(__METHOD__."(". __LINE__ .") partID's don't match");
return false;
}
}
return $structure;
}
/**
* getMimePartCharset - fetches the charset mimepart if it exists
* @param $_mimePartObject structure object
@ -4369,11 +4234,11 @@ class mail_bo
$uidsToFetch->add((array)$_uid);
$fquery = new Horde_Imap_Client_Fetch_Query();
$fquery->fullText();
$fquery->fullText(array('peek'=>true));
if ($_partID != '')
{
$fquery->structure();
$fquery->bodyPart($_partID);
$fquery->bodyPart($_partID,array('peek'=>true));
}
$headersNew = $this->icServer->fetch($_folder, $fquery, array(
'ids' => $uidsToFetch,
@ -4399,11 +4264,11 @@ class mail_bo
$uidsToFetch->add((array)$_uid);
$fquery = new Horde_Imap_Client_Fetch_Query();
$fquery->fullText();
$fquery->fullText(array('peek'=>true));//always do that as peek -> no seen flag set
if ($_partID != '')
{
$fquery->structure();
$fquery->bodyPart($_partID);
$fquery->bodyPart($_partID,array('peek'=>true));
}
$headersNew = $this->icServer->fetch($_folder, $fquery, array(
'ids' => $uidsToFetch,
@ -4484,7 +4349,7 @@ class mail_bo
if (!isset($_structure))
{
$_structure = $this->getStructure($_uid, $_partID);
$_structure = $this->getStructure($_uid, $_partID,null,true);
}
if (!$_structure || !$_structure->contentTypeMap()) return array();
foreach($_structure->contentTypeMap() as $mime_id => $mime_type)

View File

@ -563,4 +563,4 @@ div.mailPreviewHeaders #mail-index_previewAttachmentArea.visible {
}
.mail_extraEmails.visible > a {
display: list-item;
}
}

View File

@ -79,8 +79,7 @@
<column disabled="!@showtempname"/>
<column disabled="!@showtempname"/>
<column disabled="!@showtempname"/>
<column width="50%" />
<column width="20%" />
<column width="70%" />
<column width="11%" />
<column width="3%"/>
<column width="3%"/>
@ -94,7 +93,6 @@
<description id="${row}[type]" />
<description id="${row}[winmailFlag]" />
<description class="et2_link" id="${row}[filename]" no_lang="1" onclick="app.mail.displayAttachment"/>
<description id="${row}[mimetype]" />
<description align="right" id="${row}[size]" />
<buttononly id="${row}[save]" value="save" image="fileexport" onclick="app.mail.saveAttachment"/>
<buttononly id="${row}[saveAsVFS]" value="save" image="filemanager/navbar" onclick="app.mail.saveAttachmentToVFS"/>