| | |
| | | $len = 0; |
| | | do { |
| | | $d = fread($fp, $bytes-$len); |
| | | $data .= $d; |
| | | if ($len == strlen($data)) { |
| | | break; //nothing was read -> exit to avoid apache lockups |
| | | } |
| | | if(!empty($my_prefs['debug_mode'])) |
| | | write_log('imap', 'S: '. $d); |
| | | $len = strlen($data); |
| | | $data .= $d; |
| | | $data_len = strlen($data); |
| | | if ($len == $data_len) { |
| | | break; //nothing was read -> exit to avoid apache lockups |
| | | } |
| | | $len = $data_len; |
| | | } while ($len < $bytes); |
| | | |
| | | return $data; |
| | |
| | | return false; |
| | | } |
| | | |
| | | function iil_StartsWithI($string, $match, $bye=false) { |
| | | function iil_StartsWithI($string, $match, $error=false) { |
| | | $len = strlen($match); |
| | | if ($len == 0) { |
| | | return false; |
| | |
| | | if (strncasecmp($string, $match, $len) == 0) { |
| | | return true; |
| | | } |
| | | if ($bye && strncmp($string, '* BYE ', 6) == 0) { |
| | | if ($error && preg_match('/^\* (BYE|BAD) /i', $string)) { |
| | | return true; |
| | | |
| | | } |
| | |
| | | if (strcasecmp($a[2], 'EXISTS') == 0) { |
| | | $conn->exists = (int) $a[1]; |
| | | } |
| | | if (strcasecmp($a[2], 'RECENT') == 0) { |
| | | else if (strcasecmp($a[2], 'RECENT') == 0) { |
| | | $conn->recent = (int) $a[1]; |
| | | } |
| | | } |
| | |
| | | |
| | | if ($len > $bytes) { |
| | | $line = substr($line, 0, $bytes); |
| | | $len = strlen($line); |
| | | } |
| | | $bytes -= strlen($line); |
| | | $bytes -= $len; |
| | | |
| | | if ($mode == 1) { |
| | | $line = rtrim($line, "\t\r\n\0\x0B"); |
| | |
| | | do { |
| | | $line=iil_ReadLine($fp, 300); |
| | | } while ($line[0] != 'c'); |
| | | $conn->error = $line; |
| | | return (iil_ParseResult($line) == 0); |
| | | } |
| | | return false; |
| | |
| | | } while ($line[0] != 'd'); |
| | | return (iil_ParseResult($line) == 0); |
| | | } |
| | | $conn->error = "Couldn't send command\n"; |
| | | return false; |
| | | } |
| | | |