summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortill <till@php.net>2008-02-05 14:12:47 +0000
committertill <till@php.net>2008-02-05 14:12:47 +0000
commita527781d5ae365c926c137a6c59895421aeab951 (patch)
treea61b9a0276d0242a4af35fec07b0f018f3a568d7
parentcb3badb7d846f0a4b1d6f281b1cb04081a68b81a (diff)
* added FIXME
* tried to debug a loop
-rw-r--r--program/lib/imap.inc11
1 files changed, 7 insertions, 4 deletions
diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index a7462a373..11ab370d9 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -162,11 +162,12 @@ function iil_ReadLine($fp, $size) {
$line = '';
if ($fp) {
do {
+ // FIXME: hardcode size?
$buffer = fgets($fp, 2048);
if ($buffer === false) {
break;
}
- $line.=$buffer;
+ $line .= $buffer;
} while ($buffer[strlen($buffer)-1]!="\n");
}
return $line;
@@ -176,12 +177,14 @@ function iil_MultLine($fp, $line) {
$line = chop($line);
if (ereg('\{[0-9]+\}$', $line)) {
$out = '';
+
preg_match_all('/(.*)\{([0-9]+)\}$/', $line, $a);
$bytes = $a[2][0];
- while (strlen($out)<$bytes) {
- $out.=chop(iil_ReadLine($fp, 1024));
+ while (strlen($out) < $bytes) {
+ $line = iil_ReadLine($fp, 1024);
+ $out .= chop($line);
}
- $line = $a[1][0]."\"$out\"";
+ $line = $a[1][0] . "\"$out\"";
}
return $line;
}