示例#1
0
 /**
  * @return Node
  */
 public function createNode()
 {
     $state = new Node();
     $state->setName($this->getState());
     $node = new Node();
     $node->setName('chatstate')->setAttribute('to', Identity::createJID($this->getTo()))->addChild($state);
     return $node;
 }
示例#2
0
 /**
  * @return Node
  */
 public function createNode()
 {
     $child = new Node();
     $child->setName('query');
     $node = new Node();
     $node->setName('iq');
     $node->setAttributes(["id" => 'getgroupinfo-', "type" => "get", "xmlns" => "w:g", "to" => Identity::createJID($this->getGroupId())]);
     $node->addChild($child);
     return $node;
 }
示例#3
0
 /**
  * @return Node
  */
 public function createNode()
 {
     $listNode = new Node();
     $listNode->setName('list');
     $listNode->setAttribute('type', $this->getType());
     $node = new Node();
     $node->setName('iq');
     $node->setAttributes(["id" => 'getgroups-', "type" => "get", "xmlns" => "w:g", "to" => "g.us"]);
     $node->addChild($listNode);
     return $node;
 }
示例#4
0
 /**
  * @return Node
  */
 public function createNode()
 {
     $node = new Node();
     $node->setName('iq')->setAttribute('type', 'set')->setAttribute('to', "s.whatsapp.net")->setAttribute('id', null)->setAttribute('xmlns', 'urn:xmpp:whatsapp:dirty');
     foreach ($this->getCategories() as $category) {
         $categoryNode = new Node();
         $categoryNode->setName('clean')->setAttribute('type', $category);
         $node->addChild($categoryNode);
     }
     return $node;
 }
示例#5
0
 /**
  * @return Node
  */
 public function createNode()
 {
     $server = new Node();
     $server->setName('server');
     $x = new Node();
     $x->setName('x')->setAttribute('xmlns', 'jabber:x:event')->addChild($server);
     $notify = new Node();
     $notify->setName('notify')->setAttribute('xmlns', 'urn:xmpp:whatsapp')->setAttribute('name', $this->getFromName());
     $request = new Node();
     $request->setName('request')->setAttribute('xmlns', 'urn:xmpp:receipts');
     $body = new Node();
     $body->setName('body')->setData($this->getBody());
     $node = new Node();
     $node->setName('message')->setAttribute('id', null)->setAttribute('t', null)->setAttribute('to', Identity::createJID($this->getTo()))->setAttribute('type', 'text')->addChild($x)->addChild($notify)->addChild($request)->addChild($body);
     return $node;
 }
示例#6
0
 /**
  * @param NodeInterface $pingNode
  */
 protected function sendPong(NodeInterface $pingNode)
 {
     $pongNode = new Node();
     $pongNode->setName('iq');
     $pongNode->setAttribute('to', Client::WHATSAPP_SERVER);
     $pongNode->setAttribute('to', $pingNode->getAttribute('id'));
     $pongNode->setAttribute('type', 'result');
     $this->getClient()->sendNode($pongNode);
 }
示例#7
0
 /**
  * @return Node
  */
 public function createNode()
 {
     $node = new Node();
     $node->setName('presence');
     if ($this->getName()) {
         $node->setAttribute('name', $this->getName());
     }
     if ($this->getType()) {
         $node->setAttribute('type', $this->getType());
     }
     if ($this->getLast()) {
         $node->setAttribute('last', $this->getLast());
     }
     return $node;
 }
示例#8
0
 /**
  * @return Node
  */
 public function createNode()
 {
     $syncNode = new Node();
     $syncNode->setName('sync');
     $syncNode->setAttributes(["mode" => $this->getMode(), "context" => $this->getContext(), "sid" => "" . (time() + 11644477200) * 10000000, "index" => "" . $this->getIndex(), "last" => $this->isLast() ? "true" : "false"]);
     foreach ($this->getNumbers() as $number) {
         $userNode = new Node();
         $userNode->setName('user')->setData($number);
         $syncNode->addChild($userNode);
     }
     $node = new Node();
     $node->setName('iq');
     $node->setAttributes(["id" => 'sendsync-', "type" => "get", "xmlns" => "urn:xmpp:whatsapp:sync", "to" => Identity::createJID($this->getTo())]);
     $node->addChild($syncNode);
     return $node;
 }
示例#9
0
 /**
  * @return Node
  */
 public function createNode()
 {
     $b64hash = base64_encode(hash_file("sha256", $this->getMediaFile()->getFilepath(), true));
     $mediaNode = new Node();
     $mediaNode->setName('media')->setAttribute('hash', $b64hash)->setAttribute('type', $this->getMediaFile()->getType())->setAttribute('size', $this->getMediaFile()->getSize());
     $node = new Node();
     $node->setName('iq')->setAttribute('id', 'upload-')->setAttribute('to', Client::WHATSAPP_SERVER)->setAttribute('type', 'set')->setAttribute('xmlns', 'w:m')->addChild($mediaNode);
     return $node;
 }
示例#10
0
 /**
  * @return Node
  */
 public function createNode()
 {
     $server = new Node();
     $server->setName('server');
     $x = new Node();
     $x->setName('x')->setAttribute('xmlns', 'jabber:x:event')->addChild($server);
     $notify = new Node();
     $notify->setName('notify')->setAttribute('xmlns', 'urn:xmpp:whatsapp')->setAttribute('name', $this->getFromName());
     $request = new Node();
     $request->setName('request')->setAttribute('xmlns', 'urn:xmpp:receipts');
     $media = new Node();
     $media->setName('media')->setAttribute('xmlns', "urn:xmpp:whatsapp:mms")->setAttribute('type', $this->getType())->setAttribute('url', $this->getUrl())->setAttribute('file', $this->getFile())->setAttribute('size', $this->getSize())->setAttribute('hash', $this->getHash())->setData($this->getIconData() ?: '');
     $node = new Node();
     $node->setName('message')->setAttribute('id', null)->setAttribute('t', null)->setAttribute('to', Identity::createJID($this->getTo()))->setAttribute('type', 'media')->addChild($x)->addChild($notify)->addChild($request)->addChild($media);
     return $node;
 }
示例#11
0
 /**
  * @return Node
  */
 public function createNode()
 {
     $node = new Node();
     $node->setName('receipt')->setAttribute('id', $this->getId())->setAttribute('to', $this->getTo());
     return $node;
 }