Skip to content

Commit

Permalink
Merge pull request venomous0x#66 from arthursc/master
Browse files Browse the repository at this point in the history
  • Loading branch information
hubail committed Sep 17, 2012
2 parents 087cd74 + 35de006 commit 526e38e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/php/whatsprot.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ protected function processInboundData($data)
array_push($this->_messageQueue, $node);
$this->sendMessageReceived($node);
}
if (strcmp($node->_tag, "iq") == 0 AND strcmp($node->_attributeHash['type'], "get") == 0 AND strcmp($node->_children[0]->_tag, "ping") == 0)
{
$this->Pong($node->_attributeHash['id']);
}

$node = $this->_reader->nextTree();
}
}
Expand Down Expand Up @@ -295,6 +300,19 @@ public function MessageImage($msgid, $to, $url, $file, $size, $icon)
$mediaNode = new ProtocolNode("media", $mediaAttribs, null, $icon);
$this->SendMessageNode($msgid, $to, $mediaNode);
}

public function Pong($msgid)
{
$whatsAppServer = $this->_whatsAppServer;

$messageHash = array();
$messageHash["to"] = $whatsAppServer;
$messageHash["id"] = $msgid;
$messageHash["type"] = "result";

$messsageNode = new ProtocolNode("iq", $messageHash, null, "");
$this->sendNode($messsageNode);
}

protected function DebugPrint($debugMsg)
{
Expand Down

0 comments on commit 526e38e

Please sign in to comment.