Skip to content

Commit

Permalink
Fixed event binding
Browse files Browse the repository at this point in the history
Also fixes #492
  • Loading branch information
shirioko committed Oct 12, 2013
1 parent 98abbe2 commit 647a73b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/php/ajaxDemo/socket.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,21 @@ function onGetImage($mynumber, $from, $id, $type, $t, $name, $size, $url, $file,
$username = "************";
$password = "******************************";
$w = new WhatsProt($username, 0, "WhatsApi AJAX Demo", true);

$w->eventManager()->bind("onGetImage", "onGetImage");
$w->eventManager()->bind("onGetProfilePicture", "onGetProfilePicture");

$w->connect();
$w->loginWithPassword($password);

$initial = @$_POST["initial"];
if ($initial == "true" && $target != null) {
//request contact picture only on first call
$w->sendGetProfilePicture($target);
//finally starting to use the event manager!
$w->eventManager()->bind("onGetProfilePicture", "onGetProfilePicture");
}
$w->eventManager()->bind("onGetImage", "onGetImage");

//subscribe contact status
//$w->SendPresenceSubscription($target);
$w->SendPresenceSubscription($target);
//TODO: presense handling (online/offline/typing/last seen)

while (running($time)) {
Expand Down

0 comments on commit 647a73b

Please sign in to comment.