diff options
author | Fishbone <fishbone@miranda-ng.org> | 2013-06-03 13:55:50 +0000 |
---|---|---|
committer | Fishbone <fishbone@miranda-ng.org> | 2013-06-03 13:55:50 +0000 |
commit | 70e02c41dc4693a742dda252557588947e6be37a (patch) | |
tree | 7485ecd628e6e6a96943660872167dc5771f9b9a /protocols/WhatsApp/src | |
parent | 9f631693a3094124ac7f34f1fa34008116ba6afc (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/WhatsApp/src')
-rw-r--r-- | protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.cpp | 1 | ||||
-rw-r--r-- | protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.cpp | 1 | ||||
-rw-r--r-- | protocols/WhatsApp/src/WhatsAPI++/ByteArray.cpp | 1 | ||||
-rw-r--r-- | protocols/WhatsApp/src/WhatsAPI++/FMessage.cpp | 1 | ||||
-rw-r--r-- | protocols/WhatsApp/src/WhatsAPI++/ProtocolTreeNode.cpp | 1 | ||||
-rw-r--r-- | protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp | 2 | ||||
-rw-r--r-- | protocols/WhatsApp/src/WhatsAPI++/WALogin.cpp | 3 | ||||
-rw-r--r-- | protocols/WhatsApp/src/WhatsAPI++/base64.cpp | 1 | ||||
-rw-r--r-- | protocols/WhatsApp/src/WhatsAPI++/utilities.cpp | 8 | ||||
-rw-r--r-- | protocols/WhatsApp/src/proto.cpp | 30 |
10 files changed, 24 insertions, 25 deletions
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
}
|