summaryrefslogtreecommitdiff
path: root/program/lib/imap.inc
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2008-07-31 14:48:00 +0000
committerthomascube <thomas@roundcube.net>2008-07-31 14:48:00 +0000
commite1367cf1a6d2ea857c57ad1677de1a8f0c1f1a3e (patch)
tree43b38d3743999357b73e5a7c65dec8dd69778460 /program/lib/imap.inc
parentf92aba3918575f30f577542753a2912df5729374 (diff)
Ignore untagged responses when fetching BODYSTRUCTURE (patch by B. Johannessen)
Diffstat (limited to 'program/lib/imap.inc')
-rw-r--r--program/lib/imap.inc6
1 files changed, 4 insertions, 2 deletions
diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index 757fbf6e8..da709faf3 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -2570,12 +2570,14 @@ function iil_C_FetchStructureString(&$conn, $folder, $id) {
if (iil_C_Select($conn, $folder)) {
$key = 'F1247';
-
+
if (iil_PutLine($fp, "$key FETCH $id (BODYSTRUCTURE)")) {
do {
$line = iil_ReadLine($fp, 5000);
$line = iil_MultLine($fp, $line);
- $result .= $line;
+ list(, $index, $rest) = explode(' ', $line);
+ if ($index == $id || preg_match("/^$key/", $line))
+ $result .= $line;
} while (!preg_match("/^$key/", $line));
$result = trim(substr($result, strpos($result, 'BODYSTRUCTURE')+13, -(strlen($result)-strrpos($result, $key)+1)));