From 0344b168276f80189e2254c75a762aff5b517b6b Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 22 May 2016 06:32:57 -0400
Subject: [PATCH] Fix priority icon(s) position
---
program/lib/Roundcube/rcube_message.php | 66 +++++++++++++++++++++++++--------
1 files changed, 50 insertions(+), 16 deletions(-)
diff --git a/program/lib/Roundcube/rcube_message.php b/program/lib/Roundcube/rcube_message.php
index c5c436f..c021d58 100644
--- a/program/lib/Roundcube/rcube_message.php
+++ b/program/lib/Roundcube/rcube_message.php
@@ -176,7 +176,7 @@
* Get content of a specific part of this message
*
* @param string $mime_id Part MIME-ID
- * @param resource $fp File pointer to save the message part
+ * @param resource $fp File pointer to save the message part
* @param boolean $skip_charset_conv Disables charset conversion
* @param int $max_bytes Only read this number of bytes
* @param boolean $formatted Enables formatting of text/* parts bodies
@@ -339,13 +339,17 @@
{
// check all message parts
foreach ($this->mime_parts as $part) {
- if (!$this->check_context($part)) {
- continue;
- }
-
if ($part->mimetype == 'text/html' || ($enriched && $part->mimetype == 'text/enriched')) {
// Skip if part is an attachment, don't use is_attachment() here
if ($part->filename) {
+ continue;
+ }
+
+ if (!$part->size) {
+ continue;
+ }
+
+ if (!$this->check_context($part)) {
continue;
}
@@ -361,19 +365,22 @@
return true;
}
- $parent = $this->mime_parts[join('.', $level)];
- $max_delta = $depth - (1 + ($last == 'multipart/alternative' ? 1 : 0));
- $last = $parent->mimetype;
+ $parent = $this->mime_parts[join('.', $level)];
- if (!preg_match('/^multipart\/(alternative|related|signed|encrypted|mixed)$/', $parent->mimetype)
- || ($parent->mimetype == 'multipart/mixed' && $parent_depth < $max_delta)) {
+ if (!$this->check_context($parent)) {
+ return true;
+ }
+
+ $max_delta = $depth - (1 + ($last == 'multipart/alternative' ? 1 : 0));
+ $last = $parent->real_mimetype ?: $parent->mimetype;
+
+ if (!preg_match('/^multipart\/(alternative|related|signed|encrypted|mixed)$/', $last)
+ || ($last == 'multipart/mixed' && $parent_depth < $max_delta)) {
continue 2;
}
}
- if ($part->size) {
- return true;
- }
+ return true;
}
}
@@ -400,6 +407,10 @@
continue;
}
+ if (!$part->size) {
+ continue;
+ }
+
if (!$this->check_context($part)) {
continue;
}
@@ -413,14 +424,17 @@
}
$parent = $this->mime_parts[join('.', $level)];
+
+ if (!$this->check_context($parent)) {
+ return true;
+ }
+
if ($parent->mimetype != 'multipart/alternative' && $parent->mimetype != 'multipart/related') {
continue 2;
}
}
- if ($part->size) {
- return true;
- }
+ return true;
}
}
@@ -479,6 +493,26 @@
}
/**
+ * Return message parts in current context
+ */
+ public function mime_parts()
+ {
+ if ($this->context === null) {
+ return $this->mime_parts;
+ }
+
+ $parts = array();
+
+ foreach ($this->mime_parts as $part_id => $part) {
+ if ($this->check_context($part)) {
+ $parts[$part_id] = $part;
+ }
+ }
+
+ return $parts;
+ }
+
+ /**
* Checks if part of the message is an attachment (or part of it)
*
* @param rcube_message_part $part Message part
--
Gitblit v1.9.1