Use IMAP BINARY (RFC3516) extension to fetch message/part bodies (experimental)

pull/22/merge
Aleksander Machniak 12 years ago
parent 524e48e99a
commit bf1d94076d

@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
- Use IMAP BINARY (RFC3516) extension to fetch message/part bodies
- Fix invalid error message on deleting mail from read only folder (#1488694)
- Fix error where session wasn't updated after folder rename/delete (#1488692)
- Replace data URIs of images (pasted in HTML editor) with inline attachments (#1488502)

@ -2402,10 +2402,13 @@ class rcube_imap_generic
$mode = 0;
}
// Use BINARY extension when possible (and safe)
$binary = $mode && preg_match('/^[0-9.]+$/', $part) && $this->hasCapability('BINARY');
$fetch_mode = $binary ? 'BINARY' : 'BODY';
// format request
$reply_key = '* ' . $id;
$key = $this->nextTag();
$request = $key . ($is_uid ? ' UID' : '') . " FETCH $id (BODY.PEEK[$part])";
$request = $key . ($is_uid ? ' UID' : '') . " FETCH $id ($fetch_mode.PEEK[$part])";
// send request
if (!$this->putLine($request)) {
@ -2413,6 +2416,10 @@ class rcube_imap_generic
return false;
}
if ($binary) {
$mode = -1;
}
// receive reply line
do {
$line = rtrim($this->readLine(1024));
@ -2457,13 +2464,13 @@ class rcube_imap_generic
$prev = '';
while ($bytes > 0) {
$line = $this->readLine(4096);
$line = $this->readLine(8192);
if ($line === NULL) {
break;
}
$len = strlen($line);
$len = strlen($line);
if ($len > $bytes) {
$line = substr($line, 0, $bytes);

Loading…
Cancel
Save