Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 public function connector_onReceive(AbstractConnector $connector, $packet)
 {
     $this->onPacket->run($this, Stanza::fromXml($packet, $this));
 }
Exemplo n.º 3
0
 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;
         }
     }
 }