Skip to content

Commit

Permalink
Merged with master
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Abramowitz committed Dec 21, 2013
2 parents 31ff83f + dfc9ea4 commit b36adb5
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 153 deletions.
49 changes: 0 additions & 49 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,49 +0,0 @@
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain

*.jpg binary
*.png binary
*.gif binary

*.cs text=auto diff=csharp
*.vb text=auto
*.c text=auto
*.cpp text=auto
*.cxx text=auto
*.h text=auto
*.hxx text=auto
*.py text=auto
*.rb text=auto
*.java text=auto
*.html text=auto
*.htm text=auto
*.css text=auto
*.scss text=auto
*.sass text=auto
*.less text=auto
*.js text=auto
*.lisp text=auto
*.clj text=auto
*.sql text=auto
*.php text=auto
*.lua text=auto
*.m text=auto
*.asm text=auto
*.erl text=auto
*.fs text=auto
*.fsx text=auto
*.hs text=auto

*.csproj text=auto merge=union
*.vbproj text=auto merge=union
*.fsproj text=auto merge=union
*.dbproj text=auto merge=union
*.sln text=auto eol=crlf merge=union
88 changes: 0 additions & 88 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,94 +30,6 @@ local.properties
# PDT-specific
.buildpath


#################
## Visual Studio
#################

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates

# Build results
**/[Dd]ebug/
**/[Rr]elease/
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.vspscc
.builds
**/*.dotCover

## TODO: If you have NuGet Package Restore enabled, uncomment this
#**/packages/

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf

# Visual Studio profiler
*.psess
*.vsp

# ReSharper is a .NET coding add-in
_ReSharper*

# Installshield output folder
[Ee]xpress

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish

# Others
[Bb]in
[Oo]bj
sql
TestResults
*.Cache
ClientBin
stylecop.*
~$*
*.dbmdl
Generated_Code #added for RIA/Silverlight projects

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML



############
## Windows
############
Expand Down
1 change: 0 additions & 1 deletion EVENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ Available events and arguments
==============================
See events/WhatsAppEventListener.php.


How to bind a callback to an event
==================================

Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ Interface to WhatsApp Messenger

**It's not about the money, it's about sending a message.**

*I hope that this was a bit more civil than the former "FUCK SPAMMER IF YOU ARE ONE GO FUCK YOURSELF" :)*

*\- [shirioko](https://github.com/shirioko)*

----------
Expand Down
2 changes: 1 addition & 1 deletion src/php/token.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function generateRequestToken($country, $phone) {
$noMediaHash = "AAGpM5zvDnFyrsmemfAETcw/kPWMRcCoW96rBU2pphtEOCWNVhSp8QX6";
$waPrefix = "Y29tLndoYXRzYXBw";
$signature = "MIIDMjCCAvCgAwIBAgIETCU2pDALBgcqhkjOOAQDBQAwfDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFDASBgNVBAcTC1NhbnRhIENsYXJhMRYwFAYDVQQKEw1XaGF0c0FwcCBJbmMuMRQwEgYDVQQLEwtFbmdpbmVlcmluZzEUMBIGA1UEA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6OOQmhyERwx74fw1RYSU10I4r1gyBVDbRJ40pidjM41G1I1oN";
$KEY = "The piano has been drinking";

Expand Down
19 changes: 12 additions & 7 deletions src/php/whatsprot.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class WhatsProt
const WHATSAPP_SERVER = 's.whatsapp.net'; // The hostname used to login/send messages.
const WHATSAPP_UPLOAD_HOST = 'https://mms.whatsapp.net/client/iphone/upload.php'; // The upload host.
const WHATSAPP_DEVICE = 'Android'; // The device name.
const WHATSAPP_VER = '2.11.139'; // The WhatsApp version.
const WHATSAPP_USER_AGENT = 'WhatsApp/2.11.139 Android/4.3 Device/GalaxyS3';// User agent used in request/registration code.
const WHATSAPP_VER = '2.11.149'; // The WhatsApp version.
const WHATSAPP_USER_AGENT = 'WhatsApp/2.11.149 Android/4.3 Device/GalaxyS3';// User agent used in request/registration code.

/**
* Property declarations.
Expand Down Expand Up @@ -580,7 +580,7 @@ public function sendBroadcastVideo($targets, $path, $storeURLmedia = false)
*
* @param array $categories
*/
public function sendClearDirty($categories)
protected function sendClearDirty($categories)
{
$msgId = $this->createMsgId("cleardirty");

Expand Down Expand Up @@ -779,6 +779,7 @@ public function sendGetServerProperties()
/**
* Get the current status message of a specific user.
*
* @deprecated Use ContactSyncV2 to get status
* @param string $jid The user JID
*/
public function sendGetStatus($jid)
Expand Down Expand Up @@ -922,12 +923,15 @@ public function sendGroupsParticipantsRemove($groupId, $participants)
* The recipient.
* @param string $txt
* The text message.
* @param $id
*
* @return string
*/
public function sendMessage($to, $txt)
public function sendMessage($to, $txt, $id = null)
{
$txt = $this->parseMessageForEmojis($txt);
$bodyNode = new ProtocolNode("body", null, null, $txt);
$this->sendMessageNode($to, $bodyNode);
return $this->sendMessageNode($to, $bodyNode, $id);
}

/**
Expand Down Expand Up @@ -2492,7 +2496,7 @@ protected function sendGroupsChangeParticipants($groupId, $participants, $tag)
* @param $node
* The node that contains the message.
*/
protected function sendMessageNode($to, $node)
protected function sendMessageNode($to, $node, $id = null)
{
$serverNode = new ProtocolNode("server", null, null, "");
$xHash = array();
Expand All @@ -2509,7 +2513,7 @@ protected function sendMessageNode($to, $node)
$messageHash = array();
$messageHash["to"] = $this->getJID($to);
$messageHash["type"] = "chat";
$messageHash["id"] = $this->createMsgId("message");
$messageHash["id"] = ($id == null?$this->createMsgId("message"):$id);
$messageHash["t"] = time();

$messageNode = new ProtocolNode("message", $messageHash, array($xNode, $notnode, $reqnode, $node), "");
Expand All @@ -2527,6 +2531,7 @@ protected function sendMessageNode($to, $node)
$messageHash["id"],
$node
);
return $messageHash["id"];
}

/**
Expand Down
29 changes: 26 additions & 3 deletions tests/WhatAppEventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@
// Assert expected result:
$expected = array(
//First event raised:
array(
'onSendMessageReceived',
array(
0 => '$username',
// 1 = This is the current time.
2 => '441234123456'
)
),
//Second event raised:
array(
// Event name:
'onGetMessage',
Expand All @@ -80,9 +89,13 @@
)
)
);
$old_expected = array($expected[1]);

unset($actual[0][1][1]); // Remove the time.

// Analyze the results:
if( $expected === $actual
&& $expected === $old_function_called ) {
&& $old_expected === $old_function_called ) {
print( "Test Passed.\n");
} else {
print( "Test Failed!!!!!\n" );
Expand All @@ -102,8 +115,8 @@
) );
// Analyze the results:
$actual = $listener->getAndResetCapture();
if( $expected === $actual
&& $expected === $old_function_called ) {
if( $old_expected === $actual
&& $old_expected === $old_function_called ) {
print( "Test Passed.\n");
} else {
print( "Test Failed!!!!!\n" );
Expand Down Expand Up @@ -138,6 +151,15 @@
// Assert expected result:
$expected = array(
//First event raised:
array(
'onSendMessageReceived',
array(
0 => '$username',
// 1 = This is the current time.
2 => '[email protected]'
)
),
// Second event raised:
array(
// Event name:
'onGetGroupMessage',
Expand All @@ -154,6 +176,7 @@
)
)
);
unset($actual[0][1][1]); // Remove the time.

if( $expected === $actual ) {
print( "Test Passed.\n");
Expand Down
2 changes: 0 additions & 2 deletions tests/whatsapp.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,3 @@ function fgets_u($pStdn)
echo "\n[] Send message to $dst: $msg\n";
$wa->sendMessage($dst , $msg);
echo "\n";

?>

0 comments on commit b36adb5

Please sign in to comment.