public function __construct($body = null, $to = null, $type = 'chat', $from = null) { parent::__construct('message'); if ($body !== null) { $this->body = $body; } if ($from !== null) { $this->from = $from; } if ($to !== null) { $this->to = $to; } $this->type = $type; }
public function connector_onReceive(AbstractConnector $connector, $packet) { $this->onPacket->run($this, Stanza::fromXml($packet, $this)); }
public function _onPacket($conn, $xml) { if (substr($xml, 1, 7) == 'stream:') { $packet = XmlBranch::fromXml($xml); switch ($packet->tag) { case "stream": $this->_info = (object) $packet->attributes; $this->onOpen->run($this, $this->_info); break; case "error": $this->onStreamError->run($this, $packet); break; case "features": $this->_features = Stanza::fromXml($xml); $this->onFeatures->run($this, $this->_features); break; } } }