| | |
| | | } |
| | | |
| | | // don't use it in loops, until you exactly know what you're doing |
| | | private function readReply() |
| | | private function readReply($untagged=null) |
| | | { |
| | | do { |
| | | $line = trim($this->readLine(1024)); |
| | | // store untagged response lines |
| | | if ($line[0] == '*') |
| | | $untagged[] = $line; |
| | | } while ($line[0] == '*'); |
| | | |
| | | if ($untagged) |
| | | $untagged = join("\n", $untagged); |
| | | |
| | | return $line; |
| | | } |
| | |
| | | { |
| | | $this->putLine('a001 LOGIN "'.$this->escape($user).'" "'.$this->escape($password).'"'); |
| | | |
| | | $line = $this->readReply(); |
| | | $line = $this->readReply($untagged); |
| | | |
| | | // re-set capabilities list if untagged CAPABILITY response provided |
| | | if (preg_match('/\* CAPABILITY (.+)/i', $untagged, $matches)) { |
| | | $this->capability = explode(' ', strtoupper($matches[1])); |
| | | } |
| | | |
| | | // process result |
| | | $result = $this->parseResult($line); |