Permalink
Browse files

Merge pull request #66 from arthursc/master

  • Loading branch information...
2 parents 087cd74 + 35de006 commit 526e38ea6d22281bea162c40c95a57a0fd738ff4 @hubail hubail committed Sep 17, 2012
Showing with 18 additions and 0 deletions.
  1. +18 −0 src/php/whatsprot.class.php
@@ -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();
}
}
@@ -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)
{

0 comments on commit 526e38e

Please sign in to comment.