From 2965a981b7ec22866fbdf2d567d87e2d068d3617 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Fri, 31 Jul 2015 16:04:08 -0400
Subject: [PATCH] Allow to search and import missing PGP pubkeys from keyservers using Publickey.js

---
 program/lib/Roundcube/rcube_message.php |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/program/lib/Roundcube/rcube_message.php b/program/lib/Roundcube/rcube_message.php
index 6c6248e..c727990 100644
--- a/program/lib/Roundcube/rcube_message.php
+++ b/program/lib/Roundcube/rcube_message.php
@@ -103,12 +103,12 @@
 
         $this->set_safe((intval($_GET['_safe']) || $_SESSION['safe_messages'][$this->folder.':'.$uid]));
         $this->opt = array(
-            'safe' => $this->is_safe,
+            'safe'        => $this->is_safe,
             'prefer_html' => $this->app->config->get('prefer_html'),
-            'get_url' => $this->app->url(array(
-                'action' => 'get',
-                'mbox'   => $this->storage->get_folder(),
-                'uid'    => $uid))
+            'get_url'     => $this->app->url(array(
+                    'action' => 'get',
+                    'mbox'   => $this->folder,
+                    'uid'    => $uid))
         );
 
         if (!empty($this->headers->structure)) {
@@ -579,8 +579,10 @@
                     $related_part = $p;
                 else if ($sub_mimetype == 'text/plain' && !$plain_part)
                     $plain_part = $p;
-                else if ($sub_mimetype == 'text/html' && !$html_part)
+                else if ($sub_mimetype == 'text/html' && !$html_part) {
                     $html_part = $p;
+                    $this->got_html_part = true;
+                }
                 else if ($sub_mimetype == 'text/enriched' && !$enriched_part)
                     $enriched_part = $p;
                 else {
@@ -705,7 +707,7 @@
                         continue;
 
                     if ($part_mimetype == 'text/html' && $mail_part->size) {
-                        $got_html_part = true;
+                        $this->got_html_part = true;
                     }
 
                     $mail_part = $plugin['structure'];
@@ -750,8 +752,6 @@
                         $this->mime_parts[$mail_part->mime_id] = $mail_part;
                         $this->attachments[] = $mail_part;
                     }
-
-                    $tnef_parts = null;
                 }
                 // part is a file/attachment
                 else if (preg_match('/^(inline|attach)/', $mail_part->disposition) ||
@@ -827,7 +827,7 @@
                         // MS Outlook sends sometimes non-related attachments as related
                         // In this case multipart/related message has only one text part
                         // We'll add all such attachments to the attachments list
-                        if (!isset($got_html_part) && empty($inline_object->content_id)) {
+                        if (!isset($this->got_html_part)) {
                             $this->attachments[] = $inline_object;
                         }
                         // MS Outlook sometimes also adds non-image attachments as related
@@ -1038,5 +1038,4 @@
     {
         return rcube_mime::format_flowed($text, $length);
     }
-
 }

--
Gitblit v1.9.1