From 7d740f3b8376cd7242baadc00475bcc17ec7bef3 Mon Sep 17 00:00:00 2001 From: shirioko Date: Sun, 16 Mar 2014 15:40:38 +0100 Subject: [PATCH] Fixed sendStatusUpdate fixes #624 --- src/php/whatsprot.class.php | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/php/whatsprot.class.php b/src/php/whatsprot.class.php index 15db60e6..bcf6466e 100644 --- a/src/php/whatsprot.class.php +++ b/src/php/whatsprot.class.php @@ -1240,25 +1240,19 @@ public function sendSetRecoveryToken($token) */ public function sendStatusUpdate($txt) { - $bodyNode = new ProtocolNode("body", null, null, $txt); - $serverNode = new ProtocolNode("server", null, null, ""); - $xHash = array(); - $xHash["xmlns"] = "jabber:x:event"; - $xNode = new ProtocolNode("x", $xHash, array($serverNode), ""); - - $messageHash = array(); - $messageHash["to"] = 's.us'; - $messageHash["type"] = "chat"; - $messageHash["id"] = $this->createMsgId("sendstatus"); + $child = new ProtocolNode("status", null, null, $txt); + $node = new ProtocolNode("iq", array( + "to" => "s.whatsapp.net", + "type" => "set", + "id" => $this->createMsgId("sendstatus"), + "xmlns" => "status" + ), array($child), null); - $messageNode = new ProtocolNode("message", $messageHash, array($xNode, $bodyNode), ""); - $this->sendNode($messageNode); + $this->sendNode($node); $this->eventManager()->fireSendStatusUpdate( $this->phoneNumber, $txt ); - //listen for response - $this->waitForServer($messageHash["id"]); } /**