示例#1
0
 /**
  * @param ProtocolNode $node
  */
 protected function writeInternal($node)
 {
     $len = 1;
     if ($node->getAttributes() != null) {
         $len += count($node->getAttributes()) * 2;
     }
     if (count($node->getChildren()) > 0) {
         $len += 1;
     }
     if (strlen($node->getData()) > 0) {
         $len += 1;
     }
     $this->writeListStart($len);
     $this->writeString($node->getTag());
     $this->writeAttributes($node->getAttributes());
     if (strlen($node->getData()) > 0) {
         $this->writeBytes($node->getData());
     }
     if ($node->getChildren()) {
         $this->writeListStart(count($node->getChildren()));
         foreach ($node->getChildren() as $child) {
             $this->writeInternal($child);
         }
     }
 }
示例#2
0
 /**
  * @param ProtocolNode $groupNode
  * @param mixed        $fromGetGroups
  */
 protected function handleGroupV2InfoResponse(ProtocolNode $groupNode, $fromGetGroups = false)
 {
     $creator = $groupNode->getAttribute('creator');
     $creation = $groupNode->getAttribute('creation');
     $subject = $groupNode->getAttribute('subject');
     $groupID = $groupNode->getAttribute('id');
     $participants = array();
     $admins = array();
     if ($groupNode->getChild(0) != null) {
         foreach ($groupNode->getChildren() as $child) {
             $participants[] = $child->getAttribute('jid');
             if ($child->getAttribute('type') == "admin") {
                 $admins[] = $child->getAttribute('jid');
             }
         }
     }
     $this->eventManager()->fire("onGetGroupV2Info", array($this->phoneNumber, $groupID, $creator, $creation, $subject, $participants, $admins, $fromGetGroups));
 }