summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-06-08 12:46:05 +0000
committeralecpl <alec@alec.pl>2010-06-08 12:46:05 +0000
commit64e3e80743415e5fb121eb5c66416593c38ef288 (patch)
treefdf160e8eb9580deab6c4fc2cbdb3ceb63d3c76f /program/include
parentb93d00026aefbdccfabd6253f9cb184956617084 (diff)
- Fix some IMAP errors handling when opening the message (#1485443)
Diffstat (limited to 'program/include')
-rw-r--r--program/include/rcube_imap.php4
-rw-r--r--program/include/rcube_imap_generic.php12
-rw-r--r--program/include/rcube_message.php9
3 files changed, 14 insertions, 11 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index f48372ac7..6f3b40206 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -2061,7 +2061,7 @@ class rcube_imap
return true;
// convert charset (if text or message part)
- if ($o_part->ctype_primary == 'text' || $o_part->ctype_primary == 'message') {
+ if ($body && ($o_part->ctype_primary == 'text' || $o_part->ctype_primary == 'message')) {
// assume default if no charset specified
if (empty($o_part->charset) || strtolower($o_part->charset) == 'us-ascii')
$o_part->charset = $this->default_charset;
@@ -2628,7 +2628,7 @@ class rcube_imap
// retrieve list of folders from IMAP server
$a_mboxes = $this->conn->listMailboxes($this->mod_mailbox($root), $filter);
}
-
+
$a_folders = array();
if (!is_array($a_mboxes))
$a_mboxes = array();
diff --git a/program/include/rcube_imap_generic.php b/program/include/rcube_imap_generic.php
index d5a5e3d4b..7669ceb32 100644
--- a/program/include/rcube_imap_generic.php
+++ b/program/include/rcube_imap_generic.php
@@ -1777,12 +1777,11 @@ class rcube_imap_generic
$mode = 0;
}
+ // format request
$reply_key = '* ' . $id;
- $result = false;
+ $key = 'ftch0';
+ $request = $key . ($is_uid ? ' UID' : '') . " FETCH $id (BODY.PEEK[$part])";
- // format request
- $key = 'ftch0';
- $request = $key . ($is_uid ? ' UID' : '') . " FETCH $id (BODY.PEEK[$part])";
// send request
if (!$this->putLine($request)) {
return false;
@@ -1794,7 +1793,8 @@ class rcube_imap_generic
$a = explode(' ', $line);
} while (!($end = $this->startsWith($line, $key, true)) && $a[2] != 'FETCH');
- $len = strlen($line);
+ $len = strlen($line);
+ $result = false;
// handle empty "* X FETCH ()" response
if ($line[$len-1] == ')' && $line[$len-2] != '(') {
@@ -1890,7 +1890,7 @@ class rcube_imap_generic
$line = $this->readLine(1024);
} while (!$this->startsWith($line, $key, true));
- if ($result) {
+ if ($result !== false) {
if ($file) {
fwrite($file, $result);
} else if ($print) {
diff --git a/program/include/rcube_message.php b/program/include/rcube_message.php
index 35a8f4a88..e51ab26e0 100644
--- a/program/include/rcube_message.php
+++ b/program/include/rcube_message.php
@@ -5,7 +5,7 @@
| program/include/rcube_message.php |
| |
| This file is part of the RoundCube Webmail client |
- | Copyright (C) 2008-2009, RoundCube Dev. - Switzerland |
+ | Copyright (C) 2008-2010, RoundCube Dev. - Switzerland |
| Licensed under the GNU GPL |
| |
| PURPOSE: |
@@ -63,14 +63,17 @@ class rcube_message
{
$this->app = rcmail::get_instance();
$this->imap = $this->app->imap;
-
+
$this->uid = $uid;
$this->headers = $this->imap->get_headers($uid, NULL, true, true);
+ if (!$this->headers)
+ return;
+
$this->subject = rcube_imap::decode_mime_string(
$this->headers->subject, $this->headers->charset);
list(, $this->sender) = each($this->imap->decode_address_list($this->headers->from));
-
+
$this->set_safe((intval($_GET['_safe']) || $_SESSION['safe_messages'][$uid]));
$this->opt = array(
'safe' => $this->is_safe,