Skip to content

Commit

Permalink
Fixed sendStatusUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
shirioko committed Mar 16, 2014
1 parent 7ea2d0c commit 7d740f3
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions src/php/whatsprot.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
}

/**
Expand Down

0 comments on commit 7d740f3

Please sign in to comment.