From 647a73bfcfcc8507a958a8c0178e42621c6df24e Mon Sep 17 00:00:00 2001 From: Max Kovaljov Date: Sun, 13 Oct 2013 01:59:39 +0200 Subject: [PATCH] Fixed event binding Also fixes #492 --- src/php/ajaxDemo/socket.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/php/ajaxDemo/socket.php b/src/php/ajaxDemo/socket.php index 6151d398..b05c108c 100644 --- a/src/php/ajaxDemo/socket.php +++ b/src/php/ajaxDemo/socket.php @@ -80,6 +80,10 @@ 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); @@ -87,12 +91,10 @@ function onGetImage($mynumber, $from, $id, $type, $t, $name, $size, $url, $file, 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)) {