/** * Stream server. * * @param XMLEvent $event XMLEvent * @return void */ public function streamServer(XMLEvent $event) { if (false === $event->isStartTag()) { $this->blocking = false; if ($this->getConnection()->isConnected()) { $this->getConnection()->disconnect(); } } }
/** * Start TLS response. * * @param XMLEvent $event XMLEvent object * @return void */ public function proceed(XMLEvent $event) { if (false === $event->isStartTag()) { $this->blocking = false; $connection = $this->getConnection(); if ($connection instanceof SocketConnectionInterface) { $connection->getSocket()->crypto(true, STREAM_CRYPTO_METHOD_SSLv23_CLIENT); } $connection->resetStreams(); $connection->connect(); } }
/** * Authentication successful. * * @param XMLEvent $event */ public function success(XMLEvent $event) { if (false === $event->isStartTag()) { $this->blocking = false; $connection = $this->getConnection(); $connection->resetStreams(); $connection->connect(); $this->getOptions()->setAuthenticated(true); } }
/** * Throws an exception when stream error comes from input stream. * * @param \Fabiang\Xmpp\Event\XMLEvent $event * @throws StreamErrorException */ public function error(XMLEvent $event) { if (false === $event->isStartTag()) { throw StreamErrorException::createFromEvent($event); } }