Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update bulk with sync result #804 #815

Open
wants to merge 702 commits into
base: master
Choose a base branch
from
Open

Update bulk with sync result #804 #815

wants to merge 702 commits into from

Conversation

mgp25
Copy link
Contributor

@mgp25 mgp25 commented Jun 28, 2014

Enhancement #804

shirioko and others added 30 commits September 12, 2013 12:35
Makes your constant strings shorter and solves compatibility issues with
older PHP versions.
One of the fixes for #467
Fix login: Use only version number for WHATSAPP_VER.
Added "OnProfilePictureChanged" Event. Will be fired if one of your contacts changes its profile picture.
Wrong copy past, missing {}.
Some numbers were not identificated as actual users
Changed User-Agent to a newer version
OnProfilePictureChanged Event
Added Event, that will be fired when the user calls: "sendGetGroupsParticipants".
I luv copy  paste...
OnGetGroupParticipants Event
Should play nicer with proxies and firewalls
No more "help I get response tx rx tx rx tx rx rx rx tx tx"
No more inner rage for me
:-)
Capturing this event can prevent you from talking to a closed connection
like a retard
Replaced by new nodeString HTML formatter
Added target user to lastSeen event
SikiFn and others added 22 commits May 21, 2014 03:20
Add Send vCard In Broadcast Functionality
Adding Missing "name" Argument To Prevent "Warning: Missing argument 3 for WhatsAppEventListenerProxy::onSendPresence()"
Update WhatsAppEvent.php
Adding Missing "name" Argument To Prevent "Warning: Missing argument 3 for WhatsAppEventListenerProxy::onSendPresence()"
Update whatsprot.class.php
A fix for firePresence. When using the event and want the $type value, it only shows 'unavailable', now returns also 'available'.
firePresence return "unavailable"
Deprecated functions from older file was used. Now its working.
sendSetProfilePicture supports an url as argument
Now it onMessageComposing and onMessagePaused works.
Fixed chatstate (composing/paused)
Fixes #786
If not, blame @mgp25
FIX:
PHP Notice:  Use of undefined constant jpg - assumed 'jpg' in /home/abdul/project/whatsapp/WhatsAPI/src/php/whatsprot.class.php on line 2896
I have no idea where this contacts.php removed to
Fix for 'Use of undefined constant jpg'
@shirioko
Copy link
Contributor

shirioko commented Jul 7, 2014

I see what you did there, but SendSync() is never called so the event handler won't be fired. Also that die(); will stop the program from executing after receiving the sync result and before sending the messages.

@mgp25
Copy link
Contributor Author

mgp25 commented Jul 7, 2014

True, ill check that later

@shirioko
Copy link
Contributor

shirioko commented Jul 7, 2014

Your best option would be to either put the $wa object in a static property to make it accessible from the event handler, and send the messages from inside the event handler

protected static $wa;
protected static $message;

public static function event_onSyncResult($result)
{
    foreach($result->existing as $number)
    {
       $wa->sendMessage(self::$number, self::$message);
    }
}

or to put the sync result contacts in a static property and set it from the event handler:

protected static $numbers = null;

public static function event_onSyncResult($result)
{
    self::$numbers = $result->existing;
}

//send sync
$wa->SendSync($numbers);
//wait for response
while(!is_array(self::$numbers) && $wa->pollMessage());
//send
foreach(self::$numbers as $number)
{
    $wa->sendMessage($number, $message);
}

Now bulk.php uses sendSync and only send messages to numbers that exists (have WhatsApp account).
@mgp25
Copy link
Contributor Author

mgp25 commented Jul 7, 2014

Fixed

Forget to remove a variable $i. Now everything is ok! :-)
@hubail hubail force-pushed the master branch 2 times, most recently from d56e5ea to e6cf5a5 Compare May 3, 2015 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.