diff options
Diffstat (limited to 'protocols/AimOscar')
-rwxr-xr-x | protocols/AimOscar/src/connection.cpp | 55 | ||||
-rw-r--r-- | protocols/AimOscar/src/defines.h | 2 | ||||
-rw-r--r-- | protocols/AimOscar/src/direct_connect.cpp | 5 | ||||
-rw-r--r-- | protocols/AimOscar/src/file.cpp | 8 | ||||
-rwxr-xr-x | protocols/AimOscar/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/AimOscar/src/proxy.cpp | 7 |
6 files changed, 37 insertions, 42 deletions
diff --git a/protocols/AimOscar/src/connection.cpp b/protocols/AimOscar/src/connection.cpp index 15e88e87af..a3635cdcfc 100755 --- a/protocols/AimOscar/src/connection.cpp +++ b/protocols/AimOscar/src/connection.cpp @@ -28,7 +28,7 @@ HANDLE CAimProto::aim_connect(const char* server, unsigned short port, bool use_ ncon.timeout = 6;
ncon.flags = NLOCF_V2;
debugLogA("%s:%u", server, port);
- HANDLE con = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)m_hNetlibUser, (LPARAM)&ncon);
+ HANDLE con = Netlib_OpenConnection(m_hNetlibUser, &ncon);
if (con && use_ssl) {
NETLIBSSL ssl = { 0 };
ssl.cbSize = sizeof(ssl);
@@ -49,7 +49,7 @@ HANDLE CAimProto::aim_peer_connect(const char* ip, unsigned short port) ncon.szHost = ip;
ncon.wPort = port;
ncon.timeout = 3;
- return (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)m_hNetlibPeer, (LPARAM)&ncon);
+ return Netlib_OpenConnection(m_hNetlibPeer, &ncon);
}
HANDLE CAimProto::aim_peer_connect(unsigned long ip, unsigned short port)
@@ -68,12 +68,12 @@ void CAimProto::aim_connection_authorization(void) mir_free(m_username);
m_username = getStringA(AIM_KEY_SN);
if (m_username != NULL) {
- HANDLE hServerPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)m_hServerConn, 2048 * 4);
- NETLIBPACKETRECVER packetRecv = { 0 };
- packetRecv.cbSize = sizeof(packetRecv);
+ HANDLE hServerPacketRecver = Netlib_CreatePacketReceiver(m_hServerConn, 2048 * 4);
+
+ NETLIBPACKETRECVER packetRecv = {};
packetRecv.dwTimeout = 5000;
for (;;) {
- int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)hServerPacketRecver, (LPARAM)& packetRecv);
+ int recvResult = Netlib_GetMorePackets(hServerPacketRecver, &packetRecv);
if (recvResult == 0) {
debugLogA("Connection Closed: No Error? during Connection Authorization");
break;
@@ -347,15 +347,12 @@ void CAimProto::aim_connection_clientlogin(void) void __cdecl CAimProto::aim_protocol_negotiation(void*)
{
- HANDLE hServerPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)m_hServerConn, 2048 * 8);
-
-
+ HANDLE hServerPacketRecver = Netlib_CreatePacketReceiver(m_hServerConn, 2048 * 8);
- NETLIBPACKETRECVER packetRecv = { 0 };
- packetRecv.cbSize = sizeof(packetRecv);
+ NETLIBPACKETRECVER packetRecv = {};
packetRecv.dwTimeout = DEFAULT_KEEPALIVE_TIMER * 1000;
for (;;) {
- int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)hServerPacketRecver, (LPARAM)&packetRecv);
+ int recvResult = Netlib_GetMorePackets(hServerPacketRecver, &packetRecv);
if (recvResult == 0) {
debugLogA("Connection Closed: No Error during Connection Negotiation?");
break;
@@ -477,13 +474,13 @@ exit: void __cdecl CAimProto::aim_mail_negotiation(void*)
{
- HANDLE hServerPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)m_hMailConn, 2048 * 8);
+ HANDLE hServerPacketRecver = Netlib_CreatePacketReceiver(m_hMailConn, 2048 * 8);
NETLIBPACKETRECVER packetRecv = { 0 };
- packetRecv.cbSize = sizeof(packetRecv);
packetRecv.dwTimeout = DEFAULT_KEEPALIVE_TIMER * 1000;
+
while (m_iStatus != ID_STATUS_OFFLINE) {
- int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)hServerPacketRecver, (LPARAM)&packetRecv);
+ int recvResult = Netlib_GetMorePackets(hServerPacketRecver, &packetRecv);
if (recvResult == 0)
break;
@@ -539,13 +536,13 @@ exit: void __cdecl CAimProto::aim_avatar_negotiation(void*)
{
- HANDLE hServerPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)m_hAvatarConn, 2048 * 8);
+ HANDLE hServerPacketRecver = Netlib_CreatePacketReceiver(m_hAvatarConn, 2048 * 8);
NETLIBPACKETRECVER packetRecv = { 0 };
- packetRecv.cbSize = sizeof(packetRecv);
packetRecv.dwTimeout = 300000;//5 minutes connected
+
for (;;) {
- int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)hServerPacketRecver, (LPARAM)& packetRecv);
+ int recvResult = Netlib_GetMorePackets(hServerPacketRecver, &packetRecv);
if (recvResult == 0)
break;
@@ -599,13 +596,13 @@ exit: void __cdecl CAimProto::aim_chatnav_negotiation(void*)
{
unsigned idle_chat = 0;
- HANDLE hServerPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)m_hChatNavConn, 2048 * 8);
+ HANDLE hServerPacketRecver = Netlib_CreatePacketReceiver(m_hChatNavConn, 2048 * 8);
NETLIBPACKETRECVER packetRecv = { 0 };
- packetRecv.cbSize = sizeof(packetRecv);
packetRecv.dwTimeout = DEFAULT_KEEPALIVE_TIMER * 1000;
+
for (;;) {
- int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)hServerPacketRecver, (LPARAM)&packetRecv);
+ int recvResult = Netlib_GetMorePackets(hServerPacketRecver, &packetRecv);
if (recvResult == 0)
break;
@@ -668,13 +665,13 @@ exit: void __cdecl CAimProto::aim_chat_negotiation(void* param)
{
chat_list_item *item = (chat_list_item*)param;
- HANDLE hServerPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)item->hconn, 2048 * 8);
+ HANDLE hServerPacketRecver = Netlib_CreatePacketReceiver(item->hconn, 2048 * 8);
NETLIBPACKETRECVER packetRecv = { 0 };
- packetRecv.cbSize = sizeof(packetRecv);
packetRecv.dwTimeout = DEFAULT_KEEPALIVE_TIMER * 1000;
+
for (;;) {
- int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)hServerPacketRecver, (LPARAM)&packetRecv);
+ int recvResult = Netlib_GetMorePackets(hServerPacketRecver, &packetRecv);
if (recvResult == 0)
break;
@@ -733,13 +730,13 @@ exit: void __cdecl CAimProto::aim_admin_negotiation(void*)
{
- HANDLE hServerPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)m_hAdminConn, 2048 * 8);
+ HANDLE hServerPacketRecver = Netlib_CreatePacketReceiver(m_hAdminConn, 2048 * 8);
+
+ NETLIBPACKETRECVER packetRecv = {};
+ packetRecv.dwTimeout = 300000; // 5 minutes connected
- NETLIBPACKETRECVER packetRecv = { 0 };
- packetRecv.cbSize = sizeof(packetRecv);
- packetRecv.dwTimeout = 300000;//5 minutes connected
for (;;) {
- int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)hServerPacketRecver, (LPARAM)& packetRecv);
+ int recvResult = Netlib_GetMorePackets(hServerPacketRecver, &packetRecv);
if (recvResult == 0)
break;
diff --git a/protocols/AimOscar/src/defines.h b/protocols/AimOscar/src/defines.h index 2caf13aa05..11126ac2fb 100644 --- a/protocols/AimOscar/src/defines.h +++ b/protocols/AimOscar/src/defines.h @@ -305,7 +305,7 @@ public: unsigned short LocalPort;// our port
//Peer connection stuff
- HANDLE m_hNetlibPeer;//handle to the peer netlib
+ HNETLIBUSER m_hNetlibPeer;//handle to the peer netlib
HANDLE hDirectBoundPort;//direct connection listening port
HANDLE current_rendezvous_accept_user;//hack
diff --git a/protocols/AimOscar/src/direct_connect.cpp b/protocols/AimOscar/src/direct_connect.cpp index fa1f8ea22c..2b4bcb9366 100644 --- a/protocols/AimOscar/src/direct_connect.cpp +++ b/protocols/AimOscar/src/direct_connect.cpp @@ -25,11 +25,10 @@ void __cdecl CAimProto::aim_dc_helper(void* param) //only called when we are ini ProtoBroadcastAck(ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTED, ft, 0);
- NETLIBPACKETRECVER packetRecv = { 0 };
- packetRecv.cbSize = sizeof(packetRecv);
+ NETLIBPACKETRECVER packetRecv = {};
packetRecv.dwTimeout = 350000;
- HANDLE hServerPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)ft->hConn, 2048 * 4);
+ HANDLE hServerPacketRecver = Netlib_CreatePacketReceiver(ft->hConn, 2048 * 4);
int result;
if (ft->sending)//we are sending
diff --git a/protocols/AimOscar/src/file.cpp b/protocols/AimOscar/src/file.cpp index 007359eb8f..cdb81e03b6 100644 --- a/protocols/AimOscar/src/file.cpp +++ b/protocols/AimOscar/src/file.cpp @@ -154,7 +154,7 @@ int CAimProto::sending_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLI for (;;) {
int recvResult = packetRecv.bytesAvailable - packetRecv.bytesUsed;
if (recvResult <= 0)
- recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)hServerPacketRecver, (LPARAM)&packetRecv);
+ recvResult = Netlib_GetMorePackets(hServerPacketRecver, &packetRecv);
if (recvResult == 0) {
debugLogA("P2P: File transfer connection Error: 0");
break;
@@ -272,7 +272,7 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET for (;;) {
int recvResult = packetRecv.bytesAvailable - packetRecv.bytesUsed;
if (recvResult <= 0)
- recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)hServerPacketRecver, (LPARAM)&packetRecv);
+ recvResult = Netlib_GetMorePackets(hServerPacketRecver, &packetRecv);
if (recvResult == 0) {
debugLogA("P2P: File transfer connection Error: 0");
break;
@@ -529,11 +529,11 @@ void file_transfer::listen(CAimProto* ppro) {
if (hDirectBoundPort) return;
- NETLIBBIND nlb = { 0 };
+ NETLIBBIND nlb = {};
nlb.cbSize = sizeof(nlb);
nlb.pfnNewConnectionV2 = aim_direct_connection_initiated;
nlb.pExtra = ppro;
- hDirectBoundPort = (HANDLE)CallService(MS_NETLIB_BINDPORT, (WPARAM)ppro->m_hNetlibPeer, (LPARAM)&nlb);
+ hDirectBoundPort = Netlib_BindPort(ppro->m_hNetlibPeer, &nlb);
local_port = hDirectBoundPort ? nlb.wPort : 0;
}
diff --git a/protocols/AimOscar/src/proto.h b/protocols/AimOscar/src/proto.h index 79980483eb..f2a31d60d6 100755 --- a/protocols/AimOscar/src/proto.h +++ b/protocols/AimOscar/src/proto.h @@ -129,7 +129,7 @@ struct CAimProto : public PROTO<CAimProto> unsigned short m_local_port; // our port
//Peer connection stuff
- HANDLE m_hNetlibPeer;//handle to the peer netlib
+ HNETLIBUSER m_hNetlibPeer;//handle to the peer netlib
HANDLE m_hDirectBoundPort;//direct connection listening port
//Handles for the context menu items
diff --git a/protocols/AimOscar/src/proxy.cpp b/protocols/AimOscar/src/proxy.cpp index 10e04df718..d3ac4deebe 100644 --- a/protocols/AimOscar/src/proxy.cpp +++ b/protocols/AimOscar/src/proxy.cpp @@ -34,14 +34,13 @@ void __cdecl CAimProto::aim_proxy_helper(void* param) }
//start listen for packets stuff
- NETLIBPACKETRECVER packetRecv = {0};
- packetRecv.cbSize = sizeof(packetRecv);
+ NETLIBPACKETRECVER packetRecv = {};
packetRecv.dwTimeout = INFINITE;
- HANDLE hServerPacketRecver = (HANDLE) CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)ft->hConn, 2048 * 4);
+ HANDLE hServerPacketRecver = Netlib_CreatePacketReceiver(ft->hConn, 2048 * 4);
for (;;)
{
- int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)hServerPacketRecver, (LPARAM)&packetRecv);
+ int recvResult = Netlib_GetMorePackets(hServerPacketRecver, &packetRecv);
if (recvResult == 0)
{
ProtoBroadcastAck(ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
|