| | |
| | | break; |
| | | } |
| | | if (!empty($this->prefs['debug_mode'])) { |
| | | write_log('imap', 'S: '. chop($buffer)); |
| | | write_log('imap', 'S: '. rtrim($buffer)); |
| | | } |
| | | $line .= $buffer; |
| | | } while ($buffer[strlen($buffer)-1] != "\n"); |
| | |
| | | |
| | | private function multLine($line, $escape=false) |
| | | { |
| | | $line = chop($line); |
| | | $line = rtrim($line); |
| | | if (preg_match('/\{[0-9]+\}$/', $line)) { |
| | | $out = ''; |
| | | |
| | |
| | | |
| | | if ($this->putLine("sel1 SELECT \"".$this->escape($mailbox).'"')) { |
| | | do { |
| | | $line = chop($this->readLine(300)); |
| | | $line = rtrim($this->readLine(300)); |
| | | $a = explode(' ', $line); |
| | | if (count($a) == 3) { |
| | | $token = strtoupper($a[2]); |
| | |
| | | return false; |
| | | } |
| | | do { |
| | | $line = chop($this->readLine()); |
| | | $line = rtrim($this->readLine()); |
| | | if ($this->startsWith($line, '* SORT')) { |
| | | $data .= substr($line, 7); |
| | | } else if (preg_match('/^[0-9 ]+$/', $line)) { |
| | |
| | | $result = array(); |
| | | |
| | | do { |
| | | $line = chop($this->readLine(200)); |
| | | $line = rtrim($this->readLine(200)); |
| | | $line = $this->multLine($line); |
| | | |
| | | if (preg_match('/^\* ([0-9]+) FETCH/', $line, $m)) { |
| | |
| | | $result = -1; |
| | | if ($this->putLine("fuid FETCH $id (UID)")) { |
| | | do { |
| | | $line = chop($this->readLine(1024)); |
| | | $line = rtrim($this->readLine(1024)); |
| | | if (preg_match("/^\* $id FETCH \(UID (.*)\)/i", $line, $r)) { |
| | | $result = $r[1]; |
| | | } |
| | |
| | | if (!$line) |
| | | break; |
| | | |
| | | $a = explode(' ', $line); |
| | | |
| | | if (($line[0] == '*') && ($a[2] == 'FETCH')) { |
| | | $id = $a[1]; |
| | | if (preg_match('/^\* ([0-9]+) FETCH/', $line, $m)) { |
| | | $id = $m[1]; |
| | | |
| | | $result[$id] = new rcube_mail_header; |
| | | $result[$id]->id = $id; |
| | |
| | | // to the next valid header line. |
| | | |
| | | do { |
| | | $line = chop($this->readLine(300), "\r\n"); |
| | | $line = rtrim($this->readLine(300), "\r\n"); |
| | | |
| | | // The preg_match below works around communigate imap, which outputs " UID <number>)". |
| | | // Without this, the while statement continues on and gets the "FH0 OK completed" message. |
| | |
| | | break; |
| | | } // end switch () |
| | | } // end while () |
| | | } else { |
| | | $a = explode(' ', $line); |
| | | } |
| | | |
| | | // process flags |
| | |
| | | $flags_a = explode(' ', $flags_str); |
| | | |
| | | if (is_array($flags_a)) { |
| | | // reset($flags_a); |
| | | foreach($flags_a as $flag) { |
| | | $flag = strtoupper($flag); |
| | | if ($flag == 'SEEN') { |
| | |
| | | } |
| | | |
| | | do { |
| | | $line = $this->readLine(1000); |
| | | $line = $this->readLine(); |
| | | if ($line[0] == '*') { |
| | | $c++; |
| | | } |
| | |
| | | } |
| | | |
| | | $data = ''; |
| | | $query = 'srch1 ' . ($return_uid ? 'UID ' : '') . 'SEARCH ' . chop($criteria); |
| | | $query = 'srch1 ' . ($return_uid ? 'UID ' : '') . 'SEARCH ' . trim($criteria); |
| | | |
| | | if (!$this->putLineC($query)) { |
| | | return false; |
| | |
| | | } |
| | | |
| | | do { |
| | | $line = $this->readLine(1000); |
| | | $line = $this->readLine(1024); |
| | | $line = $this->multLine($line); |
| | | |
| | | if (preg_match('/BODY\[([0-9\.]+)\.'.$type.'\]/', $line, $matches)) { |
| | |
| | | |
| | | // receive reply line |
| | | do { |
| | | $line = chop($this->readLine(1000)); |
| | | $line = rtrim($this->readLine(1024)); |
| | | $a = explode(' ', $line); |
| | | } while (!($end = $this->startsWith($line, $key, true)) && $a[2] != 'FETCH'); |
| | | |
| | |
| | | // get line(s) containing quota info |
| | | if ($this->putLine('QUOT1 GETQUOTAROOT "INBOX"')) { |
| | | do { |
| | | $line = chop($this->readLine(5000)); |
| | | $line = rtrim($this->readLine(5000)); |
| | | if ($this->startsWith($line, '* QUOTA ')) { |
| | | $quota_lines[] = $line; |
| | | } |