/** * {@inheritDoc} */ public function connect() { if (false === $this->connected) { $address = $this->getAddress(); $this->getSocket()->connect($this->getOptions()->getTimeout()); $this->getSocket()->setBlocking(true); $this->connected = true; $this->log("Connected to '{$address}'", LogLevel::DEBUG); } $this->send(sprintf(static::STREAM_START, XML::quote($this->getOptions()->getTo()))); }
/** * {@inheritDoc} */ public function toString() { $presence = '<presence'; if (null !== $this->getTo()) { $presence .= ' to="' . XML::quote($this->getTo()) . '/' . XML::quote($this->getNickname()) . '"'; } return $presence . '><priority>' . $this->getPriority() . '</priority></presence>'; }
/** * {@inheritDoc} */ public function authenticate($username, $password) { $authString = XML::quote(base64_encode("" . $username . "" . $password)); $this->getConnection()->send('<auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN">' . $authString . '</auth>'); }