| | |
| | | if ($result == self::ERROR_OK) { |
| | | // optional CAPABILITY response |
| | | if ($line && preg_match('/\[CAPABILITY ([^]]+)\]/i', $line, $matches)) { |
| | | $this->parseCapability($matches[1]); |
| | | $this->parseCapability($matches[1], true); |
| | | } |
| | | return $this->fp; |
| | | } |
| | |
| | | |
| | | // re-set capabilities list if untagged CAPABILITY response provided |
| | | if (preg_match('/\* CAPABILITY (.+)/i', $response, $matches)) { |
| | | $this->parseCapability($matches[1]); |
| | | $this->parseCapability($matches[1], true); |
| | | } |
| | | |
| | | if ($code == self::ERROR_OK) { |
| | |
| | | |
| | | // RFC3501 [7.1] optional CAPABILITY response |
| | | if (preg_match('/\[CAPABILITY ([^]]+)\]/i', $line, $matches)) { |
| | | $this->parseCapability($matches[1]); |
| | | $this->capability_readed = true; |
| | | $this->parseCapability($matches[1], true); |
| | | } |
| | | |
| | | $this->message .= $line; |
| | |
| | | $auth_methods[] = $auth_method == 'AUTH' ? 'CRAM-MD5' : $auth_method; |
| | | } |
| | | |
| | | // pre-login capabilities can be not complete |
| | | $this->capability_readed = false; |
| | | |
| | | // Authenticate |
| | | foreach ($auth_methods as $method) { |
| | | switch ($method) { |
| | |
| | | // Connected and authenticated |
| | | if (is_resource($result)) { |
| | | if ($this->prefs['force_caps']) { |
| | | // forget current capabilities |
| | | $this->clearCapability(); |
| | | } else { |
| | | // pre-login capabilities can be not complete |
| | | $this->capability_readed = false; |
| | | } |
| | | $this->getRootDir(); |
| | | $this->logged = true; |
| | |
| | | if (($options & self::COMMAND_CAPABILITY) && $code == self::ERROR_OK |
| | | && preg_match('/\[CAPABILITY ([^]]+)\]/i', $line, $matches) |
| | | ) { |
| | | $this->parseCapability($matches[1]); |
| | | $this->parseCapability($matches[1], true); |
| | | } |
| | | |
| | | return $noresp ? $code : array($code, $response); |
| | |
| | | return $string; |
| | | } |
| | | |
| | | private function parseCapability($str) |
| | | private function parseCapability($str, $trusted=false) |
| | | { |
| | | $str = preg_replace('/^\* CAPABILITY /i', '', $str); |
| | | |
| | |
| | | if (!isset($this->prefs['literal+']) && in_array('LITERAL+', $this->capability)) { |
| | | $this->prefs['literal+'] = true; |
| | | } |
| | | |
| | | if ($trusted) { |
| | | $this->capability_readed = true; |
| | | } |
| | | } |
| | | |
| | | /** |