summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2009-07-14 06:46:30 +0000
committeralecpl <alec@alec.pl>2009-07-14 06:46:30 +0000
commit9db29eef64b6b62cd560e6880831f610d1358087 (patch)
tree2a365301b5f281aab7e1cbb22e2ce4ba71df555f
parentcb19db28edce4a4fe52ca1288a8ea274dd6a06ae (diff)
- fix debug output from iil_C_Append() + some more connection errors handlers
-rw-r--r--program/lib/imap.inc26
1 files changed, 13 insertions, 13 deletions
diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index db94fac2b..514e22717 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -2350,7 +2350,7 @@ function iil_C_CreateFolder(&$conn, $folder) {
if (iil_PutLine($fp, 'c CREATE "' . iil_Escape($folder) . '"')) {
do {
$line=iil_ReadLine($fp, 300);
- } while ($line[0] != 'c');
+ } while (!iil_StartsWith($line, 'c ', true));
return (iil_ParseResult($line) == 0);
}
return false;
@@ -2361,7 +2361,7 @@ function iil_C_RenameFolder(&$conn, $from, $to) {
if (iil_PutLine($fp, 'r RENAME "' . iil_Escape($from) . '" "' . iil_Escape($to) . '"')) {
do {
$line = iil_ReadLine($fp, 300);
- } while ($line[0] != 'r');
+ } while (!iil_StartsWith($line, 'r ', true));
return (iil_ParseResult($line) == 0);
}
return false;
@@ -2372,7 +2372,7 @@ function iil_C_DeleteFolder(&$conn, $folder) {
if (iil_PutLine($fp, 'd DELETE "' . iil_Escape($folder). '"')) {
do {
$line=iil_ReadLine($fp, 300);
- } while ($line[0] != 'd');
+ } while (!iil_StartsWith($line, 'd ', true));
return (iil_ParseResult($line) == 0);
}
return false;
@@ -2392,14 +2392,14 @@ function iil_C_Append(&$conn, $folder, &$message) {
return false;
}
- $request = 'A APPEND "' . iil_Escape($folder) .'" (\\Seen) {' . $len . '}';
+ $request = 'a APPEND "' . iil_Escape($folder) .'" (\\Seen) {' . $len . '}';
if (iil_PutLine($fp, $request)) {
- $line=iil_ReadLine($fp, 100);
- $sent = fwrite($fp, $message."\r\n");
+ $line = iil_ReadLine($fp, 100);
+ $sent = iil_PutLine($fp, $message);
do {
- $line=iil_ReadLine($fp, 1000);
- } while ($line[0] != 'A');
+ $line=iil_ReadLine($fp);
+ } while (!iil_StartsWith($line, 'a ', true));
$result = (iil_ParseResult($line) == 0);
if (!$result) {
@@ -2434,7 +2434,7 @@ function iil_C_AppendFromFile(&$conn, $folder, $path) {
}
//send APPEND command
- $request = 'A APPEND "' . iil_Escape($folder) . '" (\\Seen) {' . $len . '}';
+ $request = 'a APPEND "' . iil_Escape($folder) . '" (\\Seen) {' . $len . '}';
$bytes_sent = 0;
if (iil_PutLine($fp, $request)) {
$line = iil_ReadLine($fp, 100);
@@ -2447,12 +2447,12 @@ function iil_C_AppendFromFile(&$conn, $folder, $path) {
}
fclose($in_fp);
- iil_PutLine($fp, '');
+ iil_PutLine($fp, ''); // \r\n
//read response
do {
- $line = iil_ReadLine($fp, 1000);
- } while ($line[0] != 'A');
+ $line = iil_ReadLine($fp);
+ } while (!iil_StartsWith($line, 'a ', true));
$result = (iil_ParseResult($line) == 0);
if (!$result) {
@@ -2479,7 +2479,7 @@ function iil_C_FetchStructureString(&$conn, $folder, $id, $is_uid=false) {
$line = iil_MultLine($fp, $line);
if (!preg_match("/^$key/", $line))
$result .= $line;
- } while (!preg_match("/^$key/", $line));
+ } while (!iil_StartsWith($line, $key, true));
$result = trim(substr($result, strpos($result, 'BODYSTRUCTURE')+13, -1));
}