From e8723d66177d2e7ccf0a7502278abacc5ccd8843 Mon Sep 17 00:00:00 2001 From: Bashin Date: Sun, 13 Oct 2013 17:56:07 +0200 Subject: [PATCH 1/9] Repaired onProfilePictureChanged event, added onProfilePictureDeleted --- src/php/whatsprot.class.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/php/whatsprot.class.php b/src/php/whatsprot.class.php index 1860957d..a1eba641 100644 --- a/src/php/whatsprot.class.php +++ b/src/php/whatsprot.class.php @@ -1995,6 +1995,23 @@ protected function processInboundData($data) $node->getChild("picture")->getData() )); } + if ($node->hasChild('notification') && $node->getChild('notification')->getAttribute('type') == 'picture') { + if ($node->getChild('notification')->hasChild('set')) { + $this->eventManager()->fire('onProfilePictureChanged', array( + $this->phoneNumber, + $node->getAttribute('from'), + $node->getAttribute('id'), + $node->getAttribute('t') + )); + } else if ($node->getChild('notification')->hasChild('delete')) { + $this->eventManager()->fire('onProfilePictureDeleted', array( + $this->phoneNumber, + $node->getAttribute('from'), + $node->getAttribute('id'), + $node->getAttribute('t') + )); + } + } if ($node->getChild(0) != null && $node->getChild(0)->getTag() == "media") { $this->processUploadResponse($node); } From 28ad3ed97907d126cae93ab70279a8dc4db975e9 Mon Sep 17 00:00:00 2001 From: Bashin Date: Sun, 13 Oct 2013 17:59:25 +0200 Subject: [PATCH 2/9] Update whatsprot.class.php --- src/php/whatsprot.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/php/whatsprot.class.php b/src/php/whatsprot.class.php index a1eba641..1cad1a1d 100644 --- a/src/php/whatsprot.class.php +++ b/src/php/whatsprot.class.php @@ -2004,13 +2004,13 @@ protected function processInboundData($data) $node->getAttribute('t') )); } else if ($node->getChild('notification')->hasChild('delete')) { - $this->eventManager()->fire('onProfilePictureDeleted', array( + $this->eventManager()->fire('onProfilePictureDeleted', array( $this->phoneNumber, $node->getAttribute('from'), $node->getAttribute('id'), $node->getAttribute('t') )); - } + } } if ($node->getChild(0) != null && $node->getChild(0)->getTag() == "media") { $this->processUploadResponse($node); From ddeb0166065cc2db8c7b5ac7cfa807b0502b5df3 Mon Sep 17 00:00:00 2001 From: Bashin Date: Sun, 13 Oct 2013 18:01:31 +0200 Subject: [PATCH 3/9] Update whatsprot.class.php --- src/php/whatsprot.class.php | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/php/whatsprot.class.php b/src/php/whatsprot.class.php index 1cad1a1d..1860957d 100644 --- a/src/php/whatsprot.class.php +++ b/src/php/whatsprot.class.php @@ -1995,23 +1995,6 @@ protected function processInboundData($data) $node->getChild("picture")->getData() )); } - if ($node->hasChild('notification') && $node->getChild('notification')->getAttribute('type') == 'picture') { - if ($node->getChild('notification')->hasChild('set')) { - $this->eventManager()->fire('onProfilePictureChanged', array( - $this->phoneNumber, - $node->getAttribute('from'), - $node->getAttribute('id'), - $node->getAttribute('t') - )); - } else if ($node->getChild('notification')->hasChild('delete')) { - $this->eventManager()->fire('onProfilePictureDeleted', array( - $this->phoneNumber, - $node->getAttribute('from'), - $node->getAttribute('id'), - $node->getAttribute('t') - )); - } - } if ($node->getChild(0) != null && $node->getChild(0)->getTag() == "media") { $this->processUploadResponse($node); } From 2716f8855b6cd23c0ba06d519905bc247a850526 Mon Sep 17 00:00:00 2001 From: KSas Date: Fri, 29 Nov 2013 08:46:24 +0100 Subject: [PATCH 4/9] Update EVENTS.md added onGetGroupMessage --- EVENTS.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/EVENTS.md b/EVENTS.md index c63e66ba..2fd9eeff 100644 --- a/EVENTS.md +++ b/EVENTS.md @@ -147,6 +147,15 @@ Available events and arguments - time: The unix time when send message notification. - name: The sender name. - message: The message. +- onGetGroupMessage: + - phone: The user phone number including the country code. + - from: The group JID. + - author: The sender JID. + - msgid: The message id. + - type: The message type. + - time: The unix time when send message notification. + - name: The sender name. + - message: The message. - onGetPrivacyBlockedList: - phone: The user phone number including the country code. - data: Array of data nodes containing numbers you have blocked. From af08b8e7e788957d08ef2fedaa89ea26241ecaf6 Mon Sep 17 00:00:00 2001 From: Max Kovaljov Date: Thu, 19 Dec 2013 12:47:27 +0100 Subject: [PATCH 5/9] Added return of message ID --- src/php/whatsprot.class.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/php/whatsprot.class.php b/src/php/whatsprot.class.php index 1860957d..9c4f9550 100644 --- a/src/php/whatsprot.class.php +++ b/src/php/whatsprot.class.php @@ -890,12 +890,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); } /** @@ -2416,7 +2419,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(); @@ -2433,7 +2436,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), ""); @@ -2451,6 +2454,7 @@ protected function sendMessageNode($to, $node) $messageHash["id"], $node )); + return $messageHash["id"]; } /** From 4bd1fc742dd8163b355fce66684a5ce45c926a47 Mon Sep 17 00:00:00 2001 From: Max Kovaljov Date: Thu, 19 Dec 2013 12:55:32 +0100 Subject: [PATCH 6/9] Deprecated sendGetStatus Use ContactSyncV2 instead. --- src/php/whatsprot.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/php/whatsprot.class.php b/src/php/whatsprot.class.php index 9c4f9550..871d123f 100644 --- a/src/php/whatsprot.class.php +++ b/src/php/whatsprot.class.php @@ -747,6 +747,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) From 179533c421a0c5adf5ba516bacaf65f1c9930f72 Mon Sep 17 00:00:00 2001 From: Max Kovaljov Date: Thu, 19 Dec 2013 12:56:32 +0100 Subject: [PATCH 7/9] Changed sendClearDirty accessor to protected Fixes #536 --- src/php/whatsprot.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/php/whatsprot.class.php b/src/php/whatsprot.class.php index 871d123f..ab484f69 100644 --- a/src/php/whatsprot.class.php +++ b/src/php/whatsprot.class.php @@ -548,7 +548,7 @@ public function sendBroadcastVideo($targets, $path, $storeURLmedia = false) * * @param array $categories */ - public function sendClearDirty($categories) + protected function sendClearDirty($categories) { $msgId = $this->createMsgId("cleardirty"); From 98e195811bf259325d096080074649c994650be8 Mon Sep 17 00:00:00 2001 From: Max Kovaljov Date: Thu, 19 Dec 2013 13:00:26 +0100 Subject: [PATCH 8/9] Updated client details to Android 2.11.149 --- src/php/token.php | 2 +- src/php/whatsprot.class.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/php/token.php b/src/php/token.php index fe70922b..834e0d5f 100644 --- a/src/php/token.php +++ b/src/php/token.php @@ -6,7 +6,7 @@ function generateRequestToken($country, $phone) { $noMediaHash = "AAGpM5zvDnFyrsmemfAETcw/kPWMRcCoW96rBU2pphtEOCWNVhSp8QX6"; $waPrefix = "Y29tLndoYXRzYXBw"; $signature = "MIIDMjCCAvCgAwIBAgIETCU2pDALBgcqhkjOOAQDBQAwfDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFDASBgNVBAcTC1NhbnRhIENsYXJhMRYwFAYDVQQKEw1XaGF0c0FwcCBJbmMuMRQwEgYDVQQLEwtFbmdpbmVlcmluZ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Nv/c8pP3p0GXKR6OOQmhyERwx74fw1RYSU10I4r1gyBVDbRJ40pidjM41G1I1oN"; $KEY = "The piano has been drinking"; diff --git a/src/php/whatsprot.class.php b/src/php/whatsprot.class.php index ab484f69..062ac0b4 100644 --- a/src/php/whatsprot.class.php +++ b/src/php/whatsprot.class.php @@ -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. From dfc9ea45d3abfaf7326e2b7740e18c26f4668384 Mon Sep 17 00:00:00 2001 From: Ali Hubail Date: Sat, 21 Dec 2013 00:30:53 +0300 Subject: [PATCH 9/9] long overdue cleanup 1/n --- .gitattributes | 49 -------------------------- .gitignore | 88 ---------------------------------------------- README.md | 2 -- tests/whatsapp.php | 4 +-- 4 files changed, 1 insertion(+), 142 deletions(-) diff --git a/.gitattributes b/.gitattributes index a664be3a..e69de29b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/.gitignore b/.gitignore index 1252d00d..353d1e1d 100644 --- a/.gitignore +++ b/.gitignore @@ -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 ############ diff --git a/README.md b/README.md index 1e9b8c8c..1a39a602 100644 --- a/README.md +++ b/README.md @@ -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)* ---------- diff --git a/tests/whatsapp.php b/tests/whatsapp.php index c53e37a3..fd08a898 100644 --- a/tests/whatsapp.php +++ b/tests/whatsapp.php @@ -101,6 +101,4 @@ function fgets_u($pStdn) echo "\n[] Send message to $dst: $msg\n"; $wa->sendMessage($dst , $msg); -echo "\n"; - -?> +echo "\n"; \ No newline at end of file