public function disconnect() { $body = new XmlBranch('body'); $body->addAttribute('sid', $this->_info->sid)->addAttribute('rid', ++$this->_rid)->addAttribute('xmlns', 'http://jabber.org/protocol/httpbind')->addAttribute('type', 'terminate'); $packet = $body->asXml(); $this->onSend->run($this, $packet); $this->connection->send($packet, 'POST', ['Content-Type' => 'text/xml; charset=utf-8', 'Content-Length' => strlen($packet), 'Connection' => 'close']); foreach ($this->_connections as $connection) { $connection->disconnect(); } }
/** * Sets room (or conversation) subject. * * @param Jid $jid Jid to send subject msg. * @param string $subject New subject. * * @internal Plugins should use Room::subject() instead of that. */ public function setSubject(Jid $jid, $subject) { $msg = new XmlBranch('message'); $msg->addAttribute('from', $this->jid->__toString())->addAttribute('to', $jid->__toString())->addAttribute('type', $jid->isChannel() ? 'groupchat' : 'chat'); $msg->addChild(new XmlBranch('subject'))->setContent($subject); $this->write($msg->asXml()); }
public function streamRestart($jid) { $stream = new XmlBranch('stream:stream'); $stream->addAttribute('to', $jid->server)->addAttribute('xmlns', 'jabber:client')->addAttribute('version', '1.0')->addAttribute('xmlns:stream', 'http://etherx.jabber.org/streams'); $this->_connection->send(str_replace('/>', '>', $stream->asXml())); }