From 1ae11998589900b4161aa4af59e50f31f64ddc66 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Mon, 24 Oct 2011 14:08:53 -0400
Subject: [PATCH] - Improve handling of situation when FETCH returns OK, but no data
---
program/include/rcube_imap.php | 14 +++++++-------
program/include/rcube_imap_generic.php | 4 +++-
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 7ffb17a..834a639 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -1962,6 +1962,10 @@
$headers = $this->get_headers($uid, $mailbox);
+ // message doesn't exist?
+ if (empty($headers))
+ return null;
+
// structure might be cached
if (!empty($headers->structure))
return $headers;
@@ -2382,14 +2386,10 @@
$o_part->charset = rcube_imap_generic::getStructurePartCharset($structure, $part);
}
- // TODO: Add caching for message parts
-
- if (!$part) {
- $part = 'TEXT';
+ if ($o_part && $o_part->size) {
+ $body = $this->conn->handlePartBody($this->mailbox, $uid, true,
+ $part ? $part : 'TEXT', $o_part->encoding, $print, $fp);
}
-
- $body = $this->conn->handlePartBody($this->mailbox, $uid, true, $part,
- $o_part->encoding, $print, $fp);
if ($fp || $print) {
return true;
diff --git a/program/include/rcube_imap_generic.php b/program/include/rcube_imap_generic.php
index bcfaa81..ecd2949 100644
--- a/program/include/rcube_imap_generic.php
+++ b/program/include/rcube_imap_generic.php
@@ -2393,8 +2393,10 @@
$len = strlen($line);
$result = false;
+ if ($a[2] != 'FETCH') {
+ }
// handle empty "* X FETCH ()" response
- if ($line[$len-1] == ')' && $line[$len-2] != '(') {
+ else if ($line[$len-1] == ')' && $line[$len-2] != '(') {
// one line response, get everything between first and last quotes
if (substr($line, -4, 3) == 'NIL') {
// NIL response
--
Gitblit v1.9.1