summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2016-12-01 20:51:12 +0300
committerGeorge Hazan <ghazan@miranda.im>2016-12-01 20:51:12 +0300
commit40203d30ad1a569cfea61442782393b200e9fbe3 (patch)
tree31b453500e6cc6c5bd5a7143f80ac941af5e7f71 /protocols/WhatsApp
parent06fc3d811d71a44b92d45e1263e5fb0099a7304e (diff)
warning fix
Diffstat (limited to 'protocols/WhatsApp')
-rw-r--r--protocols/WhatsApp/src/WASocketConnection.cpp17
-rw-r--r--protocols/WhatsApp/src/WASocketConnection.h4
-rw-r--r--protocols/WhatsApp/src/WhatsAPI++/MediaUploader.cpp3
-rw-r--r--protocols/WhatsApp/src/proto.cpp5
-rw-r--r--protocols/WhatsApp/src/stdafx.h1
5 files changed, 11 insertions, 19 deletions
diff --git a/protocols/WhatsApp/src/WASocketConnection.cpp b/protocols/WhatsApp/src/WASocketConnection.cpp
index e6b53aa419..b6ec0c0998 100644
--- a/protocols/WhatsApp/src/WASocketConnection.cpp
+++ b/protocols/WhatsApp/src/WASocketConnection.cpp
@@ -1,11 +1,11 @@
#include "stdafx.h"
#include "WASocketConnection.h"
-HANDLE WASocketConnection::hNetlibUser = NULL;
+HANDLE g_hNetlibUser = NULL;
void WASocketConnection::initNetwork(HANDLE hNetlibUser) throw (WAException)
{
- WASocketConnection::hNetlibUser = hNetlibUser;
+ g_hNetlibUser = hNetlibUser;
}
void WASocketConnection::quitNetwork()
@@ -18,8 +18,7 @@ WASocketConnection::WASocketConnection(const std::string &dir, int port) throw (
noc.szHost = dir.c_str();
noc.wPort = port;
noc.flags = NLOCF_V2; // | NLOCF_SSL;
- this->hConn = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, reinterpret_cast<WPARAM>(this->hNetlibUser),
- reinterpret_cast<LPARAM>(&noc));
+ this->hConn = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, WPARAM(g_hNetlibUser), LPARAM(&noc));
if (this->hConn == NULL)
throw WAException(getLastErrorMsg(), WAException::SOCKET_EX, WAException::SOCKET_EX_OPEN);
@@ -36,10 +35,9 @@ void WASocketConnection::write(int i)
nlb.len = 1;
nlb.flags = MSG_NOHTTPGATEWAYWRAP | MSG_NODUMP;
- int result = CallService(MS_NETLIB_SEND, reinterpret_cast<WPARAM>(this->hConn), reinterpret_cast<LPARAM>(&nlb));
- if (result < 1) {
+ int result = CallService(MS_NETLIB_SEND, WPARAM(this->hConn), LPARAM(&nlb));
+ if (result < 1)
throw WAException(getLastErrorMsg(), WAException::SOCKET_EX, WAException::SOCKET_EX_SEND);
- }
}
void WASocketConnection::makeNonBlock()
@@ -58,9 +56,8 @@ void WASocketConnection::write(const std::vector<unsigned char> &bytes, int leng
nlb.flags = MSG_NODUMP;
int result = CallService(MS_NETLIB_SEND, WPARAM(hConn), LPARAM(&nlb));
- if (result < length) {
+ if (result < length)
throw WAException(getLastErrorMsg(), WAException::SOCKET_EX, WAException::SOCKET_EX_SEND);
- }
}
unsigned char WASocketConnection::read()
@@ -107,7 +104,7 @@ void WASocketConnection::forceShutdown()
void WASocketConnection::log(const char *prefix, const char *str)
{
- Netlib_Logf(WASocketConnection::hNetlibUser, "%s%s", prefix, str);
+ Netlib_Logf(g_hNetlibUser, "%s%s", prefix, str);
}
WASocketConnection::~WASocketConnection()
diff --git a/protocols/WhatsApp/src/WASocketConnection.h b/protocols/WhatsApp/src/WASocketConnection.h
index 802ba911b3..8770582ce7 100644
--- a/protocols/WhatsApp/src/WASocketConnection.h
+++ b/protocols/WhatsApp/src/WASocketConnection.h
@@ -6,10 +6,6 @@
class WASocketConnection : public ISocketConnection
{
-public:
- static HANDLE hNetlibUser;
-
-private:
int readSize;
int maxBufRead;
bool connected;
diff --git a/protocols/WhatsApp/src/WhatsAPI++/MediaUploader.cpp b/protocols/WhatsApp/src/WhatsAPI++/MediaUploader.cpp
index ef8fec4bb3..b2fa8ff091 100644
--- a/protocols/WhatsApp/src/WhatsAPI++/MediaUploader.cpp
+++ b/protocols/WhatsApp/src/WhatsAPI++/MediaUploader.cpp
@@ -55,8 +55,7 @@ namespace MediaUploader
nlhr.pData = (char*)allVector.data();
nlhr.dataLength = (int)allVector.size();
- NETLIBHTTPREQUEST* pnlhr = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,
- (WPARAM)WASocketConnection::hNetlibUser, (LPARAM)&nlhr);
+ NETLIBHTTPREQUEST *pnlhr = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)g_hNetlibUser, (LPARAM)&nlhr);
string data = pnlhr->pData;
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp
index 1045d73536..05954b7809 100644
--- a/protocols/WhatsApp/src/proto.cpp
+++ b/protocols/WhatsApp/src/proto.cpp
@@ -231,7 +231,7 @@ bool WhatsAppProto::Register(int state, const string &cc, const string &number,
string idx;
DBVARIANT dbv;
- if (WASocketConnection::hNetlibUser == NULL) {
+ if (g_hNetlibUser == NULL) {
NotifyEvent(m_tszUserName, TranslateT("Network connection error."), NULL, WHATSAPP_EVENT_CLIENT);
return false;
}
@@ -261,8 +261,7 @@ bool WhatsAppProto::Register(int state, const string &cc, const string &number,
nlhr.headersCount = _countof(s_registerHeaders);
nlhr.flags = NLHRF_HTTP11 | NLHRF_SSL;
- NETLIBHTTPREQUEST* pnlhr = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION,
- (WPARAM)WASocketConnection::hNetlibUser, (LPARAM)&nlhr);
+ NETLIBHTTPREQUEST* pnlhr = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)g_hNetlibUser, (LPARAM)&nlhr);
const wchar_t *ptszTitle = TranslateT("Registration");
if (pnlhr == NULL) {
diff --git a/protocols/WhatsApp/src/stdafx.h b/protocols/WhatsApp/src/stdafx.h
index e10a495874..6fd6adbc8b 100644
--- a/protocols/WhatsApp/src/stdafx.h
+++ b/protocols/WhatsApp/src/stdafx.h
@@ -88,3 +88,4 @@ Copyright © 2013-14 Uli Hecht
extern HINSTANCE g_hInstance;
extern std::string g_strUserAgent;
extern DWORD g_mirandaVersion;
+extern HANDLE g_hNetlibUser;