示例#1
0
 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()));
 }
示例#2
0
 /**
  * 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());
 }
示例#3
0
 public function streamRestart($jid)
 {
     $body = new XmlBranch('body');
     $body->addAttribute('content', 'text/xml; charset=utf-8')->addAttribute('from', (string) $jid)->addAttribute('to', $jid->server)->addAttribute('rid', $this->_rid++)->addAttribute('xml:lang', 'en')->addAttribute('xmlns', 'http://jabber.org/protocol/httpbind')->addAttribute('xmlns:xmpp', 'urn:xmpp:xbosh');
     if (!isset($this->_info)) {
         $body->addAttribute('ver', '1.6')->addAttribute('wait', 60)->addAttribute('hold', 1)->addAttribute('ack', $this->_ack)->addAttribute('xmpp:version', '1.0');
     } else {
         $body->addAttribute('sid', $this->_info->id)->addAttribute('xmpp:restart', 'true');
     }
     $body = $body->asXml();
     $this->onSend->run($this, $body);
     $this->connection->send($body, 'POST', ['Content-Type' => 'text/xml; charset=utf-8', 'Content-Length' => strlen($body)]);
 }