From e2f30659a1bae74290df0e843bac5326cb05b79d Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 14 Dec 2011 04:08:54 -0500
Subject: [PATCH] - Backported r5598:r5599 from trunk

---
 program/include/rcube_imap.php |    5 +++--
 program/steps/mail/func.inc    |    5 +++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 1c5dd2e..2d7a94f 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -1636,6 +1636,7 @@
      * @param  string  $sort_field Header field to sort by
      * @return array   search results as list of message IDs
      * @access public
+     * @todo: Search criteria should be provided in non-IMAP format, eg. array
      */
     function search($mailbox='', $str=NULL, $charset=NULL, $sort_field=NULL)
     {
@@ -1775,9 +1776,9 @@
                 $string_offset = $m[1] + strlen($m[0]) + 4; // {}\r\n
                 $string = substr($str, $string_offset - 1, $m[0]);
                 $string = rcube_charset_convert($string, $charset, $dest_charset);
-                if (!$string)
+                if ($string === false)
                     continue;
-                $res .= sprintf("%s{%d}\r\n%s", substr($str, $last, $m[1] - $last - 1), strlen($string), $string);
+                $res .= substr($str, $last, $m[1] - $last - 1) . rcube_imap_generic::escape($string);
                 $last = $m[0] + $string_offset - 1;
             }
             if ($last < strlen($str))
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index e51c256..503a56b 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -1046,6 +1046,11 @@
   // list images after mail body
   if ($CONFIG['inline_images'] && !empty($MESSAGE->attachments)) {
     foreach ($MESSAGE->attachments as $attach_prop) {
+      // skip inline images
+      if ($attach_prop->content_id && $attach_prop->disposition == 'inline') {
+        continue;
+      }
+
       // Content-Type: image/*...
       if (preg_match('/^image\//i', $attach_prop->mimetype) ||
         // ...or known file extension: many clients are using application/octet-stream

--
Gitblit v1.9.1