From ee89c6dff6a309bd6d024a725eb24d79b4ac1236 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sat, 02 Mar 2013 10:13:08 -0500
Subject: [PATCH] Display notice that message is encrypted also for application/pkcs7-mime messages (#1488526)

---
 program/steps/mail/func.inc             |    4 ++--
 program/lib/Roundcube/rcube_message.php |   11 +++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/program/lib/Roundcube/rcube_message.php b/program/lib/Roundcube/rcube_message.php
index e0c3e34..dc70807 100644
--- a/program/lib/Roundcube/rcube_message.php
+++ b/program/lib/Roundcube/rcube_message.php
@@ -468,6 +468,17 @@
 
             $this->parts[] = $p;
         }
+        // this is an S/MIME ecrypted message -> create a plaintext body with the according message
+        else if ($mimetype == 'application/pkcs7-mime') {
+            $p = new stdClass;
+            $p->type            = 'content';
+            $p->ctype_primary   = 'text';
+            $p->ctype_secondary = 'plain';
+            $p->mimetype        = 'text/plain';
+            $p->realtype        = 'application/pkcs7-mime';
+
+            $this->parts[] = $p;
+        }
         // message contains multiple parts
         else if (is_array($structure->parts) && !empty($structure->parts)) {
             // iterate over parts
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 36ac1aa..4a34763 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -1083,9 +1083,9 @@
         $out .= html::div('message-partheaders', rcmail_message_headers(sizeof($header_attrib) ? $header_attrib : null, $part->headers));
       }
       else if ($part->type == 'content') {
-        // unsapported
+        // unsupported (e.g. encrypted)
         if ($part->realtype) {
-          if ($part->realtype == 'multipart/encrypted') {
+          if ($part->realtype == 'multipart/encrypted' || $part->realtype == 'application/pkcs7-mime') {
             $out .= html::span('part-notice', rcube_label('encryptedmessage'));
           }
           continue;

--
Gitblit v1.9.1