summaryrefslogtreecommitdiff
path: root/program/lib/Roundcube
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-06-28 10:15:28 +0200
committerAleksander Machniak <alec@alec.pl>2013-06-28 10:15:28 +0200
commit7045bb9c07d31b6de5f2578d9a9f9971fc39f1cf (patch)
tree06923bf67cdd8a3100890ba6bb817e80833eb1d1 /program/lib/Roundcube
parentad052b81d854e2755d12f5693733ca5be012789c (diff)
Fix parsing one-line FETCH response, e.g. "* 1 FETCH (UID 9844 BODY[2.4] NIL)"
Diffstat (limited to 'program/lib/Roundcube')
-rw-r--r--program/lib/Roundcube/rcube_imap_generic.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/program/lib/Roundcube/rcube_imap_generic.php b/program/lib/Roundcube/rcube_imap_generic.php
index 2bf199c2b..1928c7094 100644
--- a/program/lib/Roundcube/rcube_imap_generic.php
+++ b/program/lib/Roundcube/rcube_imap_generic.php
@@ -2506,11 +2506,13 @@ class rcube_imap_generic
// handle one line response
if ($line[0] == '(' && substr($line, -1) == ')') {
// tokenize content inside brackets
+ // the content can be e.g.: (UID 9844 BODY[2.4] NIL)
$tokens = $this->tokenizeResponse(preg_replace('/(^\(|\)$)/', '', $line));
for ($i=0; $i<count($tokens); $i+=2) {
if (preg_match('/^(BODY|BINARY)/i', $tokens[$i])) {
- $result = $tokens[$i+1];
+ $i += 2; // skip BODY|BINARY and part number
+ $result = $tokens[$i];
$found = true;
break;
}
@@ -3492,7 +3494,7 @@ class rcube_imap_generic
break 2;
}
- // excluded chars: SP, CTL, ), [, ]
+ // excluded chars: SP, CTL, ), [, ], DEL
if (preg_match('/^([^\x00-\x20\x29\x5B\x5D\x7F]+)/', $str, $m)) {
$result[] = $m[1] == 'NIL' ? NULL : $m[1];
$str = substr($str, strlen($m[1]));