From 53fa08d8ae051d10bed7fb08840d2f873e75c264 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Mon, 25 Jan 2016 03:53:33 -0500
Subject: [PATCH] Enigma: Code refactoring with better handling of encrypted-inside-encrypted (e.g. forwarded) and signed+ncrypted messages

---
 program/lib/Roundcube/rcube_mime_decode.php |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/program/lib/Roundcube/rcube_mime_decode.php b/program/lib/Roundcube/rcube_mime_decode.php
index f624f8d..a865c25 100644
--- a/program/lib/Roundcube/rcube_mime_decode.php
+++ b/program/lib/Roundcube/rcube_mime_decode.php
@@ -67,18 +67,18 @@
     /**
      * Performs the decoding process.
      *
-     * @param string $input The input to decode
+     * @param string $input   The input to decode
+     * @param bool   $convert Convert result to rcube_message_part structure
      *
      * @return object|bool Decoded results or False on failure
      */
-    public function decode($input)
+    public function decode($input, $convert = true)
     {
         list($header, $body) = $this->splitBodyHeader($input);
 
-        // @TODO: Since this is a part of Roundcube Framework
-        // we should return rcube_message_part structure
+        $struct = $this->do_decode($header, $body);
 
-        if ($struct = $this->do_decode($header, $body)) {
+        if ($struct && $convert) {
             $struct = $this->structure_part($struct);
         }
 
@@ -194,7 +194,7 @@
 
             case 'message/rfc822':
                 $obj = new rcube_mime_decode($this->params);
-                $return->parts[] = $obj->decode($body);
+                $return->parts[] = $obj->decode($body, false);
                 unset($obj);
                 break;
 

--
Gitblit v1.9.1