/** * @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; }
/** * @param Client $client * @param NodeInterface $node */ protected function sendNotificationAck(Client $client, NodeInterface $node) { $ackNode = new Node(); if ($node->hasAttribute("to")) { $ackNode->setAttribute('from', $node->getAttribute("to")); } if ($node->hasAttribute("participant")) { $ackNode->setAttribute('participant', $node->getAttribute("participant")); } $ackNode->setAttribute('to', $node->getAttribute("from")); $ackNode->setAttribute('class', $node->getName()); $ackNode->setAttribute('id', $node->getAttribute("id")); $ackNode->setAttribute('type', $node->getAttribute("type")); $client->sendNode($ackNode); }
/** * @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); }
/** * @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; }