- Fix PGP signed messages get shown as red
- Fix attachments area always gets displayed
This commit is contained in:
Hadi Nategh 2017-08-31 17:33:23 +02:00
parent 7e275df4e4
commit 1a8e584e0c
8 changed files with 41 additions and 24 deletions

View File

@ -5611,12 +5611,13 @@ class Mail
if (is_object($mail)) if (is_object($mail))
{ {
$structure = $mail->getStructure(); $structure = $mail->getStructure();
$isSmime = Mail\Smime::isSmime($structure->getType()) || Mail\Smime::isSmimeSignatureOnly($structure->getType()); $isSmime = Mail\Smime::isSmime(($mimeType = $structure->getType())) || Mail\Smime::isSmimeSignatureOnly(($protocol=$structure->getContentTypeParameter('protocol')));
if ($isSmime) if ($isSmime)
{ {
return $this->resolveSmimeMessage($structure, array( return $this->resolveSmimeMessage($structure, array(
'uid' => $_uid, 'uid' => $_uid,
'mailbox' => $_folder 'mailbox' => $_folder,
'mimeType' => Mail\Smime::isSmime($protocol) ? $protocol: $mimeType
)); ));
} }
return $mail->getStructure(); return $mail->getStructure();
@ -5927,11 +5928,14 @@ class Mail
if ($_partID != '') if ($_partID != '')
{ {
$mailStructureObject = $_headerObject->getStructure(); $mailStructureObject = $_headerObject->getStructure();
if (Mail\Smime::isSmime(($smime_type = $mailStructureObject->getType()))) if (Mail\Smime::isSmime(($mimeType = $mailStructureObject->getType())) ||
Mail\Smime::isSmimeSignatureOnly(($protocol=$mailStructureObject->getContentTypeParameter('protocol'))))
{ {
$mailStructureObject = $this->resolveSmimeMessage($mailStructureObject, array( $mailStructureObject = $this->resolveSmimeMessage($mailStructureObject, array(
'uid' => $_uid, 'uid' => $_uid,
'mailbox' => $_folder 'mailbox' => $_folder,
'mimeType' => Mail\Smime::isSmime($protocol) ? $protocol : $mimeType
)); ));
} }
$mailStructureObject->contentTypeMap(); $mailStructureObject->contentTypeMap();
@ -7338,8 +7342,7 @@ class Mail
{ {
// default params // default params
$params = array_merge(array( $params = array_merge(array(
'passphrase' => '', 'passphrase' => ''
'mimeType' => $_mime_part->getType()
), $_params); ), $_params);
$metadata = array ( $metadata = array (

View File

@ -39,8 +39,7 @@ class Smime extends Horde_Crypt_Smime
*/ */
static $SMIME_SIGNATURE_ONLY_TYPES = array ( static $SMIME_SIGNATURE_ONLY_TYPES = array (
'application/x-pkcs7-signature', 'application/x-pkcs7-signature',
'application/pkcs7-signature', 'application/pkcs7-signature'
'multipart/signed'
); );
/** /**

View File

@ -1829,6 +1829,17 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
$data['uid'] = $message_uid; $data['uid'] = $message_uid;
$data['row_id']=$this->createRowID($_folderName,$message_uid); $data['row_id']=$this->createRowID($_folderName,$message_uid);
if (is_array($header['attachments']))
{
foreach ($header['attachments'] as $attch)
{
if (Mail\Smime::isSmime($attch['mimeType']))
{
$data['smime'] = Mail\Smime::isSmimeSignatureOnly($attch['mimeType']) ? 'smimeSignature' : 'smimeEncryption';
}
}
}
$flags = ""; $flags = "";
if(!empty($header['recent'])) $flags .= "R"; if(!empty($header['recent'])) $flags .= "R";
if(!empty($header['flagged'])) $flags .= "F"; if(!empty($header['flagged'])) $flags .= "F";
@ -2020,16 +2031,6 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
{ {
$data["bodypreview"] = $header['bodypreview']; $data["bodypreview"] = $header['bodypreview'];
} }
if (is_array($data['attachmentsBlock']))
{
foreach ($data['attachmentsBlock'] as &$attch)
{
if (Mail\Smime::isSmime($attch['type']))
{
$data['smime'] = Mail\Smime::isSmimeSignatureOnly($attch['type']) ? 'smimeSignature' : 'smimeEncryption';
}
}
}
$rv[] = $data; $rv[] = $data;
//error_log(__METHOD__.__LINE__.array2string($data)); //error_log(__METHOD__.__LINE__.array2string($data));
} }
@ -2344,6 +2345,7 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
foreach ($attachments as $key => $value) foreach ($attachments as $key => $value)
{ {
if (Mail\Smime::isSmime($value['mimeType'])) continue;
$attachmentHTML[$key]['filename']= ($value['name'] ? ( $value['filename'] ? $value['filename'] : $value['name'] ) : lang('(no subject)')); $attachmentHTML[$key]['filename']= ($value['name'] ? ( $value['filename'] ? $value['filename'] : $value['name'] ) : lang('(no subject)'));
$attachmentHTML[$key]['filename'] = Api\Translation::convert_jsonsafe($attachmentHTML[$key]['filename'],'utf-8'); $attachmentHTML[$key]['filename'] = Api\Translation::convert_jsonsafe($attachmentHTML[$key]['filename'],'utf-8');
//error_log(array2string($value)); //error_log(array2string($value));

View File

@ -5777,6 +5777,7 @@ app.classes.mail = AppJS.extend(
var mailPreview = this.et2.getWidgetById('mailPreviewContainer'); var mailPreview = this.et2.getWidgetById('mailPreviewContainer');
if (attachmentArea && _attachments && _attachments.length > 0) if (attachmentArea && _attachments && _attachments.length > 0)
{ {
attachmentArea.getParent().set_disabled(false);
content.data[attachmentArea.id] = _attachments; content.data[attachmentArea.id] = _attachments;
this.et2.setArrayMgr('contnet', content); this.et2.setArrayMgr('contnet', content);
attachmentArea.getDOMNode().classList.remove('loading'); attachmentArea.getDOMNode().classList.remove('loading');
@ -5792,6 +5793,10 @@ app.classes.mail = AppJS.extend(
} }
} }
} }
else
{
attachmentArea.getParent().set_disabled(true);
}
}, },
/** /**
* This function helps to trigger the Push notification immidiately. * This function helps to trigger the Push notification immidiately.

View File

@ -937,4 +937,5 @@ img.smime_cert_notvalid {
} }
img.smime_cert_unknownemail { img.smime_cert_unknownemail {
background: #a28cff; background: #a28cff;
} }
.smimeIcons {position: absolute;right: 0;}

View File

@ -35,6 +35,10 @@
</hbox> </hbox>
<buttononly class="et2_button ui-button" label="Show all Addresses" image="foldertree_nolines_plus" onclick="app.mail.showAllHeader"/> <buttononly class="et2_button ui-button" label="Show all Addresses" image="foldertree_nolines_plus" onclick="app.mail.showAllHeader"/>
</hbox> </hbox>
<hbox class="mailPreviewHeaders smimeIcons">
<image id="smime_signature" src="smimeSignature" statustext="Smime signed message" disabled="true" align="right" width="24"/>
<image id="smime_encryption" src="smimeEncryption" statustext="Smime encrypted message" disabled="true" align="right" width="24"/>
</hbox>
<hbox id="mailPreviewHeadersAttachments" class="mailPreviewHeaders"> <hbox id="mailPreviewHeadersAttachments" class="mailPreviewHeaders">
<description value="Attachments"/> <description value="Attachments"/>
<grid disabled="@no_griddata" id="previewAttachmentArea" class="previewAttachmentArea egwGridView_grid"> <grid disabled="@no_griddata" id="previewAttachmentArea" class="previewAttachmentArea egwGridView_grid">
@ -66,12 +70,7 @@
</rows> </rows>
</grid> </grid>
<buttononly class="et2_button ui-button" label="Show all attachments" image="foldertree_nolines_plus" width="16px" height="16px" onclick="app.mail.showAllHeader"/> <buttononly class="et2_button ui-button" label="Show all attachments" image="foldertree_nolines_plus" width="16px" height="16px" onclick="app.mail.showAllHeader"/>
<hbox class="mailPreviewHeaders">
<image id="smime_signature" src="smimeSignature" statustext="Smime signed message" disabled="true" align="right" width="24"/>
<image id="smime_encryption" src="smimeEncryption" statustext="Smime encrypted message" disabled="true" align="right" width="24"/>
</hbox>
</hbox> </hbox>
<box id="mailPreviewContainer"> <box id="mailPreviewContainer">
<iframe frameborder="1" id="messageIFRAME" scrolling="auto"/> <iframe frameborder="1" id="messageIFRAME" scrolling="auto"/>
</box> </box>

View File

@ -925,6 +925,10 @@ img.smime_cert_notvalid {
img.smime_cert_unknownemail { img.smime_cert_unknownemail {
background: #a28cff; background: #a28cff;
} }
.smimeIcons {
position: absolute;
right: 0;
}
#popupMainDiv { #popupMainDiv {
padding: 5px; padding: 5px;
} }

View File

@ -913,6 +913,10 @@ img.smime_cert_notvalid {
img.smime_cert_unknownemail { img.smime_cert_unknownemail {
background: #a28cff; background: #a28cff;
} }
.smimeIcons {
position: absolute;
right: 0;
}
#popupMainDiv { #popupMainDiv {
padding: 5px; padding: 5px;
} }