alecpl
2009-07-30 03a63a4a032c1202ddfa4fba53c091953659b153
program/lib/imap.inc
@@ -243,6 +243,7 @@
    
   do {
          $buffer = fgets($fp, $size);
          if ($buffer === false) {
              break;
          }
@@ -290,6 +291,7 @@
   return $data;
}
// don't use it in loops, until you exactly know what you're doing
function iil_ReadReply($fp) {
   do {
      $line = trim(iil_ReadLine($fp, 1024));
@@ -442,12 +444,7 @@
    iil_PutLine($conn->fp, 'a001 LOGIN "'.iil_Escape($user).'" "'.iil_Escape($password).'"');
    do {
        $line = iil_ReadReply($conn->fp);
        if ($line === false) {
            break;
        }
    } while (!iil_StartsWith($line, 'a001 ', true));
    
    // process result
    $result = iil_ParseResult($line);
@@ -589,7 +586,6 @@
   } else if ($my_prefs['sort_field'] == 'DATE') {
          $IMAP_USE_INTERNAL_DATE = false;
   }
   //echo '<!-- conn sort_field: '.$my_prefs['sort_field'].' //-->';
   
   //check input
   if (empty($host)) {
@@ -626,6 +622,9 @@
   stream_set_timeout($conn->fp, 10);
   $line = stream_get_line($conn->fp, 8192, "\r\n");
   if ($my_prefs['debug_mode'] && $line)
      write_log('imap', 'S: '. $line);
   // Connected to wrong port or connection error?
   if (!preg_match('/^\* (OK|PREAUTH)/i', $line)) {
      if ($line)