diff options
author | George Hazan <ghazan@miranda.im> | 2017-01-13 00:01:59 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-01-13 00:01:59 +0300 |
commit | e145db68fb5b7d0682a4b2be0174cebfe47dd74e (patch) | |
tree | c8f9edc907876d236eb16bc8ca8b592accb9846f /protocols/IcqOscarJ | |
parent | 3cb3883908e3168e5f955be3143771721614307a (diff) |
a bit less netlib services
Diffstat (limited to 'protocols/IcqOscarJ')
-rw-r--r-- | protocols/IcqOscarJ/src/chan_04close.cpp | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_avatar.cpp | 8 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_direct.cpp | 9 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_server.cpp | 5 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/init.cpp | 2 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/oscar_filetransfer.cpp | 9 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/utilities.cpp | 9 |
7 files changed, 19 insertions, 25 deletions
diff --git a/protocols/IcqOscarJ/src/chan_04close.cpp b/protocols/IcqOscarJ/src/chan_04close.cpp index c9d4157f8e..315b22c888 100644 --- a/protocols/IcqOscarJ/src/chan_04close.cpp +++ b/protocols/IcqOscarJ/src/chan_04close.cpp @@ -142,7 +142,7 @@ int CIcqProto::connectNewServer(serverthread_info *info) if (hServerConn) {
/* Time to recreate the packet receiver */
- info->hPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)hServerConn, 0x2400);
+ info->hPacketRecver = Netlib_CreatePacketReceiver(hServerConn, 0x2400);
if (!info->hPacketRecver)
debugLogA("Error: Failed to create packet receiver.");
else { // we need to reset receiving structs
diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp index 6fd71d67e0..ad93fb8065 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.cpp +++ b/protocols/IcqOscarJ/src/icq_avatar.cpp @@ -879,14 +879,14 @@ void avatars_server_connection::checkRequestQueue() void avatars_server_connection::connectionThread()
{
// This is the "infinite" loop that receives the packets from the ICQ avatar server
- NETLIBPACKETRECVER packetRecv = { 0 };
DWORD dwLastKeepAlive = time(0) + KEEPALIVE_INTERVAL;
- hPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)hConnection, 65536);
- packetRecv.cbSize = sizeof(packetRecv);
+ hPacketRecver = Netlib_CreatePacketReceiver(hConnection, 65536);
+
+ NETLIBPACKETRECVER packetRecv = {};
packetRecv.dwTimeout = 1000; // timeout - for stopThread to work
while (!stopThread) {
- int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)hPacketRecver, (LPARAM)&packetRecv);
+ int recvResult = Netlib_GetMorePackets(hPacketRecver, &packetRecv);
if (recvResult == 0) {
ppro->debugLogA("Clean closure of avatar socket");
break;
diff --git a/protocols/IcqOscarJ/src/icq_direct.cpp b/protocols/IcqOscarJ/src/icq_direct.cpp index 59cc9bc35b..d87b215704 100644 --- a/protocols/IcqOscarJ/src/icq_direct.cpp +++ b/protocols/IcqOscarJ/src/icq_direct.cpp @@ -194,9 +194,8 @@ void __cdecl CIcqProto::icq_directThread(directthreadstartinfo *dtsi) {
Thread_SetName("ICQ: directThread");
+ NETLIBPACKETRECVER packetRecv = {};
directconnect dc = { 0 };
- NETLIBPACKETRECVER packetRecv = { 0 };
- HANDLE hPacketRecver;
BOOL bFirstPacket = TRUE;
size_t nSkipPacketBytes = 0;
DWORD dwReqMsgID1 = 0, dwReqMsgID2 = 0;
@@ -333,16 +332,14 @@ void __cdecl CIcqProto::icq_directThread(directthreadstartinfo *dtsi) }
}
- hPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)dc.hConnection, 8192);
- packetRecv.cbSize = sizeof(packetRecv);
- packetRecv.bytesUsed = 0;
+ HANDLE hPacketRecver = Netlib_CreatePacketReceiver(dc.hConnection, 8192);
// Packet receiving loop
while (dc.hConnection) {
packetRecv.dwTimeout = dc.wantIdleTime ? 0 : 600000;
- int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)hPacketRecver, (LPARAM)&packetRecv);
+ int recvResult = Netlib_GetMorePackets(hPacketRecver, &packetRecv);
if (recvResult == 0) {
NetLog_Direct("Clean closure of direct socket (%p)", dc.hConnection);
break;
diff --git a/protocols/IcqOscarJ/src/icq_server.cpp b/protocols/IcqOscarJ/src/icq_server.cpp index 87e1007267..1de0a261e5 100644 --- a/protocols/IcqOscarJ/src/icq_server.cpp +++ b/protocols/IcqOscarJ/src/icq_server.cpp @@ -107,17 +107,16 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) // This is the "infinite" loop that receives the packets from the ICQ server
NETLIBPACKETRECVER packetRecv;
- info.hPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)hServerConn, 0x2400);
+ info.hPacketRecver = Netlib_CreatePacketReceiver(hServerConn, 0x2400);
while (serverThreadHandle) {
if (info.bReinitRecver) { // we reconnected, reinit struct
info.bReinitRecver = false;
memset(&packetRecv, 0, sizeof(packetRecv));
- packetRecv.cbSize = sizeof(packetRecv);
packetRecv.dwTimeout = 1000;
}
- int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)info.hPacketRecver, (LPARAM)&packetRecv);
+ int recvResult = Netlib_GetMorePackets(info.hPacketRecver, &packetRecv);
if (recvResult == 0) {
debugLogA("Clean closure of server socket");
break;
diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp index 57277b4a51..20d7165643 100644 --- a/protocols/IcqOscarJ/src/init.cpp +++ b/protocols/IcqOscarJ/src/init.cpp @@ -157,7 +157,7 @@ void CIcqProto::UpdateGlobalSettings() if (m_hNetlibUser) {
NETLIBUSERSETTINGS nlus = { sizeof(NETLIBUSERSETTINGS) };
- if ( !m_bSecureConnection && CallService(MS_NETLIB_GETUSERSETTINGS, (WPARAM)m_hNetlibUser, (LPARAM)&nlus)) {
+ if (!m_bSecureConnection && Netlib_GetUserSettings(m_hNetlibUser, &nlus)) {
if (nlus.useProxy && nlus.proxyType == PROXYTYPE_HTTP)
m_bGatewayMode = 1;
else
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp index 5d5d480194..69ca05538a 100644 --- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp @@ -1101,8 +1101,6 @@ void __cdecl CIcqProto::oft_connectionThread(oscarthreadstartinfo *otsi) {
oscar_connection oc = { 0 };
oscar_listener *source;
- NETLIBPACKETRECVER packetRecv = { 0 };
- HANDLE hPacketRecver;
Thread_SetName("ICQ: oft_connectionThread");
@@ -1299,15 +1297,16 @@ void __cdecl CIcqProto::oft_connectionThread(oscarthreadstartinfo *otsi) oft_sendPeerInit(&oc);
}
}
- hPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)oc.hConnection, 8192);
- packetRecv.cbSize = sizeof(packetRecv);
+
+ HANDLE hPacketRecver = Netlib_CreatePacketReceiver(oc.hConnection, 8192);
+ NETLIBPACKETRECVER packetRecv = {};
// Packet receiving loop
while (oc.hConnection) {
packetRecv.dwTimeout = oc.wantIdleTime ? 0 : 120000;
- int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)hPacketRecver, (LPARAM)&packetRecv);
+ int recvResult = Netlib_GetMorePackets(hPacketRecver, &packetRecv);
if (!recvResult) {
NetLog_Direct("Clean closure of oscar socket (%p)", oc.hConnection);
break;
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index 7ad7f12dbf..85a34e4238 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -1367,20 +1367,19 @@ HANDLE NetLib_OpenConnection(HNETLIBUSER hUser, const char* szIdent, NETLIBOPENC nloc->cbSize = sizeof(NETLIBOPENCONNECTION);
nloc->flags |= NLOCF_V2;
-
- return (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hUser, (LPARAM)nloc);
+ return Netlib_OpenConnection(hUser, nloc);
}
HANDLE CIcqProto::NetLib_BindPort(NETLIBNEWCONNECTIONPROC_V2 pFunc, void* lParam, WORD* pwPort, DWORD* pdwIntIP)
{
- NETLIBBIND nlb = { 0 };
+ NETLIBBIND nlb = {};
nlb.cbSize = sizeof(NETLIBBIND);
nlb.pfnNewConnectionV2 = pFunc;
nlb.pExtra = lParam;
SetLastError(ERROR_INVALID_PARAMETER); // this must be here - NetLib does not set any error :((
-
- HANDLE hBoundPort = (HANDLE)CallService(MS_NETLIB_BINDPORT, (WPARAM)m_hDirectNetlibUser, (LPARAM)&nlb);
+
+ HANDLE hBoundPort = Netlib_BindPort(m_hDirectNetlibUser, &nlb);
if (pwPort) *pwPort = nlb.wPort;
if (pdwIntIP) *pdwIntIP = nlb.dwInternalIP;
|