From f7f75ff7d11b9e3cc722210f7037fc1e6c3c3b61 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli <thomas@roundcube.net> Date: Thu, 10 Sep 2015 15:56:40 -0400 Subject: [PATCH] Unify detection of pgp/mime message part --- program/steps/mail/func.inc | 31 ++++++++++++++++++++++++------- 1 files changed, 24 insertions(+), 7 deletions(-) diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 3f8277c..9feb767 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -453,6 +453,8 @@ } } + $sort_col = $_SESSION['sort_col']; + // loop through message headers foreach ($a_headers as $header) { if (empty($header)) @@ -483,7 +485,7 @@ else if ($col == 'size') $cont = $RCMAIL->show_bytes($header->$col); else if ($col == 'date') - $cont = $RCMAIL->format_date($header->date); + $cont = $RCMAIL->format_date($sort_col == 'arrival' ? $header->internaldate : $header->date); else if ($col == 'folder') { if ($last_folder !== $header->folder) { $last_folder = $header->folder; @@ -588,8 +590,9 @@ } foreach ($a_show_cols as $col) { - $label = ''; + $label = ''; $sortable = false; + $rel_col = $col == 'date' && $sort_col == 'arrival' ? 'arrival' : $col; // get column name switch ($col) { @@ -607,11 +610,11 @@ $col_name = $list_menu; break; case 'fromto': - $label = $RCMAIL->gettext($smart_col); + $label = $RCMAIL->gettext($smart_col); $col_name = rcube::Q($label); break; default: - $label = $RCMAIL->gettext($col); + $label = $RCMAIL->gettext($col); $col_name = rcube::Q($label); } @@ -621,7 +624,7 @@ $col_name = html::a(array( 'href' => "./#sort", 'class' => 'sortcol', - 'rel' => $col, + 'rel' => $rel_col, 'title' => $RCMAIL->gettext('sortby') ), $col_name); } @@ -629,7 +632,7 @@ $col_name = '<span class="' . $col .'">' . $col_name . '</span>'; } - $sort_class = $col == $sort_col && !$disabled_order ? " sorted$sort_order" : ''; + $sort_class = $rel_col == $sort_col && !$disabled_order ? " sorted$sort_order" : ''; $class_name = $col.$sort_class; // put it all together @@ -1190,7 +1193,16 @@ // unsupported (e.g. encrypted) if ($part->realtype) { if ($part->realtype == 'multipart/encrypted' || $part->realtype == 'application/pkcs7-mime') { - $out .= html::span('part-notice', $RCMAIL->gettext('encryptedmessage')); + if (!empty($_SESSION['browser_caps']['pgpmime']) && ($pgp_mime_part = $MESSAGE->get_multipart_encrypted_part())) { + $out .= html::span('part-notice', $RCMAIL->gettext('externalmessagedecryption')); + $OUTPUT->set_env('pgp_mime_part', $pgp_mime_part->mime_id); + $OUTPUT->set_env('pgp_mime_container', '#' . $attrib['id']); + $OUTPUT->add_label('loadingdata'); + } + + if (!$MESSAGE->encrypted_part) { + $out .= html::span('part-notice', $RCMAIL->gettext('encryptedmessage')); + } } continue; } @@ -1224,6 +1236,11 @@ rcmail_message_error($MESSAGE->uid); } + // check if the message body is PGP encrypted + if (strpos($body, 'BEGIN PGP MESSAGE') !== false) { + $OUTPUT->set_env('is_pgp_content', '#' . $attrib['id']); + } + $plugin = $RCMAIL->plugins->exec_hook('message_body_prefix', array('part' => $part, 'prefix' => '')); -- Gitblit v1.9.1