示例#1
0
文件: Message.php 项目: vincebe/xmpp
 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;
 }
示例#2
0
 public function connector_onReceive(AbstractConnector $connector, $packet)
 {
     $this->onPacket->run($this, Stanza::fromXml($packet, $this));
 }
示例#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;
         }
     }
 }