summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorFishbone <fishbone@miranda-ng.org>2013-06-03 13:55:50 +0000
committerFishbone <fishbone@miranda-ng.org>2013-06-03 13:55:50 +0000
commit70e02c41dc4693a742dda252557588947e6be37a (patch)
tree7485ecd628e6e6a96943660872167dc5771f9b9a /protocols
parent9f631693a3094124ac7f34f1fa34008116ba6afc (diff)
WhatsApp:
* Tried fixing requesting registration code * Started removing Miranda dependecies in WhatsAPI++ git-svn-id: http://svn.miranda-ng.org/main/trunk@4871 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/WhatsApp/WhatsApp_10.vcxproj9
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.cpp1
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.cpp1
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/ByteArray.cpp1
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/FMessage.cpp1
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/ProtocolTreeNode.cpp1
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp2
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp3
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/base64.cpp1
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/utilities.cpp8
-rw-r--r--protocols/WhatsApp/src/proto.cpp30
11 files changed, 33 insertions, 25 deletions
diff --git a/protocols/WhatsApp/WhatsApp_10.vcxproj b/protocols/WhatsApp/WhatsApp_10.vcxproj
index 96b7bb2f50..b85db023ab 100644
--- a/protocols/WhatsApp/WhatsApp_10.vcxproj
+++ b/protocols/WhatsApp/WhatsApp_10.vcxproj
@@ -217,30 +217,39 @@
<ClCompile Include="src\WASocketConnection.cpp" />
<ClCompile Include="src\WhatsAPI++\base64.cpp">
<PrecompiledHeaderFile>../common.h</PrecompiledHeaderFile>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="src\WhatsAPI++\BinTreeNodeReader.cpp">
<PrecompiledHeaderFile>../common.h</PrecompiledHeaderFile>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="src\WhatsAPI++\BinTreeNodeWriter.cpp">
<PrecompiledHeaderFile>../common.h</PrecompiledHeaderFile>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="src\WhatsAPI++\ByteArray.cpp">
<PrecompiledHeaderFile>../common.h</PrecompiledHeaderFile>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="src\WhatsAPI++\FMessage.cpp">
<PrecompiledHeaderFile>../common.h</PrecompiledHeaderFile>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="src\WhatsAPI++\ProtocolTreeNode.cpp">
<PrecompiledHeaderFile>../common.h</PrecompiledHeaderFile>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="src\WhatsAPI++\utilities.cpp">
<PrecompiledHeaderFile>../common.h</PrecompiledHeaderFile>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="src\WhatsAPI++\WAConnection.cpp">
<PrecompiledHeaderFile>../common.h</PrecompiledHeaderFile>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="src\WhatsAPI++\WALogin.cpp">
<PrecompiledHeaderFile>../common.h</PrecompiledHeaderFile>
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<ItemGroup>
diff --git a/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.cpp b/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.cpp
index f7909fa625..6a09feee64 100644
--- a/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.cpp
+++ b/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.cpp
@@ -4,7 +4,6 @@
* Created on: 26/06/2012
* Author: Antonio
*/
-#include "../common.h"
#include "BinTreeNodeReader.h"
#include "WAException.h"
#include "ProtocolTreeNode.h"
diff --git a/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.cpp b/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.cpp
index 6b2d02d4f9..e2d38cf891 100644
--- a/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.cpp
+++ b/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.cpp
@@ -4,7 +4,6 @@
* Created on: 26/06/2012
* Author: Antonio
*/
-#include "../common.h"
#include "BinTreeNodeWriter.h"
#include <cstring>
#include "utilities.h"
diff --git a/protocols/WhatsApp/src/WhatsAPI++/ByteArray.cpp b/protocols/WhatsApp/src/WhatsAPI++/ByteArray.cpp
index 785c5c2323..f379a2061a 100644
--- a/protocols/WhatsApp/src/WhatsAPI++/ByteArray.cpp
+++ b/protocols/WhatsApp/src/WhatsAPI++/ByteArray.cpp
@@ -5,7 +5,6 @@
* Author: Antonio
*/
-#include "../common.h"
#include "ByteArray.h"
#include "WAException.h"
#include <iostream>
diff --git a/protocols/WhatsApp/src/WhatsAPI++/FMessage.cpp b/protocols/WhatsApp/src/WhatsAPI++/FMessage.cpp
index 03015e8e11..b8586eb538 100644
--- a/protocols/WhatsApp/src/WhatsAPI++/FMessage.cpp
+++ b/protocols/WhatsApp/src/WhatsAPI++/FMessage.cpp
@@ -5,7 +5,6 @@
* Author: Antonio
*/
-#include "../common.h"
#include <ctime>
#include <stdlib.h>
#include <algorithm>
diff --git a/protocols/WhatsApp/src/WhatsAPI++/ProtocolTreeNode.cpp b/protocols/WhatsApp/src/WhatsAPI++/ProtocolTreeNode.cpp
index c3c75cbd3e..be6a658acb 100644
--- a/protocols/WhatsApp/src/WhatsAPI++/ProtocolTreeNode.cpp
+++ b/protocols/WhatsApp/src/WhatsAPI++/ProtocolTreeNode.cpp
@@ -5,7 +5,6 @@
* Author: Antonio
*/
-#include "../common.h"
#include "WAException.h"
#include "ProtocolTreeNode.h"
diff --git a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp
index af1f65d6ae..0e6fa62c74 100644
--- a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp
+++ b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp
@@ -5,12 +5,12 @@
* Author: Antonio
*/
-#include "../common.h"
#include "WAConnection.h"
#include "ProtocolTreeNode.h"
#include <map>
#include <vector>
#include "utilities.h"
+#include "base64.h"
const char* WAConnection::dictionary[] = {
"",
diff --git a/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp b/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp
index 578e88c67d..a1a3d26a94 100644
--- a/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp
+++ b/protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp
@@ -5,7 +5,6 @@
* Author: Antonio
*/
-#include "../common.h"
#include "WALogin.h"
#include "ByteArray.h"
//#include "ApplicationData.h"
@@ -16,6 +15,8 @@
#include <map>
#include <stdlib.h>
+#include "../common.h" // #TODO Remove Miranda-dependency
+
using namespace Utilities;
const std::string WALogin::NONCE_KEY = "nonce=\"";
diff --git a/protocols/WhatsApp/src/WhatsAPI++/base64.cpp b/protocols/WhatsApp/src/WhatsAPI++/base64.cpp
index b3ff4fb2e0..03c4c827d4 100644
--- a/protocols/WhatsApp/src/WhatsAPI++/base64.cpp
+++ b/protocols/WhatsApp/src/WhatsAPI++/base64.cpp
@@ -4,7 +4,6 @@
* Created on: 26/06/2012
* Author: Antonio
*/
-#include "../common.h"
#include "base64.h"
#include <iostream>
diff --git a/protocols/WhatsApp/src/WhatsAPI++/utilities.cpp b/protocols/WhatsApp/src/WhatsAPI++/utilities.cpp
index 489d222a66..90d03dbdaa 100644
--- a/protocols/WhatsApp/src/WhatsAPI++/utilities.cpp
+++ b/protocols/WhatsApp/src/WhatsAPI++/utilities.cpp
@@ -1,4 +1,3 @@
-#include "../common.h"
#include "utilities.h"
//#include "ApplicationData.h"
#include <iostream>
@@ -12,6 +11,9 @@
#include <fstream>
#include <iomanip>
+// #TODO Remove Miranda dependency
+#include "../common.h"
+
namespace Utilities{
const static char digits[] = {
@@ -81,11 +83,11 @@ std::string itoa(int value, unsigned int base) {
std::string processIdentity(const std::string& id){
std::string buffer_str = reverseString(id);
- BYTE digest[16];
+ unsigned char digest[16];
utils::md5string(buffer_str, digest);
buffer_str.clear();
- for(int i =0; i < SIZEOF(digest); i++){
+ for(int i =0; i < 16; i++){
int tmp = digest[i]+128;
int f = tmp & 0xff;
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp
index e73e37ece0..29be123437 100644
--- a/protocols/WhatsApp/src/proto.cpp
+++ b/protocols/WhatsApp/src/proto.cpp
@@ -180,15 +180,15 @@ void WhatsAppProto::RequestCode()
if ( !db_get_s(NULL,m_szModuleName,WHATSAPP_KEY_IDX,&dbv,DBVT_ASCIIZ))
{
idx = dbv.pszVal;
- if (idx.empty())
- {
- std::stringstream tm;
- tm << time(NULL);
- BYTE idxBuf[16];
- utils::md5string(tm.str(), idxBuf);
- idx = std::string((const char*) idxBuf, 16);
- db_set_s(0, m_szModuleName,WHATSAPP_KEY_IDX, idx.c_str());
- }
+ }
+ if (idx.empty())
+ {
+ std::stringstream tm;
+ tm << time(NULL);
+ BYTE idxBuf[16];
+ utils::md5string(tm.str(), idxBuf);
+ idx = std::string((const char*) idxBuf, 16);
+ db_set_s(0, m_szModuleName,WHATSAPP_KEY_IDX, idx.c_str());
}
if ( !db_get_s(NULL,m_szModuleName,WHATSAPP_KEY_CC,&dbv, DBVT_ASCIIZ))
{
@@ -229,17 +229,19 @@ void WhatsAppProto::RequestCode()
NETLIBHTTPREQUEST nlhr = {sizeof(NETLIBHTTPREQUEST)};
nlhr.requestType = REQUEST_POST;
- nlhr.szUrl = (char*) (std::string(ACCOUNT_URL_CODEREQUESTV2) + "?cc="+ cc + "&in="+ number +
- "lc=US&lg=en&mcc=000&mnc=000&method=sms&id=" + idx + "&token="+ token).c_str();
+ string url = std::string(ACCOUNT_URL_CODEREQUESTV2);
+ url += "?cc="+ cc + "&in="+ number +
+ "&lc=US&lg=en&mcc=000&mnc=000&method=sms&id=" + idx + "&token="+ token;
+ nlhr.szUrl = (char*) url.c_str();
nlhr.headers = &headers[0];
nlhr.headersCount = 3;
- nlhr.flags = NLHRF_HTTP11 | NLHRF_GENERATEHOST | NLHRF_REMOVEHOST;
-
- return;
+ nlhr.flags = NLHRF_HTTP11 | NLHRF_GENERATEHOST | NLHRF_REMOVEHOST | NLHRF_SSL;
NETLIBHTTPREQUEST* pnlhr = (NETLIBHTTPREQUEST*) CallService(MS_NETLIB_HTTPTRANSACTION,
(WPARAM) WASocketConnection::hNetlibUser, (LPARAM)&nlhr);
+ MessageBoxA(NULL, pnlhr->pData, "Debug", MB_OK);
+
// #TODO
}