summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-01-14 01:22:55 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-01-14 01:22:55 +0300
commitd3cb19278d60ac6f7963379254546cdca36a90e2 (patch)
treef2fa018b343d5460419c1b323f5f3ce04a393d00
parentd5a6c0666a8d8d2055a3f4402f67f91e8548ec3a (diff)
separate handle types for HNETLIBCONN & HNETLIBBIND
-rw-r--r--include/m_core.h4
-rw-r--r--include/m_netlib.h60
-rw-r--r--plugins/HTTPServer/src/FileShareNode.cpp2
-rw-r--r--plugins/HTTPServer/src/FileShareNode.h4
-rw-r--r--plugins/HTTPServer/src/HttpUser.cpp2
-rw-r--r--plugins/HTTPServer/src/HttpUser.h2
-rw-r--r--plugins/HTTPServer/src/main.cpp3
-rw-r--r--plugins/NewsAggregator/Src/Utils.cpp2
-rw-r--r--plugins/Ping/src/utils.cpp2
-rw-r--r--plugins/PluginUpdater/src/DlgListNew.cpp2
-rw-r--r--plugins/PluginUpdater/src/DlgUpdate.cpp4
-rw-r--r--plugins/PluginUpdater/src/Utils.cpp4
-rw-r--r--plugins/PluginUpdater/src/stdafx.h2
-rw-r--r--plugins/SmileyAdd/src/download.cpp4
-rwxr-xr-xplugins/Watrack_MPD/src/main.cpp4
-rw-r--r--plugins/Weather/src/stdafx.h3
-rw-r--r--plugins/Weather/src/weather_http.cpp2
-rw-r--r--plugins/YAMN/src/proto/netlib.cpp4
-rw-r--r--plugins/YAMN/src/proto/netlib.h6
-rw-r--r--protocols/AimOscar/src/away.cpp8
-rw-r--r--protocols/AimOscar/src/chat.h26
-rwxr-xr-xprotocols/AimOscar/src/client.cpp110
-rwxr-xr-xprotocols/AimOscar/src/connection.cpp8
-rw-r--r--protocols/AimOscar/src/direct_connect.cpp4
-rw-r--r--protocols/AimOscar/src/direct_connect.h2
-rw-r--r--protocols/AimOscar/src/file.cpp1
-rw-r--r--protocols/AimOscar/src/file.h4
-rw-r--r--protocols/AimOscar/src/packets.cpp2
-rwxr-xr-xprotocols/AimOscar/src/proto.h181
-rw-r--r--protocols/AimOscar/src/proxy.cpp4
-rw-r--r--protocols/AimOscar/src/proxy.h4
-rw-r--r--protocols/AimOscar/src/server.cpp26
-rw-r--r--protocols/AimOscar/src/thread.cpp2
-rwxr-xr-xprotocols/AimOscar/src/utility.cpp6
-rw-r--r--protocols/Discord/src/proto.h7
-rw-r--r--protocols/FacebookRM/src/avatars.cpp2
-rw-r--r--protocols/FacebookRM/src/client.h8
-rw-r--r--protocols/FacebookRM/src/communication.cpp2
-rw-r--r--protocols/FacebookRM/src/messages.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/oauth.cpp2
-rw-r--r--protocols/IRCG/src/irclib.cpp15
-rw-r--r--protocols/IRCG/src/irclib.h10
-rw-r--r--protocols/IRCG/src/stdafx.h6
-rw-r--r--protocols/IRCG/src/tools.cpp2
-rw-r--r--protocols/IcqOscarJ/src/cookies.h2
-rw-r--r--protocols/IcqOscarJ/src/fam_01service.cpp2
-rw-r--r--protocols/IcqOscarJ/src/guids.h6
-rw-r--r--protocols/IcqOscarJ/src/icq_avatar.cpp10
-rw-r--r--protocols/IcqOscarJ/src/icq_avatar.h4
-rw-r--r--protocols/IcqOscarJ/src/icq_direct.cpp8
-rw-r--r--protocols/IcqOscarJ/src/icq_direct.h4
-rw-r--r--protocols/IcqOscarJ/src/icq_http.cpp8
-rw-r--r--protocols/IcqOscarJ/src/icq_http.h8
-rw-r--r--protocols/IcqOscarJ/src/icq_proto.h8
-rw-r--r--protocols/IcqOscarJ/src/icq_server.cpp5
-rw-r--r--protocols/IcqOscarJ/src/icq_server.h2
-rw-r--r--protocols/IcqOscarJ/src/oscar_filetransfer.cpp10
-rw-r--r--protocols/IcqOscarJ/src/oscar_filetransfer.h4
-rw-r--r--protocols/IcqOscarJ/src/stdpackets.cpp2
-rw-r--r--protocols/IcqOscarJ/src/utilities.cpp12
-rw-r--r--protocols/IcqOscarJ/src/utilities.h6
-rw-r--r--protocols/JabberG/src/jabber_byte.cpp15
-rw-r--r--protocols/JabberG/src/jabber_byte.h4
-rw-r--r--protocols/JabberG/src/jabber_file.cpp9
-rw-r--r--protocols/JabberG/src/jabber_ft.cpp4
-rw-r--r--protocols/JabberG/src/jabber_ibb.h2
-rw-r--r--protocols/JabberG/src/jabber_proto.h18
-rw-r--r--protocols/JabberG/src/jabber_util.cpp2
-rw-r--r--protocols/JabberG/src/jabber_ws.cpp6
-rw-r--r--protocols/JabberG/src/stdafx.h5
-rw-r--r--protocols/MRA/src/MraAvatars.cpp12
-rw-r--r--protocols/MRA/src/MraFilesQueue.cpp7
-rw-r--r--protocols/MRA/src/MraFilesQueue.h2
-rw-r--r--protocols/MRA/src/MraMRIMProxy.cpp4
-rw-r--r--protocols/MRA/src/MraProto.h8
-rw-r--r--protocols/MRA/src/MraSendCommand.cpp2
-rw-r--r--protocols/MSN/src/msn_http.cpp6
-rw-r--r--protocols/MSN/src/msn_proto.cpp10
-rw-r--r--protocols/MSN/src/msn_proto.h2
-rw-r--r--protocols/MSN/src/msn_threads.cpp4
-rw-r--r--protocols/MSN/src/stdafx.h12
-rw-r--r--protocols/MinecraftDynmap/src/proto.h4
-rw-r--r--protocols/Omegle/src/client.h4
-rw-r--r--protocols/Sametime/src/sametime_proto.h2
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h6
-rw-r--r--protocols/Steam/src/steam_events.cpp7
-rw-r--r--protocols/Steam/src/steam_proto.cpp3
-rw-r--r--protocols/Steam/src/steam_proto.h1
-rw-r--r--protocols/Tlen/src/stdafx.h10
-rw-r--r--protocols/Tlen/src/tlen_file.cpp14
-rw-r--r--protocols/Tlen/src/tlen_p2p_old.cpp21
-rw-r--r--protocols/Tlen/src/tlen_p2p_old.h10
-rw-r--r--protocols/Tlen/src/tlen_picture.cpp4
-rw-r--r--protocols/Tlen/src/tlen_voice.cpp14
-rw-r--r--protocols/Tlen/src/tlen_ws.cpp6
-rw-r--r--protocols/Twitter/src/proto.cpp8
-rw-r--r--protocols/Twitter/src/proto.h1
-rw-r--r--protocols/Twitter/src/utility.h2
-rw-r--r--protocols/VKontakte/src/vk_proto.h6
-rw-r--r--protocols/WhatsApp/src/WASocketConnection.h2
-rw-r--r--src/mir_app/src/netlib.cpp9
-rw-r--r--src/mir_app/src/netlibbind.cpp4
-rw-r--r--src/mir_app/src/netlibhttp.cpp5
-rw-r--r--src/mir_app/src/netlibopenconn.cpp4
-rw-r--r--src/mir_app/src/netlibsock.cpp14
105 files changed, 460 insertions, 496 deletions
diff --git a/include/m_core.h b/include/m_core.h
index efd7e6ba7c..d973a63da3 100644
--- a/include/m_core.h
+++ b/include/m_core.h
@@ -44,9 +44,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef MIR_APP_EXPORTS
#define MIR_APP_EXPORT __declspec(dllexport)
typedef struct NetlibUser* HNETLIBUSER;
+ typedef struct NetlibConnection* HNETLIBCONN;
+ typedef struct NetlibBoundPort* HNETLIBBIND;
#else
#define MIR_APP_EXPORT __declspec(dllimport)
DECLARE_HANDLE(HNETLIBUSER);
+ DECLARE_HANDLE(HNETLIBCONN);
+ DECLARE_HANDLE(HNETLIBBIND);
#endif
#define MIR_APP_DLL(T) MIR_APP_EXPORT T __stdcall
diff --git a/include/m_netlib.h b/include/m_netlib.h
index 3bdb0391bd..7f71da3dd3 100644
--- a/include/m_netlib.h
+++ b/include/m_netlib.h
@@ -57,9 +57,9 @@ struct NETLIBOPENCONNECTION;
// See notes below this function for the behaviour of HTTP gateways
// Errors: ERROR_INVALID_PARAMETER, ERROR_OUTOFMEMORY, ERROR_DUP_NAME
-typedef int (*NETLIBHTTPGATEWAYINITPROC)(HANDLE hConn, NETLIBOPENCONNECTION *nloc, NETLIBHTTPREQUEST *nlhr);
-typedef int (*NETLIBHTTPGATEWAYBEGINPROC)(HANDLE hConn, NETLIBOPENCONNECTION *nloc);
-typedef int (*NETLIBHTTPGATEWAYWRAPSENDPROC)(HANDLE hConn, PBYTE buf, int len, int flags);
+typedef int (*NETLIBHTTPGATEWAYINITPROC)(HNETLIBCONN hConn, NETLIBOPENCONNECTION *nloc, NETLIBHTTPREQUEST *nlhr);
+typedef int (*NETLIBHTTPGATEWAYBEGINPROC)(HNETLIBCONN hConn, NETLIBOPENCONNECTION *nloc);
+typedef int (*NETLIBHTTPGATEWAYWRAPSENDPROC)(HNETLIBCONN hConn, PBYTE buf, int len, int flags);
typedef PBYTE (*NETLIBHTTPGATEWAYUNWRAPRECVPROC)(NETLIBHTTPREQUEST *nlhr, PBYTE buf, int len, int *outBufLen, void *(*NetlibRealloc)(void*, size_t));
struct NETLIBUSER
@@ -258,12 +258,11 @@ EXTERN_C MIR_APP_DLL(int) Netlib_CloseHandle(HANDLE h);
/* pExtra was added during 0.3.4+, prior its just two args, since we use the cdecl convention
it shouldnt matter */
-typedef void (*NETLIBNEWCONNECTIONPROC_V2)(HANDLE hNewConnection, DWORD dwRemoteIP, void *pExtra);
-typedef void (*NETLIBNEWCONNECTIONPROC)(HANDLE hNewConnection, DWORD dwRemoteIP);
+typedef void (*NETLIBNEWCONNECTIONPROC_V2)(HNETLIBCONN hNewConnection, DWORD dwRemoteIP, void *pExtra);
+typedef void (*NETLIBNEWCONNECTIONPROC)(HNETLIBCONN hNewConnection, DWORD dwRemoteIP);
struct NETLIBBIND
{
- int cbSize;
union { // new code should use V2
NETLIBNEWCONNECTIONPROC pfnNewConnection;
NETLIBNEWCONNECTIONPROC_V2 pfnNewConnectionV2;
@@ -278,12 +277,12 @@ struct NETLIBBIND
WORD wExPort; // set on return, host byte order
};
-EXTERN_C MIR_APP_DLL(HANDLE) Netlib_BindPort(HNETLIBUSER nlu, NETLIBBIND *nlb);
+EXTERN_C MIR_APP_DLL(HNETLIBBIND) Netlib_BindPort(HNETLIBUSER nlu, NETLIBBIND *nlb);
/////////////////////////////////////////////////////////////////////////////////////////
// Open a connection
//
-// Returns a HANDLE to the new connection on success, NULL on failure
+// Returns a HNETLIBCONN to the new connection on success, NULL on failure
// hUser must have been returned by MS_NETLIB_REGISTERUSER
// Internally this function is the equivalent of socket(), gethostbyname(),
// connect()
@@ -326,10 +325,10 @@ struct NETLIBOPENCONNECTION
unsigned int timeout;
/* optional, called in the context of the thread that issued the attempt, if it returns 0 the connection attempt is
stopped, the remaining timeout value can also be adjusted */
- int (*waitcallback) (unsigned int * timeout);
+ int (*waitcallback) (unsigned int *timeout);
};
-EXTERN_C MIR_APP_DLL(HANDLE) Netlib_OpenConnection(HNETLIBUSER nlu, const NETLIBOPENCONNECTION *nloc);
+EXTERN_C MIR_APP_DLL(HNETLIBCONN) Netlib_OpenConnection(HNETLIBUSER nlu, const NETLIBOPENCONNECTION *nloc);
/////////////////////////////////////////////////////////////////////////////////////////
// Sets the required information for an HTTP proxy connection
@@ -353,7 +352,7 @@ struct NETLIBHTTPPROXYINFO
int combinePackets;
};
-EXTERN_C MIR_APP_DLL(int) Netlib_SetHttpProxyInfo(HANDLE hConnection, const NETLIBHTTPPROXYINFO *nlhpi);
+EXTERN_C MIR_APP_DLL(int) Netlib_SetHttpProxyInfo(HNETLIBCONN hConnection, const NETLIBHTTPPROXYINFO *nlhpi);
/////////////////////////////////////////////////////////////////////////////////////////
// Gets the SOCKET associated with a netlib handle
@@ -365,7 +364,7 @@ EXTERN_C MIR_APP_DLL(int) Netlib_SetHttpProxyInfo(HANDLE hConnection, const NETL
// HTTP proxy in which case calling send() or recv() will totally break things.
// Errors: ERROR_INVALID_PARAMETER
-EXTERN_C MIR_APP_DLL(UINT_PTR) Netlib_GetSocket(HANDLE hConnection);
+EXTERN_C MIR_APP_DLL(UINT_PTR) Netlib_GetSocket(HNETLIBCONN hConnection);
/////////////////////////////////////////////////////////////////////////////////////////
@@ -375,7 +374,7 @@ EXTERN_C MIR_APP_DLL(UINT_PTR) Netlib_GetSocket(HANDLE hConnection);
/////////////////////////////////////////////////////////////////////////////////////////
// Gets HNETLIBUSER owner of a connection
-EXTERN_C MIR_APP_DLL(HNETLIBUSER) Netlib_GetConnNlu(HANDLE hConn);
+EXTERN_C MIR_APP_DLL(HNETLIBUSER) Netlib_GetConnNlu(HNETLIBCONN hConn);
/////////////////////////////////////////////////////////////////////////////////////////
// Converts numerical representation of IP in SOCKADDR_INET into string representation with IP and port
@@ -400,7 +399,7 @@ struct NETLIBCONNINFO
WORD wPort;
};
-EXTERN_C MIR_APP_DLL(int) Netlib_GetConnectionInfo(HANDLE hConnection, NETLIBCONNINFO *connInfo);
+EXTERN_C MIR_APP_DLL(int) Netlib_GetConnectionInfo(HNETLIBCONN hConnection, NETLIBCONNINFO *connInfo);
/////////////////////////////////////////////////////////////////////////////////////////
// Gets connection Information
@@ -468,11 +467,11 @@ struct NETLIBHTTPREQUEST
int dataLength; // must be 0 for REQUEST_GET/REQUEST_CONNECT
int resultCode;
char *szResultDescr;
- HANDLE nlc;
+ HNETLIBCONN nlc;
int timeout;
};
-EXTERN_C MIR_APP_DLL(int) Netlib_SendHttpRequest(HANDLE hConnection, NETLIBHTTPREQUEST *pRec);
+EXTERN_C MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN hConnection, NETLIBHTTPREQUEST *pRec);
/////////////////////////////////////////////////////////////////////////////////////////
// Receives HTTP headers
@@ -491,7 +490,7 @@ EXTERN_C MIR_APP_DLL(int) Netlib_SendHttpRequest(HANDLE hConnection, NETLIBHTTPR
// ERROR_BUFFER_OVERFLOW (each header line must be less than 4096 chars long)
// ERROR_INVALID_DATA (first header line is malformed ("http/[01].[0-9] [0-9]+ .*", or no colon in subsequent line)
-EXTERN_C MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_RecvHttpHeaders(HANDLE hConnection, int flags = 0);
+EXTERN_C MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_RecvHttpHeaders(HNETLIBCONN hConnection, int flags = 0);
/////////////////////////////////////////////////////////////////////////////////////////
// Free the memory used by a NETLIBHTTPREQUEST structure
@@ -586,7 +585,7 @@ EXTERN_C MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_HttpTransaction(HNETLIBUSER hNlu
#define MSG_DUMPSSL 0x200000 // this is SSL traffic. For dump filtering only.
#define MSG_NOTITLE 0x400000 // skip date, time & protocol from dump
-EXTERN_C MIR_APP_DLL(int) Netlib_Send(HANDLE hConn, const char *buf, int len, int flags = 0);
+EXTERN_C MIR_APP_DLL(int) Netlib_Send(HNETLIBCONN hConn, const char *buf, int len, int flags = 0);
/////////////////////////////////////////////////////////////////////////////////////////
// Receive data over a connection
@@ -610,7 +609,7 @@ EXTERN_C MIR_APP_DLL(int) Netlib_Send(HANDLE hConn, const char *buf, int len, in
// nlu.pfnHttpGatewayUnwrapRecv, socket(), connect(),
// MS_NETLIB_SENDHTTPREQUEST
-EXTERN_C MIR_APP_DLL(int) Netlib_Recv(HANDLE hConn, char *buf, int len, int flags = 0);
+EXTERN_C MIR_APP_DLL(int) Netlib_Recv(HNETLIBCONN hConn, char *buf, int len, int flags = 0);
/////////////////////////////////////////////////////////////////////////////////////////
// Determine the status of one or more connections
@@ -623,9 +622,9 @@ EXTERN_C MIR_APP_DLL(int) Netlib_Recv(HANDLE hConn, char *buf, int len, int flag
struct NETLIBSELECT
{
DWORD dwTimeout; // in milliseconds, INFINITE is acceptable
- HANDLE hReadConns[FD_SETSIZE+1];
- HANDLE hWriteConns[FD_SETSIZE+1];
- HANDLE hExceptConns[FD_SETSIZE+1];
+ HNETLIBCONN hReadConns[FD_SETSIZE + 1];
+ HNETLIBCONN hWriteConns[FD_SETSIZE + 1];
+ HNETLIBCONN hExceptConns[FD_SETSIZE + 1];
};
EXTERN_C MIR_APP_DLL(int) Netlib_Select(NETLIBSELECT *nls);
@@ -633,9 +632,9 @@ EXTERN_C MIR_APP_DLL(int) Netlib_Select(NETLIBSELECT *nls);
struct NETLIBSELECTEX
{
DWORD dwTimeout; // in milliseconds, INFINITE is acceptable
- HANDLE hReadConns[FD_SETSIZE+1];
- HANDLE hWriteConns[FD_SETSIZE+1];
- HANDLE hExceptConns[FD_SETSIZE+1];
+ HNETLIBCONN hReadConns[FD_SETSIZE + 1];
+ HNETLIBCONN hWriteConns[FD_SETSIZE + 1];
+ HNETLIBCONN hExceptConns[FD_SETSIZE + 1];
BOOL hReadStatus[FD_SETSIZE+1]; /* out, [in, expected to be FALSE] */
BOOL hWriteStatus[FD_SETSIZE+1]; /* out, [in, expected to be FALSE] */
@@ -647,7 +646,7 @@ EXTERN_C MIR_APP_DLL(int) Netlib_SelectEx(NETLIBSELECTEX *nls);
/////////////////////////////////////////////////////////////////////////////////////////
// Shutdown connection
-EXTERN_C MIR_APP_DLL(void) Netlib_Shutdown(HANDLE h);
+EXTERN_C MIR_APP_DLL(void) Netlib_Shutdown(HNETLIBCONN h);
/////////////////////////////////////////////////////////////////////////////////////////
// Create a packet receiver
@@ -660,7 +659,7 @@ EXTERN_C MIR_APP_DLL(void) Netlib_Shutdown(HANDLE h);
// have arbitrarily large packets.
// Errors: ERROR_INVALID_PARAMETER, ERROR_OUTOFMEMORY
-EXTERN_C MIR_APP_DLL(HANDLE) Netlib_CreatePacketReceiver(HANDLE hConnection, int iMaxSize);
+EXTERN_C MIR_APP_DLL(HANDLE) Netlib_CreatePacketReceiver(HNETLIBCONN hConnection, int iMaxSize);
/////////////////////////////////////////////////////////////////////////////////////////
// Get the next set of packets from a packet receiver
@@ -694,19 +693,18 @@ EXTERN_C MIR_APP_DLL(int) Netlib_GetMorePackets(HANDLE hReceiver, NETLIBPACKETRE
/////////////////////////////////////////////////////////////////////////////////////////
// Sets a gateway polling timeout interval
-// wParam = (WPARAM)(HANDLE)hConn
-// lParam = (LPARAM)timeout
+//
// Returns previous timeout value
// Errors: -1
-EXTERN_C MIR_APP_DLL(int) Netlib_SetPollingTimeout(HANDLE hConnection, int iTimeout);
+EXTERN_C MIR_APP_DLL(int) Netlib_SetPollingTimeout(HNETLIBCONN hConnection, int iTimeout);
/////////////////////////////////////////////////////////////////////////////////////////
// Makes connection SSL
//
// Returns 0 on failure 1 on success
-EXTERN_C MIR_APP_DLL(int) Netlib_StartSsl(HANDLE hConnection, const char *host);
+EXTERN_C MIR_APP_DLL(int) Netlib_StartSsl(HNETLIBCONN hConnection, const char *host);
/////////////////////////////////////////////////////////////////////////////////////////
// netlib log funcitons
diff --git a/plugins/HTTPServer/src/FileShareNode.cpp b/plugins/HTTPServer/src/FileShareNode.cpp
index fbc2d43af6..a23f0c6fe4 100644
--- a/plugins/HTTPServer/src/FileShareNode.cpp
+++ b/plugins/HTTPServer/src/FileShareNode.cpp
@@ -36,7 +36,7 @@ mir_cs csFileShareListAccess;
// Developer : KN
/////////////////////////////////////////////////////////////////////
-CLShareUser::CLShareUser(HANDLE hCon, in_addr stAdd)
+CLShareUser::CLShareUser(HNETLIBCONN hCon, in_addr stAdd)
{
hConnection = hCon;
stAddr = stAdd;
diff --git a/plugins/HTTPServer/src/FileShareNode.h b/plugins/HTTPServer/src/FileShareNode.h
index bea6bf9d49..7c40bcced1 100644
--- a/plugins/HTTPServer/src/FileShareNode.h
+++ b/plugins/HTTPServer/src/FileShareNode.h
@@ -23,7 +23,7 @@
class CLShareUser {
public:
- CLShareUser(HANDLE hCon, in_addr stAdd);
+ CLShareUser(HNETLIBCONN hCon, in_addr stAdd);
virtual ~CLShareUser();
CLShareUser * pclNext;
in_addr stAddr;
@@ -35,7 +35,7 @@ public:
virtual const char * pszCustomInfo() = NULL;
void CloseSocket();
protected:
- HANDLE hConnection;
+ HNETLIBCONN hConnection;
DWORD dwSpeed;
};
diff --git a/plugins/HTTPServer/src/HttpUser.cpp b/plugins/HTTPServer/src/HttpUser.cpp
index ede33c5722..3ceb656f77 100644
--- a/plugins/HTTPServer/src/HttpUser.cpp
+++ b/plugins/HTTPServer/src/HttpUser.cpp
@@ -142,7 +142,7 @@ static int nUnescapedURI(char * pszURI)
// Developer : KN
/////////////////////////////////////////////////////////////////////
-CLHttpUser::CLHttpUser(HANDLE hCon, in_addr stAdd) : CLShareUser(hCon, stAdd)
+CLHttpUser::CLHttpUser(HNETLIBCONN hCon, in_addr stAdd) : CLShareUser(hCon, stAdd)
{
memset(apszParam, 0, sizeof(apszParam));
hFile = INVALID_HANDLE_VALUE;
diff --git a/plugins/HTTPServer/src/HttpUser.h b/plugins/HTTPServer/src/HttpUser.h
index 00b43a76eb..a5a7b2d24c 100644
--- a/plugins/HTTPServer/src/HttpUser.h
+++ b/plugins/HTTPServer/src/HttpUser.h
@@ -45,7 +45,7 @@ static char * szParmStr[eLastParam] = {
class CLHttpUser : public CLShareUser {
public:
- CLHttpUser(HANDLE hCon, in_addr stAdd);
+ CLHttpUser(HNETLIBCONN hCon, in_addr stAdd);
virtual ~CLHttpUser();
bool bReadGetParameters(char * pszRequest);
diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp
index c9f69a61a6..2670c256f0 100644
--- a/plugins/HTTPServer/src/main.cpp
+++ b/plugins/HTTPServer/src/main.cpp
@@ -582,7 +582,7 @@ void HandleNewConnection(void *ch)
// Developer : KN
/////////////////////////////////////////////////////////////////////
-void ConnectionOpen(HANDLE hNewConnection, DWORD dwRemoteIP)
+void ConnectionOpen(HNETLIBCONN hNewConnection, DWORD dwRemoteIP)
{
in_addr stAddr;
stAddr.S_un.S_addr = htonl(dwRemoteIP);
@@ -639,7 +639,6 @@ INT_PTR nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/)
Netlib_GetUserSettings(hNetlibUser, &nus);
NETLIBBIND nlb = {};
- nlb.cbSize = sizeof(NETLIBBIND);
nlb.pfnNewConnection = ConnectionOpen;
if (nus.specifyIncomingPorts && nus.szIncomingPorts && nus.szIncomingPorts[0])
nlb.wPort = 0;
diff --git a/plugins/NewsAggregator/Src/Utils.cpp b/plugins/NewsAggregator/Src/Utils.cpp
index d2d02635dc..242218e4c1 100644
--- a/plugins/NewsAggregator/Src/Utils.cpp
+++ b/plugins/NewsAggregator/Src/Utils.cpp
@@ -20,7 +20,7 @@ Boston, MA 02111-1307, USA.
#include "stdafx.h"
HNETLIBUSER hNetlibUser = NULL;
-HANDLE hNetlibHttp;
+HNETLIBCONN hNetlibHttp;
bool UpdateListFlag = FALSE;
bool IsMyContact(MCONTACT hContact)
diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp
index e643b2423a..8bdaa385a2 100644
--- a/plugins/Ping/src/utils.cpp
+++ b/plugins/Ping/src/utils.cpp
@@ -93,7 +93,7 @@ INT_PTR PluginPing(WPARAM, LPARAM lParam)
conn.wPort = pa->port;
conn.timeout = options.ping_timeout;
- HANDLE s = Netlib_OpenConnection(hNetlibUser, &conn);
+ HNETLIBCONN s = Netlib_OpenConnection(hNetlibUser, &conn);
mir_free((void*)conn.szHost);
clock_t end_tcp = clock();
diff --git a/plugins/PluginUpdater/src/DlgListNew.cpp b/plugins/PluginUpdater/src/DlgListNew.cpp
index 9706ea2af1..5ac1a40eb1 100644
--- a/plugins/PluginUpdater/src/DlgListNew.cpp
+++ b/plugins/PluginUpdater/src/DlgListNew.cpp
@@ -63,7 +63,7 @@ static void ApplyDownloads(void *param)
VARSW tszMirandaPath(L"%miranda_path%");
- HANDLE nlc = NULL;
+ HNETLIBCONN nlc = NULL;
for (int i=0; i < todo.getCount(); ++i) {
ListView_EnsureVisible(hwndList, i, FALSE);
if (todo[i].bEnabled) {
diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp
index 3cc172fca8..60e91a4057 100644
--- a/plugins/PluginUpdater/src/DlgUpdate.cpp
+++ b/plugins/PluginUpdater/src/DlgUpdate.cpp
@@ -67,7 +67,7 @@ static void ApplyUpdates(void *param)
SafeCreateDirectory(tszFileTemp);
// 2) Download all plugins
- HANDLE nlc = NULL;
+ HNETLIBCONN nlc = NULL;
for (int i=0; i < todo.getCount(); i++) {
ListView_EnsureVisible(hwndList, i, FALSE);
if (!todo[i].bEnabled) {
@@ -419,7 +419,7 @@ static void DlgUpdateSilent(void *param)
SafeCreateDirectory(tszFileTemp);
// 2) Download all plugins
- HANDLE nlc = NULL;
+ HNETLIBCONN nlc = NULL;
// Count all updates that have been enabled
int count = 0;
for (int i = 0; i < UpdateFiles.getCount(); i++) {
diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp
index 186cf9dc34..73d8036345 100644
--- a/plugins/PluginUpdater/src/Utils.cpp
+++ b/plugins/PluginUpdater/src/Utils.cpp
@@ -156,7 +156,7 @@ bool ParseHashes(const wchar_t *ptszUrl, ptrW &baseUrl, SERVLIST &arHashes)
mir_snwprintf(pFileUrl.tszDiskPath, L"%s\\hashes.zip", g_tszTempPath);
pFileUrl.CRCsum = 0;
- HANDLE nlc;
+ HNETLIBCONN nlc;
bool ret = DownloadFile(&pFileUrl, nlc);
Netlib_CloseHandle(nlc);
@@ -229,7 +229,7 @@ bool ParseHashes(const wchar_t *ptszUrl, ptrW &baseUrl, SERVLIST &arHashes)
}
-bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc)
+bool DownloadFile(FILEURL *pFileURL, HNETLIBCONN &nlc)
{
NETLIBHTTPREQUEST nlhr = {0};
#if MIRANDA_VER < 0x0A00
diff --git a/plugins/PluginUpdater/src/stdafx.h b/plugins/PluginUpdater/src/stdafx.h
index 182ba3d22f..dae531b4ca 100644
--- a/plugins/PluginUpdater/src/stdafx.h
+++ b/plugins/PluginUpdater/src/stdafx.h
@@ -230,7 +230,7 @@ bool ParseHashes(const wchar_t *ptszUrl, ptrW &baseUrl, SERVLIST &arHashes);
int CompareHashes(const ServListEntry *p1, const ServListEntry *p2);
wchar_t* GetDefaultUrl();
-bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc);
+bool DownloadFile(FILEURL *pFileURL, HNETLIBCONN &nlc);
void ShowPopup(LPCTSTR Title, LPCTSTR Text, int Number);
void __stdcall RestartMe(void*);
diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp
index 66d938a506..04df9baf8a 100644
--- a/plugins/SmileyAdd/src/download.cpp
+++ b/plugins/SmileyAdd/src/download.cpp
@@ -39,7 +39,7 @@ static OBJLIST<QueueElem> dlQueue(10);
static wchar_t cachepath[MAX_PATH];
static bool threadRunning;
-bool InternetDownloadFile(const char *szUrl, char *szDest, HANDLE &hHttpDwnl)
+bool InternetDownloadFile(const char *szUrl, char *szDest, HNETLIBCONN &hHttpDwnl)
{
int result = 0xBADBAD;
char *szRedirUrl = NULL;
@@ -127,7 +127,7 @@ void __cdecl SmileyDownloadThread(void*)
Thread_SetName("SmileyAdd: SmileyDownloadThread");
bool needext = false;
- HANDLE hHttpDwnl = NULL;
+ HNETLIBCONN hHttpDwnl = NULL;
WaitForSingleObject(g_hDlMutex, 3000);
while (!Miranda_IsTerminated() && dlQueue.getCount()) {
ReleaseMutex(g_hDlMutex);
diff --git a/plugins/Watrack_MPD/src/main.cpp b/plugins/Watrack_MPD/src/main.cpp
index a923777982..5bedeb0101 100755
--- a/plugins/Watrack_MPD/src/main.cpp
+++ b/plugins/Watrack_MPD/src/main.cpp
@@ -16,7 +16,7 @@
#include "stdafx.h"
-HANDLE ghConnection;
+HNETLIBCONN ghConnection;
HANDLE ghPacketReciever;
BOOL Connected;
int gbState;
@@ -262,8 +262,6 @@ void Stop()
Netlib_CloseHandle(ghPacketReciever);
if(ghConnection)
Netlib_CloseHandle(ghConnection);
- if(ghNetlibUser && (ghNetlibUser != INVALID_HANDLE_VALUE))
- Netlib_Shutdown(ghNetlibUser);
}
int Init()
diff --git a/plugins/Weather/src/stdafx.h b/plugins/Weather/src/stdafx.h
index 677cca67d1..6c4a8082bb 100644
--- a/plugins/Weather/src/stdafx.h
+++ b/plugins/Weather/src/stdafx.h
@@ -358,7 +358,8 @@ extern unsigned status, old_status;
extern MWindowList hDataWindowList, hWindowList;
extern HNETLIBUSER hNetlibUser;
-extern HANDLE hNetlibHttp, hHookWeatherUpdated, hHookWeatherError, hTBButton, hUpdateMutex;
+extern HNETLIBCONN hNetlibHttp;
+extern HANDLE hHookWeatherUpdated, hHookWeatherError, hTBButton, hUpdateMutex;
extern UINT_PTR timerId;
extern HGENMENU hMwinMenu;
diff --git a/plugins/Weather/src/weather_http.cpp b/plugins/Weather/src/weather_http.cpp
index cdc9656082..e1dde203ea 100644
--- a/plugins/Weather/src/weather_http.cpp
+++ b/plugins/Weather/src/weather_http.cpp
@@ -26,7 +26,7 @@ from the web using netlib
#include "stdafx.h"
HNETLIBUSER hNetlibUser;
-HANDLE hNetlibHttp;
+HNETLIBCONN hNetlibHttp;
static int findHeader(const NETLIBHTTPREQUEST *nlhrReply, const char *hdr)
{
diff --git a/plugins/YAMN/src/proto/netlib.cpp b/plugins/YAMN/src/proto/netlib.cpp
index 64da34ed8d..b737dc89e2 100644
--- a/plugins/YAMN/src/proto/netlib.cpp
+++ b/plugins/YAMN/src/proto/netlib.cpp
@@ -116,7 +116,7 @@ void CNLClient::Connect(const char* servername, const int port) throw(DWORD)
//Performs a simple query
// query- command to send
-int CNLClient::LocalNetlib_Send(HANDLE hConn, const char *buf, int len, int flags)
+int CNLClient::LocalNetlib_Send(HNETLIBCONN hConn, const char *buf, int len, int flags)
{
return Netlib_Send(hConn, buf, len, flags);
}
@@ -156,7 +156,7 @@ void CNLClient::Send(const char *query) throw(DWORD)
//You need free() returned buffer, which can be allocated in this function
//if not success, exception is throwed
-int CNLClient::LocalNetlib_Recv(HANDLE hConn, char *buf, int len, int flags)
+int CNLClient::LocalNetlib_Recv(HNETLIBCONN hConn, char *buf, int len, int flags)
{
int iReturn = Netlib_Recv(hConn, buf, len, flags);
if (isTLSed) {
diff --git a/plugins/YAMN/src/proto/netlib.h b/plugins/YAMN/src/proto/netlib.h
index 17259cf219..de41a6ad04 100644
--- a/plugins/YAMN/src/proto/netlib.h
+++ b/plugins/YAMN/src/proto/netlib.h
@@ -14,10 +14,10 @@ public:
inline BOOL Connected() {return hConnection!=NULL;}
protected:
- HANDLE hConnection;
+ HNETLIBCONN hConnection;
BOOL isTLSed;
- int LocalNetlib_Send(HANDLE hConn,const char *buf,int len,int flags);
- int LocalNetlib_Recv(HANDLE hConn,char *buf,int len,int flags);
+ int LocalNetlib_Send(HNETLIBCONN hConn, const char *buf, int len, int flags);
+ int LocalNetlib_Recv(HNETLIBCONN hConn, char *buf, int len, int flags);
};
void SSL_DebugLog(const char *fmt, ...);
diff --git a/protocols/AimOscar/src/away.cpp b/protocols/AimOscar/src/away.cpp
index 057e55a1b3..12c15f7a2e 100644
--- a/protocols/AimOscar/src/away.cpp
+++ b/protocols/AimOscar/src/away.cpp
@@ -41,7 +41,7 @@ char** CAimProto::get_status_msg_loc(int status)
return NULL;
}
-int CAimProto::aim_set_away(HANDLE hServerConn, unsigned short &seqno, const char *amsg, bool set)//user info
+int CAimProto::aim_set_away(HNETLIBCONN hServerConn, unsigned short &seqno, const char *amsg, bool set)//user info
{
unsigned short offset = 0;
char *html_msg = NULL;
@@ -71,7 +71,7 @@ int CAimProto::aim_set_away(HANDLE hServerConn, unsigned short &seqno, const cha
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_set_status(HANDLE hServerConn, unsigned short &seqno, unsigned long status_type)
+int CAimProto::aim_set_status(HNETLIBCONN hServerConn, unsigned short &seqno, unsigned long status_type)
{
unsigned short offset = 0;
char buf[SNAC_SIZE + TLV_HEADER_SIZE * 2];
@@ -80,7 +80,7 @@ int CAimProto::aim_set_status(HANDLE hServerConn, unsigned short &seqno, unsigne
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_set_statusmsg(HANDLE hServerConn, unsigned short &seqno, const char *msg)//user info
+int CAimProto::aim_set_statusmsg(HNETLIBCONN hServerConn, unsigned short &seqno, const char *msg)//user info
{
size_t msg_size = mir_strlen(msg);
@@ -106,7 +106,7 @@ int CAimProto::aim_set_statusmsg(HANDLE hServerConn, unsigned short &seqno, cons
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_query_away_message(HANDLE hServerConn, unsigned short &seqno, const char* sn)
+int CAimProto::aim_query_away_message(HNETLIBCONN hServerConn, unsigned short &seqno, const char* sn)
{
unsigned short offset = 0;
unsigned short sn_length = (unsigned short)mir_strlen(sn);
diff --git a/protocols/AimOscar/src/chat.h b/protocols/AimOscar/src/chat.h
index 5b819544aa..c10d0265da 100644
--- a/protocols/AimOscar/src/chat.h
+++ b/protocols/AimOscar/src/chat.h
@@ -32,22 +32,26 @@ struct chatnav_param
struct chat_list_item
{
- char* id;
- char* cookie;
- HANDLE hconn;
- unsigned short cid;
+ char* id;
+ char* cookie;
+ HNETLIBCONN hconn;
+ unsigned short cid;
unsigned short seqno;
- unsigned short exchange;
- unsigned short instance;
+ unsigned short exchange;
+ unsigned short instance;
char* CHAT_COOKIE;
int CHAT_COOKIE_LENGTH;
- chat_list_item(char* tid, char* tcookie, unsigned short ex, unsigned short in)
- { id = mir_strdup(tid); cid = get_random(); seqno = 0; hconn = NULL;
- cookie = mir_strdup(tcookie); exchange = ex; instance = in; }
+ chat_list_item(char* tid, char* tcookie, unsigned short ex, unsigned short in)
+ {
+ id = mir_strdup(tid); cid = get_random(); seqno = 0; hconn = NULL;
+ cookie = mir_strdup(tcookie); exchange = ex; instance = in;
+ }
- ~chat_list_item()
- { mir_free(id); mir_free(cookie); }
+ ~chat_list_item()
+ {
+ mir_free(id); mir_free(cookie);
+ }
};
#endif \ No newline at end of file
diff --git a/protocols/AimOscar/src/client.cpp b/protocols/AimOscar/src/client.cpp
index 839698bb96..2804ed52f7 100755
--- a/protocols/AimOscar/src/client.cpp
+++ b/protocols/AimOscar/src/client.cpp
@@ -19,12 +19,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-int CAimProto::aim_send_connection_packet(HANDLE hServerConn, unsigned short &seqno, char *buf)
+int CAimProto::aim_send_connection_packet(HNETLIBCONN hServerConn, unsigned short &seqno, char *buf)
{
return aim_sendflap(hServerConn, 0x01, 4, buf, seqno);
}
-int CAimProto::aim_authkey_request(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_authkey_request(HNETLIBCONN hServerConn, unsigned short &seqno)
{
unsigned short offset = 0;
char *buf = (char*)alloca(SNAC_SIZE + TLV_HEADER_SIZE * 3 + mir_strlen(m_username));
@@ -35,7 +35,7 @@ int CAimProto::aim_authkey_request(HANDLE hServerConn, unsigned short &seqno)
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_auth_request(HANDLE hServerConn, unsigned short &seqno, const char* key, const char* language,
+int CAimProto::aim_auth_request(HNETLIBCONN hServerConn, unsigned short &seqno, const char* key, const char* language,
const char* country, const char* username, const char* password)
{
unsigned short offset = 0;
@@ -79,7 +79,7 @@ int CAimProto::aim_auth_request(HANDLE hServerConn, unsigned short &seqno, const
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_send_cookie(HANDLE hServerConn, unsigned short &seqno, int cookie_size, char * cookie)
+int CAimProto::aim_send_cookie(HNETLIBCONN hServerConn, unsigned short &seqno, int cookie_size, char * cookie)
{
unsigned short offset = 0;
char* buf = (char*)alloca(TLV_HEADER_SIZE * 2 + cookie_size);
@@ -88,7 +88,7 @@ int CAimProto::aim_send_cookie(HANDLE hServerConn, unsigned short &seqno, int co
return aim_sendflap(hServerConn, 0x01, offset, buf, seqno);
}
-int CAimProto::aim_send_service_request(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_send_service_request(HNETLIBCONN hServerConn, unsigned short &seqno)
{
unsigned short offset = 0;
char buf[SNAC_SIZE + TLV_HEADER_SIZE * 12];
@@ -108,7 +108,7 @@ int CAimProto::aim_send_service_request(HANDLE hServerConn, unsigned short &seqn
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_new_service_request(HANDLE hServerConn, unsigned short &seqno, unsigned short service)
+int CAimProto::aim_new_service_request(HNETLIBCONN hServerConn, unsigned short &seqno, unsigned short service)
{
unsigned short offset = 0;
char buf[SNAC_SIZE + 2 + TLV_HEADER_SIZE];
@@ -119,7 +119,7 @@ int CAimProto::aim_new_service_request(HANDLE hServerConn, unsigned short &seqno
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_request_rates(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_request_rates(HNETLIBCONN hServerConn, unsigned short &seqno)
{
unsigned short offset = 0;
char buf[SNAC_SIZE];
@@ -127,7 +127,7 @@ int CAimProto::aim_request_rates(HANDLE hServerConn, unsigned short &seqno)
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_accept_rates(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_accept_rates(HNETLIBCONN hServerConn, unsigned short &seqno)
{
unsigned short offset = 0;
char buf[SNAC_SIZE * 2];
@@ -136,7 +136,7 @@ int CAimProto::aim_accept_rates(HANDLE hServerConn, unsigned short &seqno)
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_request_icbm(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_request_icbm(HNETLIBCONN hServerConn, unsigned short &seqno)
{
unsigned short offset = 0;
char buf[SNAC_SIZE];
@@ -144,7 +144,7 @@ int CAimProto::aim_request_icbm(HANDLE hServerConn, unsigned short &seqno)
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_set_icbm(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_set_icbm(HNETLIBCONN hServerConn, unsigned short &seqno)
{
const unsigned icbm_flags = ICBM_CHANNEL_MSGS_ALLOWED | ICBM_MISSED_CALLS_ENABLED |
ICBM_EVENTS_ALLOWED | ICBM_SMS_SUPPORTED | ICBM_OFFLINE_MSGS_ALLOWED;
@@ -162,7 +162,7 @@ int CAimProto::aim_set_icbm(HANDLE hServerConn, unsigned short &seqno)
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_request_offline_msgs(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_request_offline_msgs(HNETLIBCONN hServerConn, unsigned short &seqno)
{
unsigned short offset = 0;
char buf[SNAC_SIZE];
@@ -170,7 +170,7 @@ int CAimProto::aim_request_offline_msgs(HANDLE hServerConn, unsigned short &seqn
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_request_list(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_request_list(HNETLIBCONN hServerConn, unsigned short &seqno)
{
unsigned short offset = 0;
char buf[SNAC_SIZE];
@@ -178,7 +178,7 @@ int CAimProto::aim_request_list(HANDLE hServerConn, unsigned short &seqno)
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_activate_list(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_activate_list(HNETLIBCONN hServerConn, unsigned short &seqno)
{
unsigned short offset = 0;
char buf[SNAC_SIZE];
@@ -191,7 +191,7 @@ int CAimProto::aim_activate_list(HANDLE hServerConn, unsigned short &seqno)
0010 01 00 00 08 00 01 01 00 0a 00 14 00 02 00 08 66 ...............f
0020 61 63 65 62 6f 6f 6b 00 06 67 6f 6f 67 6c 65 acebook..google
-int CAimProto::aim_request_rights(HANDLE hServerConn,unsigned short &seqno)
+int CAimProto::aim_request_rights(HNETLIBCONN hServerConn,unsigned short &seqno)
{
unsigned short offset=0;
char buf[SNAC_SIZE+50];
@@ -204,7 +204,7 @@ int CAimProto::aim_request_rights(HANDLE hServerConn,unsigned short &seqno)
return aim_sendflap(hServerConn,0x02,offset,buf,seqno);
}
*/
-int CAimProto::aim_set_caps(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_set_caps(HNETLIBCONN hServerConn, unsigned short &seqno)
{
unsigned short offset = 0;
int i = 1;
@@ -232,7 +232,7 @@ int CAimProto::aim_set_caps(HANDLE hServerConn, unsigned short &seqno)
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_set_profile(HANDLE hServerConn, unsigned short &seqno, char* amsg)//user info
+int CAimProto::aim_set_profile(HNETLIBCONN hServerConn, unsigned short &seqno, char* amsg)//user info
{
aimString str(amsg);
const char *charset = str.isUnicode() ? AIM_MSG_TYPE_UNICODE : AIM_MSG_TYPE;
@@ -251,7 +251,7 @@ int CAimProto::aim_set_profile(HANDLE hServerConn, unsigned short &seqno, char*
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_client_ready(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_client_ready(HNETLIBCONN hServerConn, unsigned short &seqno)
{
unsigned short offset = 0;
@@ -288,7 +288,7 @@ int CAimProto::aim_client_ready(HANDLE hServerConn, unsigned short &seqno)
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_mail_ready(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_mail_ready(HNETLIBCONN hServerConn, unsigned short &seqno)
{
unsigned short offset = 0;
char buf[SNAC_SIZE + TLV_HEADER_SIZE * 4];
@@ -300,7 +300,7 @@ int CAimProto::aim_mail_ready(HANDLE hServerConn, unsigned short &seqno)
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_avatar_ready(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_avatar_ready(HNETLIBCONN hServerConn, unsigned short &seqno)
{
unsigned short offset = 0;
char buf[SNAC_SIZE + TLV_HEADER_SIZE * 4];
@@ -312,7 +312,7 @@ int CAimProto::aim_avatar_ready(HANDLE hServerConn, unsigned short &seqno)
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_chatnav_ready(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_chatnav_ready(HNETLIBCONN hServerConn, unsigned short &seqno)
{
unsigned short offset = 0;
char buf[SNAC_SIZE + TLV_HEADER_SIZE * 4];
@@ -324,7 +324,7 @@ int CAimProto::aim_chatnav_ready(HANDLE hServerConn, unsigned short &seqno)
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_chat_ready(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_chat_ready(HNETLIBCONN hServerConn, unsigned short &seqno)
{
unsigned short offset = 0;
char buf[SNAC_SIZE + TLV_HEADER_SIZE * 4];
@@ -336,7 +336,7 @@ int CAimProto::aim_chat_ready(HANDLE hServerConn, unsigned short &seqno)
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_send_message(HANDLE hServerConn, unsigned short &seqno, const char* sn, char* amsg, bool auto_response, bool blast)
+int CAimProto::aim_send_message(HNETLIBCONN hServerConn, unsigned short &seqno, const char* sn, char* amsg, bool auto_response, bool blast)
{
aimString str(amsg);
@@ -380,7 +380,7 @@ int CAimProto::aim_send_message(HANDLE hServerConn, unsigned short &seqno, const
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno) ? 0 : *(int*)icbm_cookie & 0x7fffffff;
}
-int CAimProto::aim_query_profile(HANDLE hServerConn, unsigned short &seqno, char* sn)
+int CAimProto::aim_query_profile(HNETLIBCONN hServerConn, unsigned short &seqno, char* sn)
{
unsigned short offset = 0;
unsigned short sn_length = (unsigned short)mir_strlen(sn);
@@ -392,7 +392,7 @@ int CAimProto::aim_query_profile(HANDLE hServerConn, unsigned short &seqno, char
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno) == 0;
}
-int CAimProto::aim_delete_contact(HANDLE hServerConn, unsigned short &seqno, char* sn, unsigned short item_id,
+int CAimProto::aim_delete_contact(HNETLIBCONN hServerConn, unsigned short &seqno, char* sn, unsigned short item_id,
unsigned short group_id, unsigned short list, bool nil)
{
unsigned short offset = 0;
@@ -409,7 +409,7 @@ int CAimProto::aim_delete_contact(HANDLE hServerConn, unsigned short &seqno, cha
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_add_contact(HANDLE hServerConn, unsigned short &seqno, const char* sn, unsigned short item_id,
+int CAimProto::aim_add_contact(HNETLIBCONN hServerConn, unsigned short &seqno, const char* sn, unsigned short item_id,
unsigned short group_id, unsigned short list, char* nick, char* note)
{
unsigned short offset = 0;
@@ -434,7 +434,7 @@ int CAimProto::aim_add_contact(HANDLE hServerConn, unsigned short &seqno, const
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_mod_group(HANDLE hServerConn, unsigned short &seqno, const char* name, unsigned short group_id,
+int CAimProto::aim_mod_group(HNETLIBCONN hServerConn, unsigned short &seqno, const char* name, unsigned short group_id,
char* members, unsigned short members_length)
{
unsigned short offset = 0;
@@ -451,7 +451,7 @@ int CAimProto::aim_mod_group(HANDLE hServerConn, unsigned short &seqno, const ch
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_mod_buddy(HANDLE hServerConn, unsigned short &seqno, const char* sn,
+int CAimProto::aim_mod_buddy(HNETLIBCONN hServerConn, unsigned short &seqno, const char* sn,
unsigned short buddy_id, unsigned short group_id,
char* nick, char* note)
{
@@ -475,7 +475,7 @@ int CAimProto::aim_mod_buddy(HANDLE hServerConn, unsigned short &seqno, const ch
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_set_pd_info(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_set_pd_info(HNETLIBCONN hServerConn, unsigned short &seqno)
{
unsigned short offset = 0;
char buf[SNAC_SIZE + TLV_HEADER_SIZE * 3 + 20];
@@ -496,7 +496,7 @@ int CAimProto::aim_set_pd_info(HANDLE hServerConn, unsigned short &seqno)
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_ssi_update_preferences(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_ssi_update_preferences(HNETLIBCONN hServerConn, unsigned short &seqno)
{
unsigned short offset = 0;
char buf[SNAC_SIZE + TLV_HEADER_SIZE * 4 + 100];
@@ -525,7 +525,7 @@ int CAimProto::aim_ssi_update_preferences(HANDLE hServerConn, unsigned short &se
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_ssi_update(HANDLE hServerConn, unsigned short &seqno, bool start)
+int CAimProto::aim_ssi_update(HNETLIBCONN hServerConn, unsigned short &seqno, bool start)
{
unsigned short offset = 0;
char buf[SNAC_SIZE];
@@ -533,13 +533,13 @@ int CAimProto::aim_ssi_update(HANDLE hServerConn, unsigned short &seqno, bool st
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno) == 0;
}
-int CAimProto::aim_keepalive(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_keepalive(HNETLIBCONN hServerConn, unsigned short &seqno)
{
return aim_sendflap(hServerConn, 0x05, 4, "\x0\x0\x0\xEE", seqno);
}
// used when requesting a regular file transfer
-int CAimProto::aim_send_file(HANDLE hServerConn, unsigned short &seqno,
+int CAimProto::aim_send_file(HNETLIBCONN hServerConn, unsigned short &seqno,
unsigned long ip, unsigned short port,
bool force_proxy, file_transfer *ft)
{
@@ -618,7 +618,7 @@ int CAimProto::aim_send_file(HANDLE hServerConn, unsigned short &seqno,
}
-int CAimProto::aim_file_ad(HANDLE hServerConn, unsigned short &seqno, char* sn, char* icbm_cookie, bool deny, unsigned short)
+int CAimProto::aim_file_ad(HNETLIBCONN hServerConn, unsigned short &seqno, char* sn, char* icbm_cookie, bool deny, unsigned short)
{
unsigned short frag_offset = 0;
char msg_frag[10 + AIM_CAPS_LENGTH + TLV_HEADER_SIZE * 2 + 6];
@@ -644,7 +644,7 @@ int CAimProto::aim_file_ad(HANDLE hServerConn, unsigned short &seqno, char* sn,
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno) == 0;
}
-int CAimProto::aim_typing_notification(HANDLE hServerConn, unsigned short &seqno, char* sn, unsigned short type)
+int CAimProto::aim_typing_notification(HNETLIBCONN hServerConn, unsigned short &seqno, char* sn, unsigned short type)
{
unsigned short offset = 0;
unsigned short sn_length = (unsigned short)mir_strlen(sn);
@@ -658,7 +658,7 @@ int CAimProto::aim_typing_notification(HANDLE hServerConn, unsigned short &seqno
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_set_idle(HANDLE hServerConn, unsigned short &seqno, unsigned long seconds)
+int CAimProto::aim_set_idle(HNETLIBCONN hServerConn, unsigned short &seqno, unsigned long seconds)
{
unsigned short offset = 0;
char buf[SNAC_SIZE + 4];
@@ -667,7 +667,7 @@ int CAimProto::aim_set_idle(HANDLE hServerConn, unsigned short &seqno, unsigned
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_request_mail(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_request_mail(HNETLIBCONN hServerConn, unsigned short &seqno)
{
unsigned short offset = 0;
char buf[SNAC_SIZE + 34];
@@ -680,7 +680,7 @@ int CAimProto::aim_request_mail(HANDLE hServerConn, unsigned short &seqno)
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_activate_mail(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_activate_mail(HNETLIBCONN hServerConn, unsigned short &seqno)
{
unsigned short offset = 0;
char buf[SNAC_SIZE + 17];
@@ -689,7 +689,7 @@ int CAimProto::aim_activate_mail(HANDLE hServerConn, unsigned short &seqno)
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_request_avatar(HANDLE hServerConn, unsigned short &seqno, const char* sn, unsigned short bart_type, const char* hash, unsigned short hash_size)
+int CAimProto::aim_request_avatar(HNETLIBCONN hServerConn, unsigned short &seqno, const char* sn, unsigned short bart_type, const char* hash, unsigned short hash_size)
{
unsigned short offset = 0;
unsigned char sn_length = (unsigned char)mir_strlen(sn);
@@ -702,7 +702,7 @@ int CAimProto::aim_request_avatar(HANDLE hServerConn, unsigned short &seqno, con
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_set_avatar_hash(HANDLE hServerConn, unsigned short &seqno, char flags, unsigned short bart_type, unsigned short &id, char size, const char* hash)
+int CAimProto::aim_set_avatar_hash(HNETLIBCONN hServerConn, unsigned short &seqno, char flags, unsigned short bart_type, unsigned short &id, char size, const char* hash)
{
unsigned short offset = 0;
@@ -734,7 +734,7 @@ int CAimProto::aim_set_avatar_hash(HANDLE hServerConn, unsigned short &seqno, ch
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_delete_avatar_hash(HANDLE hServerConn, unsigned short &seqno, char /*flags*/, unsigned short bart_type, unsigned short & id)
+int CAimProto::aim_delete_avatar_hash(HNETLIBCONN hServerConn, unsigned short &seqno, char /*flags*/, unsigned short bart_type, unsigned short & id)
{
unsigned short offset = 0;
@@ -757,7 +757,7 @@ int CAimProto::aim_delete_avatar_hash(HANDLE hServerConn, unsigned short &seqno,
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_upload_avatar(HANDLE hServerConn, unsigned short &seqno, unsigned short bart_type, const char* avatar, unsigned short avatar_size)
+int CAimProto::aim_upload_avatar(HNETLIBCONN hServerConn, unsigned short &seqno, unsigned short bart_type, const char* avatar, unsigned short avatar_size)
{
unsigned short offset = 0;
char* buf = (char*)alloca(SNAC_SIZE + 22 + avatar_size);
@@ -768,7 +768,7 @@ int CAimProto::aim_upload_avatar(HANDLE hServerConn, unsigned short &seqno, unsi
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_search_by_email(HANDLE hServerConn, unsigned short &seqno, const char* email)
+int CAimProto::aim_search_by_email(HNETLIBCONN hServerConn, unsigned short &seqno, const char* email)
{
unsigned short offset = 0;
char em_length = (char)mir_strlen(email);
@@ -778,7 +778,7 @@ int CAimProto::aim_search_by_email(HANDLE hServerConn, unsigned short &seqno, co
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_chatnav_request_limits(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_chatnav_request_limits(HNETLIBCONN hServerConn, unsigned short &seqno)
{
unsigned short offset = 0;
char buf[SNAC_SIZE];
@@ -786,7 +786,7 @@ int CAimProto::aim_chatnav_request_limits(HANDLE hServerConn, unsigned short &se
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno) ? -1 : 0;
}
-int CAimProto::aim_chatnav_create(HANDLE hServerConn, unsigned short &seqno, char* room, unsigned short exchage)
+int CAimProto::aim_chatnav_create(HNETLIBCONN hServerConn, unsigned short &seqno, char* room, unsigned short exchage)
{
//* Join Pseudo Room (Get's the info we need for the real connection)
unsigned short room_len = (unsigned short)mir_strlen(room);
@@ -807,7 +807,7 @@ int CAimProto::aim_chatnav_create(HANDLE hServerConn, unsigned short &seqno, cha
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_chatnav_room_info(HANDLE hServerConn, unsigned short &seqno, char* chat_cookie, unsigned short exchange, unsigned short instance)
+int CAimProto::aim_chatnav_room_info(HNETLIBCONN hServerConn, unsigned short &seqno, char* chat_cookie, unsigned short exchange, unsigned short instance)
{
unsigned short offset = 0;
unsigned short chat_cookie_len = (unsigned short)mir_strlen(chat_cookie);
@@ -821,7 +821,7 @@ int CAimProto::aim_chatnav_room_info(HANDLE hServerConn, unsigned short &seqno,
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_chat_join_room(HANDLE hServerConn, unsigned short &seqno, char* chat_cookie,
+int CAimProto::aim_chat_join_room(HNETLIBCONN hServerConn, unsigned short &seqno, char* chat_cookie,
unsigned short exchange, unsigned short instance, unsigned short id)
{
unsigned short offset = 0;
@@ -843,7 +843,7 @@ int CAimProto::aim_chat_join_room(HANDLE hServerConn, unsigned short &seqno, cha
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_chat_send_message(HANDLE hServerConn, unsigned short &seqno, char *amsg)
+int CAimProto::aim_chat_send_message(HNETLIBCONN hServerConn, unsigned short &seqno, char *amsg)
{
aimString str(amsg);
@@ -872,7 +872,7 @@ int CAimProto::aim_chat_send_message(HANDLE hServerConn, unsigned short &seqno,
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_chat_invite(HANDLE hServerConn, unsigned short &seqno, char* chat_cookie, unsigned short exchange, unsigned short instance, char* sn, char* msg)
+int CAimProto::aim_chat_invite(HNETLIBCONN hServerConn, unsigned short &seqno, char* chat_cookie, unsigned short exchange, unsigned short instance, char* sn, char* msg)
{
unsigned short offset = 0;
unsigned short chat_cookie_len = (unsigned short)mir_strlen(chat_cookie);
@@ -906,7 +906,7 @@ int CAimProto::aim_chat_invite(HANDLE hServerConn, unsigned short &seqno, char*
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_chat_deny(HANDLE hServerConn, unsigned short &seqno, char* sn, char* icbm_cookie)
+int CAimProto::aim_chat_deny(HNETLIBCONN hServerConn, unsigned short &seqno, char* sn, char* icbm_cookie)
{
unsigned short offset = 0;
unsigned short sn_length = (unsigned short)mir_strlen(sn);
@@ -922,7 +922,7 @@ int CAimProto::aim_chat_deny(HANDLE hServerConn, unsigned short &seqno, char* sn
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno) == 0;
}
-int CAimProto::aim_admin_ready(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_admin_ready(HNETLIBCONN hServerConn, unsigned short &seqno)
{
unsigned short offset = 0;
char buf[SNAC_SIZE + TLV_HEADER_SIZE * 4];
@@ -934,7 +934,7 @@ int CAimProto::aim_admin_ready(HANDLE hServerConn, unsigned short &seqno)
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_admin_format_name(HANDLE hServerConn, unsigned short &seqno, const char* sn)
+int CAimProto::aim_admin_format_name(HNETLIBCONN hServerConn, unsigned short &seqno, const char* sn)
{
unsigned short offset = 0;
unsigned short sn_len = (unsigned short)mir_strlen(sn);
@@ -944,7 +944,7 @@ int CAimProto::aim_admin_format_name(HANDLE hServerConn, unsigned short &seqno,
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_admin_change_email(HANDLE hServerConn, unsigned short &seqno, const char* email)
+int CAimProto::aim_admin_change_email(HNETLIBCONN hServerConn, unsigned short &seqno, const char* email)
{
unsigned short offset = 0;
unsigned short email_len = (unsigned short)mir_strlen(email);
@@ -954,7 +954,7 @@ int CAimProto::aim_admin_change_email(HANDLE hServerConn, unsigned short &seqno,
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_admin_change_password(HANDLE hServerConn, unsigned short &seqno, const char* cur_pw, const char* new_pw)
+int CAimProto::aim_admin_change_password(HNETLIBCONN hServerConn, unsigned short &seqno, const char* cur_pw, const char* new_pw)
{
unsigned short offset = 0;
unsigned short cur_pw_len = (unsigned short)mir_strlen(cur_pw);
@@ -966,7 +966,7 @@ int CAimProto::aim_admin_change_password(HANDLE hServerConn, unsigned short &seq
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_admin_request_info(HANDLE hServerConn, unsigned short &seqno, const unsigned short &type)
+int CAimProto::aim_admin_request_info(HNETLIBCONN hServerConn, unsigned short &seqno, const unsigned short &type)
{
// types: 0x01 - nickname, 0x11 - email info, 0x13 - registration status
unsigned short offset = 0;
@@ -976,7 +976,7 @@ int CAimProto::aim_admin_request_info(HANDLE hServerConn, unsigned short &seqno,
return aim_sendflap(hServerConn, 0x02, offset, buf, seqno);
}
-int CAimProto::aim_admin_account_confirm(HANDLE hServerConn, unsigned short &seqno)
+int CAimProto::aim_admin_account_confirm(HNETLIBCONN hServerConn, unsigned short &seqno)
{
unsigned short offset = 0;
char buf[SNAC_SIZE + TLV_HEADER_SIZE];
diff --git a/protocols/AimOscar/src/connection.cpp b/protocols/AimOscar/src/connection.cpp
index 03b51e2577..3ac25b5256 100755
--- a/protocols/AimOscar/src/connection.cpp
+++ b/protocols/AimOscar/src/connection.cpp
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-HANDLE CAimProto::aim_connect(const char* server, unsigned short port, bool use_ssl, const char* host)
+HNETLIBCONN CAimProto::aim_connect(const char* server, unsigned short port, bool use_ssl, const char* host)
{
NETLIBOPENCONNECTION ncon = { 0 };
ncon.cbSize = sizeof(ncon);
@@ -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 = Netlib_OpenConnection(m_hNetlibUser, &ncon);
+ HNETLIBCONN con = Netlib_OpenConnection(m_hNetlibUser, &ncon);
if (con && use_ssl) {
if (!Netlib_StartSsl(con, host)) {
Netlib_CloseHandle(con);
@@ -38,7 +38,7 @@ HANDLE CAimProto::aim_connect(const char* server, unsigned short port, bool use_
return con;
}
-HANDLE CAimProto::aim_peer_connect(const char* ip, unsigned short port)
+HNETLIBCONN CAimProto::aim_peer_connect(const char* ip, unsigned short port)
{
NETLIBOPENCONNECTION ncon = { 0 };
ncon.cbSize = sizeof(ncon);
@@ -49,7 +49,7 @@ HANDLE CAimProto::aim_peer_connect(const char* ip, unsigned short port)
return Netlib_OpenConnection(m_hNetlibPeer, &ncon);
}
-HANDLE CAimProto::aim_peer_connect(unsigned long ip, unsigned short port)
+HNETLIBCONN CAimProto::aim_peer_connect(unsigned long ip, unsigned short port)
{
char ips[20];
long_ip_to_char_ip(ip, ips);
diff --git a/protocols/AimOscar/src/direct_connect.cpp b/protocols/AimOscar/src/direct_connect.cpp
index 6f9eecf76b..b9cfab0508 100644
--- a/protocols/AimOscar/src/direct_connect.cpp
+++ b/protocols/AimOscar/src/direct_connect.cpp
@@ -45,7 +45,7 @@ void __cdecl CAimProto::aim_dc_helper(void* param) //only called when we are ini
else {
if (!ft->requester && result == 1 && !Miranda_IsTerminated()) {
ft->accepted = false;
- HANDLE hConn = aim_peer_connect(AIM_PROXY_SERVER, get_default_port());
+ HNETLIBCONN hConn = aim_peer_connect(AIM_PROXY_SERVER, get_default_port());
if (hConn) {
debugLogA("Connected to proxy ip because we want to use a proxy for the file transfer.");
ft->requester = true;
@@ -61,7 +61,7 @@ void __cdecl CAimProto::aim_dc_helper(void* param) //only called when we are ini
m_ft_list.remove_by_ft(ft);
}
-void aim_direct_connection_initiated(HANDLE hNewConnection, DWORD, void* extra)//for receiving stuff via dc
+void aim_direct_connection_initiated(HNETLIBCONN hNewConnection, DWORD, void* extra)//for receiving stuff via dc
{
CAimProto *ppro = (CAimProto*)extra;
diff --git a/protocols/AimOscar/src/direct_connect.h b/protocols/AimOscar/src/direct_connect.h
index 4b164f9181..4bdcab6a4d 100644
--- a/protocols/AimOscar/src/direct_connect.h
+++ b/protocols/AimOscar/src/direct_connect.h
@@ -19,6 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef DIRECT_CONNECT_H
#define DIRECT_CONNECT_H
-void aim_direct_connection_initiated(HANDLE hNewConnection, DWORD dwRemoteIP, void* extra);
+void aim_direct_connection_initiated(HNETLIBCONN hNewConnection, DWORD dwRemoteIP, void* extra);
#endif
diff --git a/protocols/AimOscar/src/file.cpp b/protocols/AimOscar/src/file.cpp
index 42c2ae2b8d..0a67bea54b 100644
--- a/protocols/AimOscar/src/file.cpp
+++ b/protocols/AimOscar/src/file.cpp
@@ -530,7 +530,6 @@ void file_transfer::listen(CAimProto* ppro)
if (hDirectBoundPort) return;
NETLIBBIND nlb = {};
- nlb.cbSize = sizeof(nlb);
nlb.pfnNewConnectionV2 = aim_direct_connection_initiated;
nlb.pExtra = ppro;
hDirectBoundPort = Netlib_BindPort(ppro->m_hNetlibPeer, &nlb);
diff --git a/protocols/AimOscar/src/file.h b/protocols/AimOscar/src/file.h
index 4577f2bb0e..faf6714284 100644
--- a/protocols/AimOscar/src/file.h
+++ b/protocols/AimOscar/src/file.h
@@ -28,9 +28,9 @@ struct file_transfer
char icbm_cookie[8];
- HANDLE hConn;
+ HNETLIBCONN hConn;
HANDLE hResumeEvent;
- HANDLE hDirectBoundPort;
+ HNETLIBBIND hDirectBoundPort;
char* file;
char* message;
diff --git a/protocols/AimOscar/src/packets.cpp b/protocols/AimOscar/src/packets.cpp
index 4c5964d293..dc77c6a41e 100644
--- a/protocols/AimOscar/src/packets.cpp
+++ b/protocols/AimOscar/src/packets.cpp
@@ -63,7 +63,7 @@ int aim_writetlvlong64(unsigned short type, unsigned __int64 value, unsigned sho
}
-int CAimProto::aim_sendflap(HANDLE hServerConn, char type,unsigned short length,const char *buf, unsigned short &seqno)
+int CAimProto::aim_sendflap(HNETLIBCONN hServerConn, char type, unsigned short length, const char *buf, unsigned short &seqno)
{
mir_cslock lck(SendingMutex);
const int slen = FLAP_SIZE + length;
diff --git a/protocols/AimOscar/src/proto.h b/protocols/AimOscar/src/proto.h
index f2a31d60d6..da05270f3d 100755
--- a/protocols/AimOscar/src/proto.h
+++ b/protocols/AimOscar/src/proto.h
@@ -122,7 +122,7 @@ struct CAimProto : public PROTO<CAimProto>
bool m_list_received;
//Some main connection stuff
- HANDLE m_hServerConn; // handle to the main connection
+ HNETLIBCONN m_hServerConn; // handle to the main connection
unsigned long m_internal_ip; // our ip
unsigned long m_detected_ip; // our ip
@@ -139,21 +139,21 @@ struct CAimProto : public PROTO<CAimProto>
HGENMENU m_hMainMenu[3];
//Some mail connection stuff
- HANDLE m_hMailConn;
+ HNETLIBCONN m_hMailConn;
unsigned short m_mail_seqno;
//avatar connection stuff
unsigned short m_avatar_seqno;
unsigned short m_avatar_id_sm;
unsigned short m_avatar_id_lg;
- HANDLE m_hAvatarConn;
+ HNETLIBCONN m_hAvatarConn;
HANDLE m_hAvatarEvent;
ft_list_type m_ft_list;
//chatnav connection stuff
unsigned short m_chatnav_seqno;
- HANDLE m_hChatNavConn;
+ HNETLIBCONN m_hChatNavConn;
HANDLE m_hChatNavEvent;
char MAX_ROOMS;
@@ -161,7 +161,7 @@ struct CAimProto : public PROTO<CAimProto>
//admin connection stuff
unsigned short m_admin_seqno;
- HANDLE m_hAdminConn;
+ HNETLIBCONN m_hAdminConn;
HANDLE m_hAdminEvent;
// privacy settings
@@ -203,10 +203,10 @@ struct CAimProto : public PROTO<CAimProto>
void __cdecl get_online_msg_thread( void* arg );
- int aim_set_away(HANDLE hServerConn, unsigned short &seqno, const char *msg, bool set);//user info
- int aim_set_statusmsg(HANDLE hServerConn,unsigned short &seqno,const char *msg);//user info
- int aim_set_status(HANDLE hServerConn,unsigned short &seqno,unsigned long status_type);
- int aim_query_away_message(HANDLE hServerConn,unsigned short &seqno,const char* sn);
+ int aim_set_away(HNETLIBCONN hServerConn, unsigned short &seqno, const char *msg, bool set);//user info
+ int aim_set_statusmsg(HNETLIBCONN hServerConn,unsigned short &seqno,const char *msg);//user info
+ int aim_set_status(HNETLIBCONN hServerConn,unsigned short &seqno,unsigned long status_type);
+ int aim_query_away_message(HNETLIBCONN hServerConn,unsigned short &seqno,const char* sn);
char** get_status_msg_loc(int status);
@@ -230,79 +230,78 @@ struct CAimProto : public PROTO<CAimProto>
//////////////////////////////////////////////////////////////////////////////////////
// client.cpp
- int aim_send_connection_packet(HANDLE hServerConn,unsigned short &seqno,char *buf);
- int aim_authkey_request(HANDLE hServerConn,unsigned short &seqno);
- int aim_auth_request(HANDLE hServerConn,unsigned short &seqno,const char* key,const char* language,
- const char* country, const char* username, const char* password);
- int aim_send_cookie(HANDLE hServerConn,unsigned short &seqno,int cookie_size,char * cookie);
- int aim_send_service_request(HANDLE hServerConn,unsigned short &seqno);
- int aim_new_service_request(HANDLE hServerConn,unsigned short &seqno,unsigned short service);
- int aim_request_rates(HANDLE hServerConn,unsigned short &seqno);
- int aim_request_icbm(HANDLE hServerConn,unsigned short &seqno);
- int aim_request_offline_msgs(HANDLE hServerConn,unsigned short &seqno);
- int aim_set_icbm(HANDLE hServerConn,unsigned short &seqno);
- int aim_set_profile(HANDLE hServerConn,unsigned short &seqno,char* amsg);//user info
- int aim_request_list(HANDLE hServerConn,unsigned short &seqno);
- int aim_activate_list(HANDLE hServerConn,unsigned short &seqno);
- int aim_accept_rates(HANDLE hServerConn,unsigned short &seqno);
- int aim_set_caps(HANDLE hServerConn,unsigned short &seqno);
- int aim_client_ready(HANDLE hServerConn,unsigned short &seqno);
- int aim_mail_ready(HANDLE hServerConn,unsigned short &seqno);
- int aim_avatar_ready(HANDLE hServerConn,unsigned short &seqno);
- int aim_chatnav_ready(HANDLE hServerConn,unsigned short &seqno);
- int aim_chat_ready(HANDLE hServerConn,unsigned short &seqno);
- int aim_send_message(HANDLE hServerConn,unsigned short &seqno,const char* sn,char* amsg,bool auto_response, bool blast);
- int aim_query_profile(HANDLE hServerConn,unsigned short &seqno,char* sn);
- int aim_delete_contact(HANDLE hServerConn,unsigned short &seqno,char* sn,unsigned short item_id,unsigned short group_id,unsigned short list, bool nil);
- int aim_add_contact(HANDLE hServerConn,unsigned short &seqno,const char* sn,unsigned short item_id,unsigned short group_id,unsigned short list,char* nick=NULL, char* note=NULL);
- int aim_mod_group(HANDLE hServerConn,unsigned short &seqno,const char* name,unsigned short group_id,char* members,unsigned short members_length);
- int aim_mod_buddy(HANDLE hServerConn,unsigned short &seqno,const char* sn,unsigned short buddy_id,unsigned short group_id,char* nick,char* note);
- int aim_ssi_update(HANDLE hServerConn, unsigned short &seqno, bool start);
- int aim_ssi_update_preferences(HANDLE hServerConn, unsigned short &seqno);
- int aim_keepalive(HANDLE hServerConn,unsigned short &seqno);
- int aim_send_file(HANDLE hServerConn,unsigned short &seqno,unsigned long ip, unsigned short port, bool force_proxy, file_transfer *ft);//used when requesting a regular file transfer
- int aim_file_ad(HANDLE hServerConn,unsigned short &seqno,char* sn,char* icbm_cookie,bool deny,unsigned short max_ver);
- int aim_typing_notification(HANDLE hServerConn,unsigned short &seqno,char* sn,unsigned short type);
- int aim_set_idle(HANDLE hServerConn,unsigned short &seqno,unsigned long seconds);
- int aim_request_mail(HANDLE hServerConn,unsigned short &seqno);
- int aim_activate_mail(HANDLE hServerConn,unsigned short &seqno);
- int aim_request_avatar(HANDLE hServerConn,unsigned short &seqno,const char* sn, unsigned short bart_type, const char* hash, unsigned short hash_size);//family 0x0010
- int aim_set_avatar_hash(HANDLE hServerConn,unsigned short &seqno, char flags, unsigned short bart_type, unsigned short &id, char size, const char* hash);
- int aim_delete_avatar_hash(HANDLE hServerConn,unsigned short &seqno, char flags, unsigned short bart_type, unsigned short &id);
- int aim_upload_avatar(HANDLE hServerConn,unsigned short &seqno, unsigned short bart_type, const char* avatar, unsigned short avatar_size);
- int aim_search_by_email(HANDLE hServerConn,unsigned short &seqno, const char* email);
- int aim_set_pd_info(HANDLE hServerConn, unsigned short &seqno);
- int aim_block_buddy(HANDLE hServerConn, unsigned short &seqno, bool remove, const char* sn, unsigned short item_id);
- int aim_chatnav_request_limits(HANDLE hServerConn,unsigned short &seqno);
- int aim_chatnav_create(HANDLE hServerConn,unsigned short &seqno, char* room, unsigned short exchage);
- int aim_chatnav_room_info(HANDLE hServerConn,unsigned short &seqno, char* chat_cookie, unsigned short exchange, unsigned short instance);
- int aim_chat_join_room(HANDLE hServerConn,unsigned short &seqno, char* chat_cookie, unsigned short exchange, unsigned short instance,unsigned short id);
- int aim_chat_send_message(HANDLE hServerConn,unsigned short &seqno, char *amsg);
- int aim_chat_invite(HANDLE hServerConn,unsigned short &seqno, char* chat_cookie, unsigned short exchange, unsigned short instance, char* sn, char* msg);
- int aim_chat_deny(HANDLE hServerConn,unsigned short &seqno,char* sn,char* icbm_cookie);
- int aim_admin_ready(HANDLE hServerConn,unsigned short &seqno);
- int aim_admin_format_name(HANDLE hServerConn,unsigned short &seqno, const char* sn);
- int aim_admin_change_password(HANDLE hServerConn,unsigned short &seqno, const char* cur_pw, const char* new_pw);
- int aim_admin_change_email(HANDLE hServerConn,unsigned short &seqno, const char* email);
- int aim_admin_request_info(HANDLE hServerConn,unsigned short &seqno, const unsigned short &type);
- int aim_admin_account_confirm(HANDLE hServerConn,unsigned short &seqno);
+ int aim_send_connection_packet(HNETLIBCONN hServerConn, unsigned short &seqno, char *buf);
+ int aim_authkey_request(HNETLIBCONN hServerConn, unsigned short &seqno);
+ int aim_auth_request(HNETLIBCONN hServerConn, unsigned short &seqno, const char* key, const char* language, const char* country, const char* username, const char* password);
+ int aim_send_cookie(HNETLIBCONN hServerConn, unsigned short &seqno, int cookie_size, char * cookie);
+ int aim_send_service_request(HNETLIBCONN hServerConn, unsigned short &seqno);
+ int aim_new_service_request(HNETLIBCONN hServerConn, unsigned short &seqno, unsigned short service);
+ int aim_request_rates(HNETLIBCONN hServerConn, unsigned short &seqno);
+ int aim_request_icbm(HNETLIBCONN hServerConn, unsigned short &seqno);
+ int aim_request_offline_msgs(HNETLIBCONN hServerConn, unsigned short &seqno);
+ int aim_set_icbm(HNETLIBCONN hServerConn, unsigned short &seqno);
+ int aim_set_profile(HNETLIBCONN hServerConn, unsigned short &seqno, char* amsg);//user info
+ int aim_request_list(HNETLIBCONN hServerConn, unsigned short &seqno);
+ int aim_activate_list(HNETLIBCONN hServerConn, unsigned short &seqno);
+ int aim_accept_rates(HNETLIBCONN hServerConn, unsigned short &seqno);
+ int aim_set_caps(HNETLIBCONN hServerConn, unsigned short &seqno);
+ int aim_client_ready(HNETLIBCONN hServerConn, unsigned short &seqno);
+ int aim_mail_ready(HNETLIBCONN hServerConn, unsigned short &seqno);
+ int aim_avatar_ready(HNETLIBCONN hServerConn, unsigned short &seqno);
+ int aim_chatnav_ready(HNETLIBCONN hServerConn, unsigned short &seqno);
+ int aim_chat_ready(HNETLIBCONN hServerConn, unsigned short &seqno);
+ int aim_send_message(HNETLIBCONN hServerConn, unsigned short &seqno, const char* sn, char* amsg, bool auto_response, bool blast);
+ int aim_query_profile(HNETLIBCONN hServerConn, unsigned short &seqno, char* sn);
+ int aim_delete_contact(HNETLIBCONN hServerConn, unsigned short &seqno, char* sn, unsigned short item_id, unsigned short group_id, unsigned short list, bool nil);
+ int aim_add_contact(HNETLIBCONN hServerConn, unsigned short &seqno, const char* sn, unsigned short item_id, unsigned short group_id, unsigned short list, char* nick = NULL, char* note = NULL);
+ int aim_mod_group(HNETLIBCONN hServerConn, unsigned short &seqno, const char* name, unsigned short group_id, char* members, unsigned short members_length);
+ int aim_mod_buddy(HNETLIBCONN hServerConn, unsigned short &seqno, const char* sn, unsigned short buddy_id, unsigned short group_id, char* nick, char* note);
+ int aim_ssi_update(HNETLIBCONN hServerConn, unsigned short &seqno, bool start);
+ int aim_ssi_update_preferences(HNETLIBCONN hServerConn, unsigned short &seqno);
+ int aim_keepalive(HNETLIBCONN hServerConn, unsigned short &seqno);
+ int aim_send_file(HNETLIBCONN hServerConn, unsigned short &seqno, unsigned long ip, unsigned short port, bool force_proxy, file_transfer *ft);//used when requesting a regular file transfer
+ int aim_file_ad(HNETLIBCONN hServerConn, unsigned short &seqno, char* sn, char* icbm_cookie, bool deny, unsigned short max_ver);
+ int aim_typing_notification(HNETLIBCONN hServerConn, unsigned short &seqno, char* sn, unsigned short type);
+ int aim_set_idle(HNETLIBCONN hServerConn, unsigned short &seqno, unsigned long seconds);
+ int aim_request_mail(HNETLIBCONN hServerConn, unsigned short &seqno);
+ int aim_activate_mail(HNETLIBCONN hServerConn, unsigned short &seqno);
+ int aim_request_avatar(HNETLIBCONN hServerConn, unsigned short &seqno, const char* sn, unsigned short bart_type, const char* hash, unsigned short hash_size);//family 0x0010
+ int aim_set_avatar_hash(HNETLIBCONN hServerConn, unsigned short &seqno, char flags, unsigned short bart_type, unsigned short &id, char size, const char* hash);
+ int aim_delete_avatar_hash(HNETLIBCONN hServerConn, unsigned short &seqno, char flags, unsigned short bart_type, unsigned short &id);
+ int aim_upload_avatar(HNETLIBCONN hServerConn, unsigned short &seqno, unsigned short bart_type, const char* avatar, unsigned short avatar_size);
+ int aim_search_by_email(HNETLIBCONN hServerConn, unsigned short &seqno, const char* email);
+ int aim_set_pd_info(HNETLIBCONN hServerConn, unsigned short &seqno);
+ int aim_block_buddy(HNETLIBCONN hServerConn, unsigned short &seqno, bool remove, const char* sn, unsigned short item_id);
+ int aim_chatnav_request_limits(HNETLIBCONN hServerConn, unsigned short &seqno);
+ int aim_chatnav_create(HNETLIBCONN hServerConn, unsigned short &seqno, char* room, unsigned short exchage);
+ int aim_chatnav_room_info(HNETLIBCONN hServerConn, unsigned short &seqno, char* chat_cookie, unsigned short exchange, unsigned short instance);
+ int aim_chat_join_room(HNETLIBCONN hServerConn, unsigned short &seqno, char* chat_cookie, unsigned short exchange, unsigned short instance, unsigned short id);
+ int aim_chat_send_message(HNETLIBCONN hServerConn, unsigned short &seqno, char *amsg);
+ int aim_chat_invite(HNETLIBCONN hServerConn, unsigned short &seqno, char* chat_cookie, unsigned short exchange, unsigned short instance, char* sn, char* msg);
+ int aim_chat_deny(HNETLIBCONN hServerConn, unsigned short &seqno, char* sn, char* icbm_cookie);
+ int aim_admin_ready(HNETLIBCONN hServerConn, unsigned short &seqno);
+ int aim_admin_format_name(HNETLIBCONN hServerConn, unsigned short &seqno, const char* sn);
+ int aim_admin_change_password(HNETLIBCONN hServerConn, unsigned short &seqno, const char* cur_pw, const char* new_pw);
+ int aim_admin_change_email(HNETLIBCONN hServerConn, unsigned short &seqno, const char* email);
+ int aim_admin_request_info(HNETLIBCONN hServerConn, unsigned short &seqno, const unsigned short &type);
+ int aim_admin_account_confirm(HNETLIBCONN hServerConn, unsigned short &seqno);
//////////////////////////////////////////////////////////////////////////////////////
// connection.cpp
- void aim_connection_authorization( void );
- void aim_connection_clientlogin( void );
+ void aim_connection_authorization(void);
+ void aim_connection_clientlogin(void);
- void __cdecl aim_protocol_negotiation( void* );
- void __cdecl aim_mail_negotiation( void* );
- void __cdecl aim_avatar_negotiation( void* );
- void __cdecl aim_chatnav_negotiation( void* );
- void __cdecl aim_chat_negotiation( void* );
- void __cdecl aim_admin_negotiation( void* );
+ void __cdecl aim_protocol_negotiation(void*);
+ void __cdecl aim_mail_negotiation(void*);
+ void __cdecl aim_avatar_negotiation(void*);
+ void __cdecl aim_chatnav_negotiation(void*);
+ void __cdecl aim_chat_negotiation(void*);
+ void __cdecl aim_admin_negotiation(void*);
- HANDLE aim_connect(const char* server, unsigned short port, bool use_ssl, const char* host = NULL);
- HANDLE aim_peer_connect(const char* ip, unsigned short port);
- HANDLE aim_peer_connect(unsigned long ip, unsigned short port);
+ HNETLIBCONN aim_connect(const char* server, unsigned short port, bool use_ssl, const char* host = NULL);
+ HNETLIBCONN aim_peer_connect(const char* ip, unsigned short port);
+ HNETLIBCONN aim_peer_connect(unsigned long ip, unsigned short port);
//////////////////////////////////////////////////////////////////////////////////////
// direct_connect.cpp
@@ -327,7 +326,7 @@ struct CAimProto : public PROTO<CAimProto>
//////////////////////////////////////////////////////////////////////////////////////
// packets.cpp
- int aim_sendflap(HANDLE conn, char type,unsigned short length,const char *buf, unsigned short &seqno);
+ int aim_sendflap(HNETLIBCONN conn, char type, unsigned short length, const char *buf, unsigned short &seqno);
//////////////////////////////////////////////////////////////////////////////////////
// proto.cpp
@@ -343,25 +342,25 @@ struct CAimProto : public PROTO<CAimProto>
//////////////////////////////////////////////////////////////////////////////////////
// server.cpp
- void snac_md5_authkey(SNAC &snac,HANDLE hServerConn,unsigned short &seqno, const char* username, const char* password);
+ void snac_md5_authkey(SNAC &snac,HNETLIBCONN hServerConn,unsigned short &seqno, const char* username, const char* password);
int snac_authorization_reply(SNAC &snac);
- void snac_supported_families(SNAC &snac, HANDLE hServerConn,unsigned short &seqno);
- void snac_supported_family_versions(SNAC &snac,HANDLE hServerConn,unsigned short &seqno);//family 0x0001
- void snac_rate_limitations(SNAC &snac,HANDLE hServerConn,unsigned short &seqno);//family 0x0001
- void snac_mail_rate_limitations(SNAC &snac,HANDLE hServerConn,unsigned short &seqno);// family 0x0001
- void snac_avatar_rate_limitations(SNAC &snac,HANDLE hServerConn,unsigned short &seqno);// family 0x0001
- void snac_chatnav_rate_limitations(SNAC &snac,HANDLE hServerConn,unsigned short &seqno);// family 0x0001
- void snac_chat_rate_limitations(SNAC &snac,HANDLE hServerConn,unsigned short &seqno);// family 0x0001
- void snac_admin_rate_limitations(SNAC &snac,HANDLE hServerConn,unsigned short &seqno);// family 0x0001
+ void snac_supported_families(SNAC &snac, HNETLIBCONN hServerConn,unsigned short &seqno);
+ void snac_supported_family_versions(SNAC &snac,HNETLIBCONN hServerConn,unsigned short &seqno);//family 0x0001
+ void snac_rate_limitations(SNAC &snac,HNETLIBCONN hServerConn,unsigned short &seqno);//family 0x0001
+ void snac_mail_rate_limitations(SNAC &snac,HNETLIBCONN hServerConn,unsigned short &seqno);// family 0x0001
+ void snac_avatar_rate_limitations(SNAC &snac,HNETLIBCONN hServerConn,unsigned short &seqno);// family 0x0001
+ void snac_chatnav_rate_limitations(SNAC &snac,HNETLIBCONN hServerConn,unsigned short &seqno);// family 0x0001
+ void snac_chat_rate_limitations(SNAC &snac,HNETLIBCONN hServerConn,unsigned short &seqno);// family 0x0001
+ void snac_admin_rate_limitations(SNAC &snac,HNETLIBCONN hServerConn,unsigned short &seqno);// family 0x0001
void snac_service_redirect(SNAC &snac);// family 0x0001
void snac_self_info(SNAC &snac);//family 0x0001
- void snac_icbm_limitations(SNAC &snac,HANDLE hServerConn,unsigned short &seqno);//family 0x0004
+ void snac_icbm_limitations(SNAC &snac,HNETLIBCONN hServerConn,unsigned short &seqno);//family 0x0004
void snac_user_online(SNAC &snac);
void snac_user_offline(SNAC &snac);
void snac_error(SNAC &snac);//family 0x0003 or x0004
- void snac_contact_list(SNAC &snac,HANDLE hServerConn,unsigned short &seqno);
+ void snac_contact_list(SNAC &snac,HNETLIBCONN hServerConn,unsigned short &seqno);
void snac_message_accepted(SNAC &snac);//family 0x004
- void snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned short &seqno);//family 0x0004
+ void snac_received_message(SNAC &snac,HNETLIBCONN hServerConn,unsigned short &seqno);//family 0x0004
void snac_file_decline(SNAC &snac);//family 0x0004
void snac_received_info(SNAC &snac);//family 0x0002
void snac_typing_notification(SNAC &snac);//family 0x004
@@ -370,7 +369,7 @@ struct CAimProto : public PROTO<CAimProto>
void snac_retrieve_avatar(SNAC &snac);//family 0x0010
void snac_upload_reply_avatar(SNAC &snac);//family 0x0010
void snac_email_search_results(SNAC &snac);//family 0x000A
- void snac_chatnav_info_response(SNAC &snac,HANDLE hServerConn,unsigned short &seqno);//family 0x000D
+ void snac_chatnav_info_response(SNAC &snac,HNETLIBCONN hServerConn,unsigned short &seqno);//family 0x000D
void snac_chat_joined_left_users(SNAC &snac,chat_list_item* item);//family 0x000E
void snac_chat_received_message(SNAC &snac,chat_list_item* item);//family 0x000E
void snac_admin_account_infomod(SNAC &snac);//family 0x0007
@@ -403,7 +402,7 @@ struct CAimProto : public PROTO<CAimProto>
MCONTACT contact_from_sn(const char* sn, bool addIfNeeded = false, bool temporary = false);
void broadcast_status(int status);
- bool wait_conn(HANDLE& hConn, HANDLE& hEvent, unsigned short service);
+ bool wait_conn(HNETLIBCONN& hConn, HANDLE& hEvent, unsigned short service);
bool is_my_contact(MCONTACT hContact);
void add_contact_to_group(MCONTACT hContact, const char* group);
void set_local_nick(MCONTACT hContact, char* nick, char* note);
diff --git a/protocols/AimOscar/src/proxy.cpp b/protocols/AimOscar/src/proxy.cpp
index d3ac4deebe..2b7fdb0f77 100644
--- a/protocols/AimOscar/src/proxy.cpp
+++ b/protocols/AimOscar/src/proxy.cpp
@@ -134,7 +134,7 @@ void __cdecl CAimProto::aim_proxy_helper(void* param)
}
-int proxy_initialize_send(HANDLE connection, char* sn, char* cookie)
+int proxy_initialize_send(HNETLIBCONN connection, char* sn, char* cookie)
{
const char sn_length = (char)mir_strlen(sn);
const int len = sn_length + 21 + TLV_HEADER_SIZE + AIM_CAPS_LENGTH;
@@ -152,7 +152,7 @@ int proxy_initialize_send(HANDLE connection, char* sn, char* cookie)
return Netlib_Send(connection, buf, offset, 0) >= 0 ? 0 : -1;
}
-int proxy_initialize_recv(HANDLE connection,char* sn, char* cookie,unsigned short port_check)
+int proxy_initialize_recv(HNETLIBCONN connection, char* sn, char* cookie, unsigned short port_check)
{
const char sn_length = (char)mir_strlen(sn);
const int len = sn_length + 23 + TLV_HEADER_SIZE + AIM_CAPS_LENGTH;
diff --git a/protocols/AimOscar/src/proxy.h b/protocols/AimOscar/src/proxy.h
index 8a05a3405a..83a03e2d0d 100644
--- a/protocols/AimOscar/src/proxy.h
+++ b/protocols/AimOscar/src/proxy.h
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef PROXY_H
#define PROXY_H
-int proxy_initialize_send(HANDLE connection,char* sn, char* cookie);
-int proxy_initialize_recv(HANDLE connection,char* sn, char* cookie,unsigned short port_check);
+int proxy_initialize_send(HNETLIBCONN connection, char* sn, char* cookie);
+int proxy_initialize_recv(HNETLIBCONN connection, char* sn, char* cookie, unsigned short port_check);
#endif
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp
index 3cc3be86ae..25f32001f1 100644
--- a/protocols/AimOscar/src/server.cpp
+++ b/protocols/AimOscar/src/server.cpp
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
-void CAimProto::snac_md5_authkey(SNAC &snac, HANDLE hServerConn, unsigned short &seqno, const char* username, const char* password)//family 0x0017
+void CAimProto::snac_md5_authkey(SNAC &snac, HNETLIBCONN hServerConn, unsigned short &seqno, const char* username, const char* password)//family 0x0017
{
if (snac.subcmp(0x0007))//md5 authkey string
{
@@ -83,28 +83,28 @@ int CAimProto::snac_authorization_reply(SNAC &snac)//family 0x0017
}
return res;
}
-void CAimProto::snac_supported_families(SNAC &snac, HANDLE hServerConn, unsigned short &seqno)//family 0x0001
+void CAimProto::snac_supported_families(SNAC &snac, HNETLIBCONN hServerConn, unsigned short &seqno)//family 0x0001
{
if (snac.subcmp(0x0003))//server supported service list
{
aim_send_service_request(hServerConn, seqno);
}
}
-void CAimProto::snac_supported_family_versions(SNAC &snac, HANDLE hServerConn, unsigned short &seqno)//family 0x0001
+void CAimProto::snac_supported_family_versions(SNAC &snac, HNETLIBCONN hServerConn, unsigned short &seqno)//family 0x0001
{
if (snac.subcmp(0x0018))//service list okayed
{
aim_request_rates(hServerConn, seqno);//request some rate crap
}
}
-void CAimProto::snac_rate_limitations(SNAC &snac, HANDLE hServerConn, unsigned short &seqno)// family 0x0001
+void CAimProto::snac_rate_limitations(SNAC &snac, HNETLIBCONN hServerConn, unsigned short &seqno)// family 0x0001
{
if (snac.subcmp(0x0007)) {
aim_accept_rates(hServerConn, seqno);
aim_request_icbm(hServerConn, seqno);
}
}
-void CAimProto::snac_mail_rate_limitations(SNAC &snac, HANDLE hServerConn, unsigned short &seqno)// family 0x0001
+void CAimProto::snac_mail_rate_limitations(SNAC &snac, HNETLIBCONN hServerConn, unsigned short &seqno)// family 0x0001
{
if (snac.subcmp(0x0007)) {
aim_accept_rates(hServerConn, seqno);
@@ -114,7 +114,7 @@ void CAimProto::snac_mail_rate_limitations(SNAC &snac, HANDLE hServerConn, unsig
}
}
-void CAimProto::snac_avatar_rate_limitations(SNAC &snac, HANDLE hServerConn, unsigned short &seqno)// family 0x0001
+void CAimProto::snac_avatar_rate_limitations(SNAC &snac, HNETLIBCONN hServerConn, unsigned short &seqno)// family 0x0001
{
if (snac.subcmp(0x0007)) {
aim_accept_rates(hServerConn, seqno);
@@ -123,7 +123,7 @@ void CAimProto::snac_avatar_rate_limitations(SNAC &snac, HANDLE hServerConn, uns
}
}
-void CAimProto::snac_chatnav_rate_limitations(SNAC &snac, HANDLE hServerConn, unsigned short &seqno)// family 0x0001
+void CAimProto::snac_chatnav_rate_limitations(SNAC &snac, HNETLIBCONN hServerConn, unsigned short &seqno)// family 0x0001
{
if (snac.subcmp(0x0007)) {
aim_accept_rates(hServerConn, seqno);
@@ -131,7 +131,7 @@ void CAimProto::snac_chatnav_rate_limitations(SNAC &snac, HANDLE hServerConn, un
}
}
-void CAimProto::snac_chat_rate_limitations(SNAC &snac, HANDLE hServerConn, unsigned short &seqno)// family 0x0001
+void CAimProto::snac_chat_rate_limitations(SNAC &snac, HNETLIBCONN hServerConn, unsigned short &seqno)// family 0x0001
{
if (snac.subcmp(0x0007)) {
aim_accept_rates(hServerConn, seqno);
@@ -139,7 +139,7 @@ void CAimProto::snac_chat_rate_limitations(SNAC &snac, HANDLE hServerConn, unsig
}
}
-void CAimProto::snac_icbm_limitations(SNAC &snac, HANDLE hServerConn, unsigned short &seqno)//family 0x0004
+void CAimProto::snac_icbm_limitations(SNAC &snac, HNETLIBCONN hServerConn, unsigned short &seqno)//family 0x0004
{
if (snac.subcmp(0x0005)) {
switch (m_iDesiredStatus) {
@@ -913,7 +913,7 @@ void CAimProto::delete_ssi_list(SNAC &snac, int &offset)
mir_free(name);
}
-void CAimProto::snac_contact_list(SNAC &snac, HANDLE hServerConn, unsigned short &seqno)//family 0x0013
+void CAimProto::snac_contact_list(SNAC &snac, HNETLIBCONN hServerConn, unsigned short &seqno)//family 0x0013
{
if (snac.subcmp(0x0006)) { //contact list
debugLogA("Contact List Received");
@@ -988,7 +988,7 @@ void CAimProto::snac_message_accepted(SNAC &snac)//family 0x004
mir_free(icbm_cookie);
}
}
-void CAimProto::snac_received_message(SNAC &snac, HANDLE hServerConn, unsigned short &seqno)//family 0x0004
+void CAimProto::snac_received_message(SNAC &snac, HNETLIBCONN hServerConn, unsigned short &seqno)//family 0x0004
{
if (snac.subcmp(0x0007)) {
unsigned short channel = snac.ushort(8);
@@ -1744,7 +1744,7 @@ void CAimProto::snac_email_search_results(SNAC &snac)//family 0x000A
CAimProto::ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
}
-void CAimProto::snac_chatnav_info_response(SNAC &snac, HANDLE hServerConn, unsigned short &seqno)//family 0x000D
+void CAimProto::snac_chatnav_info_response(SNAC &snac, HNETLIBCONN hServerConn, unsigned short &seqno)//family 0x000D
{
if (snac.subcmp(0x0009)) {
debugLogA("Chat Info Received");
@@ -1901,7 +1901,7 @@ void CAimProto::snac_chat_received_message(SNAC &snac, chat_list_item* item)//fa
}
}
-void CAimProto::snac_admin_rate_limitations(SNAC &snac, HANDLE hServerConn, unsigned short &seqno)// family 0x0001
+void CAimProto::snac_admin_rate_limitations(SNAC &snac, HNETLIBCONN hServerConn, unsigned short &seqno)// family 0x0001
{
if (snac.subcmp(0x0007)) {
aim_accept_rates(hServerConn, seqno);
diff --git a/protocols/AimOscar/src/thread.cpp b/protocols/AimOscar/src/thread.cpp
index 35685f24ce..35b163f506 100644
--- a/protocols/AimOscar/src/thread.cpp
+++ b/protocols/AimOscar/src/thread.cpp
@@ -23,7 +23,7 @@ void __cdecl CAimProto::accept_file_thread(void* param)//buddy sending file
{
file_transfer *ft = (file_transfer*)param;
- HANDLE hConn = NULL;
+ HNETLIBCONN hConn = NULL;
if (ft->peer_force_proxy) //peer is forcing proxy
{
hConn = aim_peer_connect(ft->proxy_ip, get_default_port());
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp
index 546a1eaaa7..ee1918bcc4 100755
--- a/protocols/AimOscar/src/utility.cpp
+++ b/protocols/AimOscar/src/utility.cpp
@@ -109,8 +109,6 @@ void CAimProto::start_connection(void*)
if (login_url == NULL) login_url = mir_strdup(AIM_DEFAULT_SERVER);
-
-
m_hServerConn = aim_connect(login_url, get_default_port(), false, login_url); //ssl does not work anymore with old authorization algo
mir_free(login_url);
@@ -133,7 +131,7 @@ void CAimProto::start_connection(void*)
}
}
-bool CAimProto::wait_conn(HANDLE& hConn, HANDLE& hEvent, unsigned short service)
+bool CAimProto::wait_conn(HNETLIBCONN &hConn, HANDLE &hEvent, unsigned short service)
{
if (m_iStatus == ID_STATUS_OFFLINE)
return false;
@@ -141,7 +139,7 @@ bool CAimProto::wait_conn(HANDLE& hConn, HANDLE& hEvent, unsigned short service)
mir_cslock lck(connMutex);
if (hConn == NULL && m_hServerConn) {
debugLogA("Starting Connection.");
- hConn = (HANDLE)1; //set so no additional service request attempts are made while aim is still processing the request
+ hConn = (HNETLIBCONN)1; //set so no additional service request attempts are made while aim is still processing the request
aim_new_service_request(m_hServerConn, m_seqno, service);//general service connection!
}
}
diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h
index 22fe036f5b..2ac14310b8 100644
--- a/protocols/Discord/src/proto.h
+++ b/protocols/Discord/src/proto.h
@@ -130,9 +130,8 @@ class CDiscordProto : public PROTO<CDiscordProto>
void ExecuteRequest(AsyncHttpRequest *pReq);
AsyncHttpRequest* Push(AsyncHttpRequest *pReq, int iTimeout = 10000);
- HANDLE
- m_hAPIConnection, // working connection
- m_hWorkerThread; // worker thread handle
+ HANDLE m_hWorkerThread; // worker thread handle
+ HNETLIBCONN m_hAPIConnection; // working connection
bool
m_bOnline, // protocol is online
@@ -146,7 +145,7 @@ class CDiscordProto : public PROTO<CDiscordProto>
m_szGatewaySessionId; // current session id
HNETLIBUSER m_hGatewayNetlibUser; // the separate netlib user handle for gateways
- HANDLE m_hGatewayConnection; // gateway connection
+ HNETLIBCONN m_hGatewayConnection; // gateway connection
void __cdecl GatewayThread(void*);
void CDiscordProto::GatewayThreadWorker(void);
diff --git a/protocols/FacebookRM/src/avatars.cpp b/protocols/FacebookRM/src/avatars.cpp
index ede32afc42..da7be52e72 100644
--- a/protocols/FacebookRM/src/avatars.cpp
+++ b/protocols/FacebookRM/src/avatars.cpp
@@ -86,7 +86,7 @@ void FacebookProto::CheckAvatarChange(MCONTACT hContact, const std::string &imag
void FacebookProto::UpdateAvatarWorker(void *)
{
- HANDLE nlc = NULL;
+ HNETLIBCONN nlc = NULL;
debugLogA("*** UpdateAvatarWorker");
diff --git a/protocols/FacebookRM/src/client.h b/protocols/FacebookRM/src/client.h
index f36635c979..d563b8a6bd 100644
--- a/protocols/FacebookRM/src/client.h
+++ b/protocols/FacebookRM/src/client.h
@@ -50,9 +50,9 @@ public:
loading_history = false;
}
- HANDLE hChannelCon;
- HANDLE hMessagesCon;
- HANDLE hFcbCon;
+ HNETLIBCONN hChannelCon;
+ HNETLIBCONN hMessagesCon;
+ HNETLIBCONN hFcbCon;
HANDLE fcb_conn_lock_;
// Random generator value for this client
@@ -214,7 +214,7 @@ public:
// HTTP communication
http::response sendRequest(HttpRequest *request);
- bool save_url(const std::string &url,const std::wstring &filename, HANDLE &nlc);
+ bool save_url(const std::string &url, const std::wstring &filename, HNETLIBCONN &nlc);
////////////////////////////////////////////////////////////
// Netlib handle
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp
index c36c064994..3ce901be9a 100644
--- a/protocols/FacebookRM/src/communication.cpp
+++ b/protocols/FacebookRM/src/communication.cpp
@@ -1183,7 +1183,7 @@ bool facebook_client::post_status(status_data *status)
//////////////////////////////////////////////////////////////////////////////
-bool facebook_client::save_url(const std::string &url, const std::wstring &filename, HANDLE &nlc)
+bool facebook_client::save_url(const std::string &url, const std::wstring &filename, HNETLIBCONN &nlc)
{
NETLIBHTTPREQUEST req = { sizeof(req) };
NETLIBHTTPREQUEST *resp;
diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp
index d0a5936a79..1c5e786f9a 100644
--- a/protocols/FacebookRM/src/messages.cpp
+++ b/protocols/FacebookRM/src/messages.cpp
@@ -208,7 +208,7 @@ void FacebookProto::StickerAsSmiley(std::string sticker, const std::string &url,
// Check if we have this sticker already and download it if not
if (GetFileAttributes(filename.c_str()) == INVALID_FILE_ATTRIBUTES) {
- HANDLE nlc = NULL;
+ HNETLIBCONN nlc = NULL;
facy.save_url(url, filename, nlc);
Netlib_CloseHandle(nlc);
}
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp
index bf1bb81504..52074931a6 100644
--- a/protocols/Gadu-Gadu/src/oauth.cpp
+++ b/protocols/Gadu-Gadu/src/oauth.cpp
@@ -286,7 +286,7 @@ int GGPROTO::oauth_receivetoken()
{
char szUrl[256], uin[32], *str, *token = NULL, *token_secret = NULL;
int res = 0;
- HANDLE nlc = NULL;
+ HNETLIBCONN nlc = NULL;
UIN2IDA( getDword(GG_KEY_UIN, 0), uin);
char *password = getStringA(GG_KEY_PASSWORD);
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp
index cf6a7914d7..e621777293 100644
--- a/protocols/IRCG/src/irclib.cpp
+++ b/protocols/IRCG/src/irclib.cpp
@@ -358,7 +358,6 @@ void CIrcProto::DoReceive()
if (m_info.bIdentServer && m_info.iIdentServerPort != NULL) {
NETLIBBIND nb = {};
- nb.cbSize = sizeof(NETLIBBIND);
nb.pfnNewConnectionV2 = DoIdent;
nb.pExtra = this;
nb.wPort = m_info.iIdentServerPort;
@@ -875,10 +874,8 @@ int CDccSession::SetupConnection()
// create a listening socket for outgoing chat/send requests. The remote computer connects to this computer. Used for both chat and filetransfer.
if (di->bSender && !di->bReverse) {
NETLIBBIND nb = {};
- nb.cbSize = sizeof(NETLIBBIND);
nb.pfnNewConnectionV2 = DoIncomingDcc; // this is the (helper) function to be called once an incoming connection is made. The 'real' function that is called is IncomingConnection()
- nb.pExtra = (void *)this;
- nb.wPort = 0;
+ nb.pExtra = this;
hBindPort = Netlib_BindPort(m_proto->hNetlibDCC, &nb);
if (hBindPort == NULL) {
@@ -954,10 +951,8 @@ int CDccSession::SetupConnection()
// hack for passive filetransfers
if (di->iType == DCC_SEND && !di->bSender && di->bReverse) {
NETLIBBIND nb = {};
- nb.cbSize = sizeof(NETLIBBIND);
nb.pfnNewConnectionV2 = DoIncomingDcc; // this is the (helper) function to be called once an incoming connection is made. The 'real' function that is called is IncomingConnection()
- nb.pExtra = (void *)this;
- nb.wPort = 0;
+ nb.pExtra = this;
hBindPort = Netlib_BindPort(m_proto->hNetlibDCC, &nb);
if (hBindPort == NULL) {
@@ -1015,7 +1010,7 @@ int CDccSession::SetupConnection()
}
// called by netlib for incoming connections on a listening socket (chat/filetransfer)
-int CDccSession::IncomingConnection(HANDLE hConnection, DWORD dwIP)
+int CDccSession::IncomingConnection(HNETLIBCONN hConnection, DWORD dwIP)
{
con = hConnection;
if (con == NULL) {
@@ -1380,7 +1375,7 @@ VOID CALLBACK DCCTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD)
}
// helper function for incoming dcc connections.
-void DoIncomingDcc(HANDLE hConnection, DWORD dwRemoteIP, void * p1)
+void DoIncomingDcc(HNETLIBCONN hConnection, DWORD dwRemoteIP, void * p1)
{
CDccSession *dcc = (CDccSession*)p1;
dcc->IncomingConnection(hConnection, dwRemoteIP);
@@ -1388,7 +1383,7 @@ void DoIncomingDcc(HANDLE hConnection, DWORD dwRemoteIP, void * p1)
// ident server
-void DoIdent(HANDLE hConnection, DWORD, void* extra)
+void DoIdent(HNETLIBCONN hConnection, DWORD, void* extra)
{
CIrcProto *ppro = (CIrcProto*)extra;
diff --git a/protocols/IRCG/src/irclib.h b/protocols/IRCG/src/irclib.h
index 4c0395e3f6..e75d5205a9 100644
--- a/protocols/IRCG/src/irclib.h
+++ b/protocols/IRCG/src/irclib.h
@@ -24,8 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#pragma warning (disable: 4786)
-void DoIdent(HANDLE hConnection, DWORD dwRemoteIP, void* extra);
-void DoIncomingDcc(HANDLE hConnection, DWORD dwRemoteIP, void* extra);
+void DoIdent(HNETLIBCONN hConnection, DWORD dwRemoteIP, void* extra);
+void DoIncomingDcc(HNETLIBCONN hConnection, DWORD dwRemoteIP, void* extra);
unsigned long ConvertIPToInteger(char * IP);
char* ConvertIntegerToIP(unsigned long int_ip_addr);
@@ -123,8 +123,8 @@ class CDccSession
{
protected:
CIrcProto* m_proto;
- HANDLE con; // connection handle
- HANDLE hBindPort; // handle for listening port
+ HNETLIBCONN con; // connection handle
+ HNETLIBBIND hBindPort; // handle for listening port
static int nDcc; // number of dcc objects
unsigned __int64 dwTotal; // total bytes sent/received
@@ -164,7 +164,7 @@ public:
int Connect();
void SetupPassive( DWORD adr, DWORD port );
int SendStuff(const wchar_t* fmt);
- int IncomingConnection(HANDLE hConnection, DWORD dwIP);
+ int IncomingConnection(HNETLIBCONN hConnection, DWORD dwIP);
int Disconnect();
};
diff --git a/protocols/IRCG/src/stdafx.h b/protocols/IRCG/src/stdafx.h
index ca32a61167..9662f643ce 100644
--- a/protocols/IRCG/src/stdafx.h
+++ b/protocols/IRCG/src/stdafx.h
@@ -447,7 +447,7 @@ struct CIrcProto : public PROTO<CIrcProto>
void AddToJTemp(wchar_t op, CMStringW& sCommand);
bool AddWindowItemData(CMStringW window, const wchar_t *pszLimit, const wchar_t *pszMode, const wchar_t *pszPassword, const wchar_t *pszTopic);
INT_PTR DoEvent(int iEvent, const wchar_t *pszWindow, const wchar_t *pszNick, const wchar_t *pszText, const wchar_t *pszStatus, const wchar_t *pszUserInfo, DWORD_PTR dwItemData, bool bAddToLog, bool bIsMe, time_t timestamp = 1);
- void FindLocalIP(HANDLE con);
+ void FindLocalIP(HNETLIBCONN con);
bool FreeWindowItemData(CMStringW window, CHANNELINFO* wis);
bool IsChannel(const char* sName);
bool IsChannel(const wchar_t* sName);
@@ -502,8 +502,8 @@ struct CIrcProto : public PROTO<CIrcProto>
protected:
int codepage;
- HANDLE con;
- HANDLE hBindPort;
+ HNETLIBCONN con;
+ HNETLIBBIND hBindPort;
void DoReceive();
LIST<CDccSession> m_dcc_chats;
LIST<CDccSession> m_dcc_xfers;
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp
index 34b0148b96..3efe9a248e 100644
--- a/protocols/IRCG/src/tools.cpp
+++ b/protocols/IRCG/src/tools.cpp
@@ -589,7 +589,7 @@ bool CIrcProto::AddWindowItemData(CMStringW window, const wchar_t* pszLimit, con
return false;
}
-void CIrcProto::FindLocalIP(HANDLE hConn) // inspiration from jabber
+void CIrcProto::FindLocalIP(HNETLIBCONN hConn) // inspiration from jabber
{
// Determine local IP
int socket = Netlib_GetSocket(hConn);
diff --git a/protocols/IcqOscarJ/src/cookies.h b/protocols/IcqOscarJ/src/cookies.h
index 37f85c214c..012488bff4 100644
--- a/protocols/IcqOscarJ/src/cookies.h
+++ b/protocols/IcqOscarJ/src/cookies.h
@@ -56,7 +56,7 @@ struct icq_cookie_info : public MZeroedObject
struct cookie_family_request
{
WORD wFamily;
- void (CIcqProto::*familyHandler)(HANDLE hConn, char* cookie, size_t cookieLen);
+ void (CIcqProto::*familyHandler)(HNETLIBCONN hConn, char* cookie, size_t cookieLen);
};
struct cookie_offline_messages
diff --git a/protocols/IcqOscarJ/src/fam_01service.cpp b/protocols/IcqOscarJ/src/fam_01service.cpp
index 72640bb168..7e225f7af8 100644
--- a/protocols/IcqOscarJ/src/fam_01service.cpp
+++ b/protocols/IcqOscarJ/src/fam_01service.cpp
@@ -363,7 +363,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, size_t wBufferLength, snac_heade
nloc.szHost = pServer;
nloc.wPort = wPort;
- HANDLE hConnection = NetLib_OpenConnection(m_hNetlibUser, wFamily == ICQ_AVATAR_FAMILY ? "Avatar " : NULL, &nloc);
+ HNETLIBCONN hConnection = NetLib_OpenConnection(m_hNetlibUser, wFamily == ICQ_AVATAR_FAMILY ? "Avatar " : NULL, &nloc);
if (hConnection == NULL)
debugLogA("Unable to connect to ICQ new family server.");
diff --git a/protocols/IcqOscarJ/src/guids.h b/protocols/IcqOscarJ/src/guids.h
index 3625b7281e..c690367ec0 100644
--- a/protocols/IcqOscarJ/src/guids.h
+++ b/protocols/IcqOscarJ/src/guids.h
@@ -58,14 +58,12 @@ static const plugin_guid MGTYPE_CHAT = {MGTYPE_CHAT_s};
static const plugin_guid MGTYPE_SMS_MESSAGE = {MGTYPE_SMS_MESSAGE_s};
static const plugin_guid MGTYPE_XTRAZ_SCRIPT = {MGTYPE_XTRAZ_SCRIPT_s};
-
// make GUID checks easy
-static BOOL CompareGUIDs(DWORD q1,DWORD q2,DWORD q3,DWORD q4, const plugin_guid guid)
+__forceinline bool CompareGUIDs(DWORD q1, DWORD q2, DWORD q3, DWORD q4, const plugin_guid guid)
{
- return ((q1 == guid[0]) && (q2 == guid[1]) && (q3 == guid[2]) && (q4 == guid[3]))?TRUE:FALSE;
+ return ((q1 == guid[0]) && (q2 == guid[1]) && (q3 == guid[2]) && (q4 == guid[3])) ? true : false;
}
-
// pack entire GUID into icq packet
static __inline void packGUID(icq_packet *packet, const plugin_guid guid)
{
diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp
index ad93fb8065..25f214acbb 100644
--- a/protocols/IcqOscarJ/src/icq_avatar.cpp
+++ b/protocols/IcqOscarJ/src/icq_avatar.cpp
@@ -170,7 +170,7 @@ int CIcqProto::IsAvatarChanged(MCONTACT hContact, const BYTE *pHash, size_t nHas
return ret;
}
-void CIcqProto::StartAvatarThread(HANDLE hConn, char *cookie, size_t cookieLen) // called from event
+void CIcqProto::StartAvatarThread(HNETLIBCONN hConn, char *cookie, size_t cookieLen) // called from event
{
if (!hConn) {
mir_cslock l(m_avatarsMutex); // place avatars lock
@@ -688,7 +688,7 @@ void __cdecl CIcqProto::AvatarThread(avatars_server_connection *pInfo)
debugLogA("%s thread ended.", "Avatar");
}
-avatars_server_connection::avatars_server_connection(CIcqProto *_ppro, HANDLE _hConnection, char *_pCookie, size_t _wCookieLen) :
+avatars_server_connection::avatars_server_connection(CIcqProto *_ppro, HNETLIBCONN _hConnection, char *_pCookie, size_t _wCookieLen) :
isLoggedIn(false), stopThread(false), isActive(false),
ppro(_ppro),
pCookie(_pCookie),
@@ -712,8 +712,10 @@ void avatars_server_connection::closeConnection()
stopThread = TRUE;
mir_cslock l(localSeqMutex);
- if (hConnection)
- NetLib_SafeCloseHandle(&hConnection);
+ if (hConnection) {
+ Netlib_CloseHandle(hConnection);
+ hConnection = NULL;
+ }
}
void avatars_server_connection::shutdownConnection()
diff --git a/protocols/IcqOscarJ/src/icq_avatar.h b/protocols/IcqOscarJ/src/icq_avatar.h
index d0346b229b..e08564c4d4 100644
--- a/protocols/IcqOscarJ/src/icq_avatar.h
+++ b/protocols/IcqOscarJ/src/icq_avatar.h
@@ -42,7 +42,7 @@ struct CIcqProto;
class avatars_server_connection : public MZeroedObject
{
CIcqProto *ppro;
- HANDLE hConnection; // handle to the connection
+ HNETLIBCONN hConnection; // handle to the connection
HANDLE hPacketRecver;
WORD wLocalSequence;
mir_cs localSeqMutex, connMutex;
@@ -73,7 +73,7 @@ class avatars_server_connection : public MZeroedObject
void checkRequestQueue();
public:
- avatars_server_connection(CIcqProto *ppro, HANDLE hConnection, char *pCookie, size_t wCookieLen);
+ avatars_server_connection(CIcqProto *ppro, HNETLIBCONN hConnection, char *pCookie, size_t wCookieLen);
virtual ~avatars_server_connection();
void connectionThread();
diff --git a/protocols/IcqOscarJ/src/icq_direct.cpp b/protocols/IcqOscarJ/src/icq_direct.cpp
index d87b215704..f7d0ea13fb 100644
--- a/protocols/IcqOscarJ/src/icq_direct.cpp
+++ b/protocols/IcqOscarJ/src/icq_direct.cpp
@@ -29,7 +29,7 @@ struct directthreadstartinfo
{
int type; // Only valid for outgoing connections
int incoming; // 1=incoming, 0=outgoing
- HANDLE hConnection; // only valid for incoming connections, handle to the connection
+ HNETLIBCONN hConnection; // only valid for incoming connections, handle to the connection
MCONTACT hContact; // Only valid for outgoing connections
void* pvExtra; // Only valid for outgoing connections
};
@@ -50,7 +50,7 @@ void CIcqProto::CloseContactDirectConns(MCONTACT hContact)
for (int i = 0; i < directConns.getCount(); i++) {
if (!hContact || directConns[i]->hContact == hContact) {
- HANDLE hConnection = directConns[i]->hConnection;
+ HNETLIBCONN hConnection = directConns[i]->hConnection;
directConns[i]->hConnection = NULL; // do not allow reuse
NetLib_CloseConnection(&hConnection, FALSE);
@@ -105,7 +105,7 @@ int CIcqProto::sendDirectPacket(directconnect* dc, icq_packet* pkt)
return nResult;
}
-directthreadstartinfo* CreateDTSI(MCONTACT hContact, HANDLE hConnection, int type)
+directthreadstartinfo* CreateDTSI(MCONTACT hContact, HNETLIBCONN hConnection, int type)
{
directthreadstartinfo *dtsi = (directthreadstartinfo*)SAFE_MALLOC(sizeof(directthreadstartinfo));
dtsi->hContact = hContact;
@@ -159,7 +159,7 @@ BOOL CIcqProto::IsDirectConnectionOpen(MCONTACT hContact, int type, int bPassive
// This function is called from the Netlib when someone is connecting to
// one of our incomming DC ports
-void icq_newConnectionReceived(HANDLE hNewConnection, DWORD, void *pExtra)
+void icq_newConnectionReceived(HNETLIBCONN hNewConnection, DWORD, void *pExtra)
{
// Start a new thread for the incomming connection
CIcqProto* ppro = (CIcqProto*)pExtra;
diff --git a/protocols/IcqOscarJ/src/icq_direct.h b/protocols/IcqOscarJ/src/icq_direct.h
index 7a412ced11..4b3da88a79 100644
--- a/protocols/IcqOscarJ/src/icq_direct.h
+++ b/protocols/IcqOscarJ/src/icq_direct.h
@@ -49,7 +49,7 @@ struct filetransfer: public basic_filetransfer
DWORD dwTransferSpeed;
DWORD dwBytesDone, dwFileBytesDone;
int fileId;
- HANDLE hConnection;
+ HNETLIBCONN hConnection;
DWORD dwLastNotify;
int nVersion; // Was this sent with a v7 or a v8 packet?
BOOL bDC; // Was this received over a DC or through server?
@@ -65,7 +65,7 @@ struct filetransfer: public basic_filetransfer
struct directconnect
{
MCONTACT hContact;
- HANDLE hConnection;
+ HNETLIBCONN hConnection;
DWORD dwConnectionCookie;
int type;
WORD wVersion;
diff --git a/protocols/IcqOscarJ/src/icq_http.cpp b/protocols/IcqOscarJ/src/icq_http.cpp
index 20d63bf75d..15fb8f8c6e 100644
--- a/protocols/IcqOscarJ/src/icq_http.cpp
+++ b/protocols/IcqOscarJ/src/icq_http.cpp
@@ -29,7 +29,7 @@
#include "stdafx.h"
-int icq_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION*, NETLIBHTTPREQUEST *nlhr)
+int icq_httpGatewayInit(HNETLIBCONN hConn, NETLIBOPENCONNECTION*, NETLIBHTTPREQUEST *nlhr)
{
// initial response from ICQ http gateway
size_t wLen, wVersion, wType;
@@ -79,7 +79,7 @@ int icq_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION*, NETLIBHTTPREQUEST *
-int icq_httpGatewayBegin(HANDLE hConn, NETLIBOPENCONNECTION* nloc)
+int icq_httpGatewayBegin(HNETLIBCONN hConn, NETLIBOPENCONNECTION* nloc)
{ // open our "virual data connection"
icq_packet packet;
size_t serverNameLen;
@@ -99,7 +99,7 @@ int icq_httpGatewayBegin(HANDLE hConn, NETLIBOPENCONNECTION* nloc)
-int icq_httpGatewayWrapSend(HANDLE hConn, PBYTE buf, int len, int flags)
+int icq_httpGatewayWrapSend(HNETLIBCONN hConn, PBYTE buf, int len, int flags)
{
PBYTE sendBuf = buf;
int sendLen = len;
@@ -192,7 +192,7 @@ PBYTE icq_httpGatewayUnwrapRecv(NETLIBHTTPREQUEST*, PBYTE buf, int len, int* out
-int icq_httpGatewayWalkTo(HANDLE hConn, NETLIBOPENCONNECTION* nloc)
+int icq_httpGatewayWalkTo(HNETLIBCONN hConn, NETLIBOPENCONNECTION* nloc)
{ // this is bad simplification - for avatars to work we need to handle
// two "virtual connections" at the same time
icq_packet packet;
diff --git a/protocols/IcqOscarJ/src/icq_http.h b/protocols/IcqOscarJ/src/icq_http.h
index 0f2eb6a394..3df6511b08 100644
--- a/protocols/IcqOscarJ/src/icq_http.h
+++ b/protocols/IcqOscarJ/src/icq_http.h
@@ -35,10 +35,10 @@
#define HTTP_PACKETTYPE_CLOSE 6 /* contains no data */
#define HTTP_PACKETTYPE_CLOSEREPLY 7 /* contains 1 byte: 0 */
-int icq_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION *nloc, NETLIBHTTPREQUEST *nlhr);
-int icq_httpGatewayBegin(HANDLE hConn, NETLIBOPENCONNECTION *nloc);
-int icq_httpGatewayWrapSend(HANDLE hConn, PBYTE buf, int len, int flags);
+int icq_httpGatewayInit(HNETLIBCONN hConn, NETLIBOPENCONNECTION *nloc, NETLIBHTTPREQUEST *nlhr);
+int icq_httpGatewayBegin(HNETLIBCONN hConn, NETLIBOPENCONNECTION *nloc);
+int icq_httpGatewayWrapSend(HNETLIBCONN hConn, PBYTE buf, int len, int flags);
PBYTE icq_httpGatewayUnwrapRecv(NETLIBHTTPREQUEST *nlhr, PBYTE buf, int bufLen, int *outBufLen, void *(*NetlibRealloc)(void *, size_t));
-int icq_httpGatewayWalkTo(HANDLE hConn, NETLIBOPENCONNECTION* nloc);
+int icq_httpGatewayWalkTo(HNETLIBCONN hConn, NETLIBOPENCONNECTION* nloc);
#endif /* __ICQ_HTTP_H */
diff --git a/protocols/IcqOscarJ/src/icq_proto.h b/protocols/IcqOscarJ/src/icq_proto.h
index 7fa039a78b..b15b3cd210 100644
--- a/protocols/IcqOscarJ/src/icq_proto.h
+++ b/protocols/IcqOscarJ/src/icq_proto.h
@@ -400,7 +400,7 @@ struct CIcqProto : public PROTO<CIcqProto>
int GetAvatarData(MCONTACT hContact, DWORD dwUin, const char *szUid, const BYTE *hash, size_t hashlen, const wchar_t *file);
int SetAvatarData(MCONTACT hContact, WORD wRef, const BYTE *data, size_t datalen);
- void StartAvatarThread(HANDLE hConn, char* cookie, size_t cookieLen);
+ void StartAvatarThread(HNETLIBCONN hConn, char* cookie, size_t cookieLen);
void StopAvatarThread();
//----| icq_clients.cpp |-------------------------------------------------------------
@@ -533,7 +533,7 @@ struct CIcqProto : public PROTO<CIcqProto>
int handleRateItem(rates_queue_item *item, int nQueueType = RQT_DEFAULT, int nMinDelay = 0, BOOL bAllowDelay = TRUE);
//----| icq_server.cpp |--------------------------------------------------------------
- HANDLE hServerConn;
+ HNETLIBCONN hServerConn;
WORD wListenPort;
WORD wLocalSequence;
UINT serverThreadId;
@@ -679,7 +679,7 @@ struct CIcqProto : public PROTO<CIcqProto>
//----| stdpackets.cpp |----------------------------------------------------------
void icq_sendCloseConnection();
- void icq_requestnewfamily(WORD wFamily, void (CIcqProto::*familyhandler)(HANDLE hConn, char* cookie, size_t cookieLen));
+ void icq_requestnewfamily(WORD wFamily, void (CIcqProto::*familyhandler)(HNETLIBCONN hConn, char* cookie, size_t cookieLen));
void icq_setidle(int bAllow);
void icq_setstatus(WORD wStatus, const char *szStatusNote = NULL);
@@ -876,7 +876,7 @@ struct CIcqProto : public PROTO<CIcqProto>
void AddToSpammerList(DWORD dwUIN);
BOOL IsOnSpammerList(DWORD dwUIN);
- HANDLE NetLib_BindPort(NETLIBNEWCONNECTIONPROC_V2 pFunc, void* lParam, WORD *pwPort, DWORD *pdwIntIP);
+ HNETLIBBIND NetLib_BindPort(NETLIBNEWCONNECTIONPROC_V2 pFunc, void* lParam, WORD *pwPort, DWORD *pdwIntIP);
MCONTACT HandleFromCacheByUid(DWORD dwUin, const char *szUid);
MCONTACT HContactFromUIN(DWORD dwUin, int *Added);
diff --git a/protocols/IcqOscarJ/src/icq_server.cpp b/protocols/IcqOscarJ/src/icq_server.cpp
index 732c251ec3..27e72224b0 100644
--- a/protocols/IcqOscarJ/src/icq_server.cpp
+++ b/protocols/IcqOscarJ/src/icq_server.cpp
@@ -29,7 +29,7 @@
#include "stdafx.h"
-void icq_newConnectionReceived(HANDLE hNewConnection, DWORD dwRemoteIP, void *pExtra);
+void icq_newConnectionReceived(HNETLIBCONN hNewConnection, DWORD dwRemoteIP, void *pExtra);
/////////////////////////////////////////////////////////////////////////////////////////
// ICQ Server thread
@@ -152,7 +152,8 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam)
NetLib_SafeCloseHandle(&info.hPacketRecver);
// Close DC port
- NetLib_SafeCloseHandle(&info.hDirectBoundPort);
+ Netlib_CloseHandle(info.hDirectBoundPort);
+ info.hDirectBoundPort = NULL;
// disable auto info-update thread
icq_EnableUserLookup(FALSE);
diff --git a/protocols/IcqOscarJ/src/icq_server.h b/protocols/IcqOscarJ/src/icq_server.h
index c3b18d3b8c..aed7013755 100644
--- a/protocols/IcqOscarJ/src/icq_server.h
+++ b/protocols/IcqOscarJ/src/icq_server.h
@@ -56,7 +56,7 @@ struct serverthread_info
bool bMyAvatarInited;
HANDLE hPacketRecver;
- HANDLE hDirectBoundPort;
+ HNETLIBBIND hDirectBoundPort;
};
#endif /* __ICQ_SERVER_H */
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
index 69ca05538a..d563474330 100644
--- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
+++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp
@@ -34,7 +34,7 @@ struct oscarthreadstartinfo
int type;
int incoming;
MCONTACT hContact;
- HANDLE hConnection;
+ HNETLIBCONN hConnection;
DWORD dwRemoteIP;
oscar_filetransfer *ft;
oscar_listener *listener;
@@ -308,8 +308,10 @@ void CIcqProto::ReleaseOscarListener(oscar_listener **pListener)
{
oscar_listener *listener = *pListener;
if (listener) { // Close listening port
- if (listener->hBoundPort)
- NetLib_SafeCloseHandle(&listener->hBoundPort);
+ if (listener->hBoundPort) {
+ Netlib_CloseHandle(listener->hBoundPort);
+ listener->hBoundPort = NULL;
+ }
NetLog_Direct("Oscar listener on port %d released.", listener->wPort);
}
@@ -675,7 +677,7 @@ void CIcqProto::handleRecvServResponseOFT(BYTE *buf, size_t wLen, DWORD dwUin, c
}
// This function is called from the Netlib when someone is connecting to our oscar_listener
-static void oft_newConnectionReceived(HANDLE hNewConnection, DWORD dwRemoteIP, void *pExtra)
+static void oft_newConnectionReceived(HNETLIBCONN hNewConnection, DWORD dwRemoteIP, void *pExtra)
{
oscarthreadstartinfo *otsi = (oscarthreadstartinfo*)SAFE_MALLOC(sizeof(oscarthreadstartinfo));
oscar_listener *listener = (oscar_listener*)pExtra;
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.h b/protocols/IcqOscarJ/src/oscar_filetransfer.h
index 948bc1714d..b01dabd2b0 100644
--- a/protocols/IcqOscarJ/src/oscar_filetransfer.h
+++ b/protocols/IcqOscarJ/src/oscar_filetransfer.h
@@ -123,7 +123,7 @@ void SafeReleaseFileTransfer(void **ft);
struct oscar_connection
{
MCONTACT hContact;
- HANDLE hConnection;
+ HNETLIBCONN hConnection;
int status;
DWORD dwUin;
uid_str szUid;
@@ -154,7 +154,7 @@ struct oscar_listener
{
CIcqProto *ppro;
WORD wPort;
- HANDLE hBoundPort;
+ HNETLIBBIND hBoundPort;
oscar_filetransfer *ft;
};
diff --git a/protocols/IcqOscarJ/src/stdpackets.cpp b/protocols/IcqOscarJ/src/stdpackets.cpp
index 8a66eeb085..835cd5e26f 100644
--- a/protocols/IcqOscarJ/src/stdpackets.cpp
+++ b/protocols/IcqOscarJ/src/stdpackets.cpp
@@ -196,7 +196,7 @@ void CIcqProto::icq_sendCloseConnection()
sendServPacket(&packet);
}
-void CIcqProto::icq_requestnewfamily(WORD wFamily, void (CIcqProto::*familyhandler)(HANDLE hConn, char* cookie, size_t cookieLen))
+void CIcqProto::icq_requestnewfamily(WORD wFamily, void (CIcqProto::*familyhandler)(HNETLIBCONN hConn, char* cookie, size_t cookieLen))
{
int bRequestSSL = m_bSecureConnection && (wFamily != ICQ_AVATAR_FAMILY); // Avatar servers does not support SSL
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp
index 85a34e4238..d4d7c0a885 100644
--- a/protocols/IcqOscarJ/src/utilities.cpp
+++ b/protocols/IcqOscarJ/src/utilities.cpp
@@ -1361,7 +1361,7 @@ DWORD ICQWaitForSingleObject(HANDLE hObject, DWORD dwMilliseconds, int bWaitAlwa
}
-HANDLE NetLib_OpenConnection(HNETLIBUSER hUser, const char* szIdent, NETLIBOPENCONNECTION* nloc)
+HNETLIBCONN NetLib_OpenConnection(HNETLIBUSER hUser, const char* szIdent, NETLIBOPENCONNECTION* nloc)
{
Netlib_Logf(hUser, "%sConnecting to %s:%u", szIdent ? szIdent : "", nloc->szHost, nloc->wPort);
@@ -1371,15 +1371,14 @@ HANDLE NetLib_OpenConnection(HNETLIBUSER hUser, const char* szIdent, NETLIBOPENC
}
-HANDLE CIcqProto::NetLib_BindPort(NETLIBNEWCONNECTIONPROC_V2 pFunc, void* lParam, WORD* pwPort, DWORD* pdwIntIP)
+HNETLIBBIND CIcqProto::NetLib_BindPort(NETLIBNEWCONNECTIONPROC_V2 pFunc, void* lParam, WORD* pwPort, DWORD* pdwIntIP)
{
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 = Netlib_BindPort(m_hDirectNetlibUser, &nlb);
+ HNETLIBBIND hBoundPort = Netlib_BindPort(m_hDirectNetlibUser, &nlb);
if (pwPort) *pwPort = nlb.wPort;
if (pdwIntIP) *pdwIntIP = nlb.dwInternalIP;
@@ -1388,10 +1387,11 @@ HANDLE CIcqProto::NetLib_BindPort(NETLIBNEWCONNECTIONPROC_V2 pFunc, void* lParam
}
-void NetLib_CloseConnection(HANDLE *hConnection, int bServerConn)
+void NetLib_CloseConnection(HNETLIBCONN *hConnection, int bServerConn)
{
if (*hConnection) {
- NetLib_SafeCloseHandle(hConnection);
+ Netlib_CloseHandle(*hConnection);
+ *hConnection = NULL;
if (bServerConn)
FreeGatewayIndex(*hConnection);
diff --git a/protocols/IcqOscarJ/src/utilities.h b/protocols/IcqOscarJ/src/utilities.h
index ad5907c1bb..fcdcf9a6d8 100644
--- a/protocols/IcqOscarJ/src/utilities.h
+++ b/protocols/IcqOscarJ/src/utilities.h
@@ -95,9 +95,9 @@ __inline static void SAFE_FREE(WCHAR** str) { SAFE_FREE((void**)str); }
DWORD ICQWaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds, int bWaitAlways = FALSE);
-HANDLE NetLib_OpenConnection(HNETLIBUSER hUser, const char* szIdent, NETLIBOPENCONNECTION* nloc);
-void NetLib_CloseConnection(HANDLE *hConnection, int bServerConn);
-void NetLib_SafeCloseHandle(HANDLE *hConnection);
+HNETLIBCONN NetLib_OpenConnection(HNETLIBUSER hUser, const char* szIdent, NETLIBOPENCONNECTION* nloc);
+void NetLib_CloseConnection(HNETLIBCONN *hConnection, int bServerConn);
+void NetLib_SafeCloseHandle(HANDLE *);
char* __fastcall ICQTranslateUtf(const char *src);
char* __fastcall ICQTranslateUtfStatic(const char *src, char *buf, size_t bufsize);
diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp
index 95a9976176..512c67197c 100644
--- a/protocols/JabberG/src/jabber_byte.cpp
+++ b/protocols/JabberG/src/jabber_byte.cpp
@@ -80,7 +80,7 @@ void CJabberProto::IqResultProxyDiscovery(HXML iqNode, CJabberIqInfo *pInfo)
SetEvent(jbt->hProxyEvent);
}
-void JabberByteSendConnection(HANDLE hConn, DWORD /*dwRemoteIP*/, void* extra)
+void JabberByteSendConnection(HNETLIBCONN hConn, DWORD /*dwRemoteIP*/, void* extra)
{
CJabberProto *ppro = (CJabberProto*)extra;
wchar_t szPort[8];
@@ -193,7 +193,6 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt)
localAddr = getStringA("BsDirectAddr");
NETLIBBIND nlb = {};
- nlb.cbSize = sizeof(NETLIBBIND);
nlb.pfnNewConnectionV2 = JabberByteSendConnection;
nlb.pExtra = this;
nlb.wPort = 0; // Use user-specified incoming port ranges, if available
@@ -315,7 +314,7 @@ void CJabberProto::ByteInitiateResult(HXML iqNode, CJabberIqInfo *pInfo)
SetEvent(jbt->hProxyEvent);
}
-int CJabberProto::ByteSendParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, char* buffer, int datalen)
+int CJabberProto::ByteSendParse(HNETLIBCONN hConn, JABBER_BYTE_TRANSFER *jbt, char* buffer, int datalen)
{
int nMethods;
BYTE data[10];
@@ -428,7 +427,6 @@ void CJabberProto::ByteSendViaProxy(JABBER_BYTE_TRANSFER *jbt)
{
wchar_t *szHost, *szPort;
WORD port;
- HANDLE hConn;
char data[3];
char* buffer;
int datalen, bytesParsed, recvResult;
@@ -454,7 +452,7 @@ void CJabberProto::ByteSendViaProxy(JABBER_BYTE_TRANSFER *jbt)
nloc.cbSize = sizeof(nloc);
nloc.szHost = mir_u2a(szHost);
nloc.wPort = port;
- hConn = Netlib_OpenConnection(m_hNetlibUser, &nloc);
+ HNETLIBCONN hConn = Netlib_OpenConnection(m_hNetlibUser, &nloc);
mir_free((void*)nloc.szHost);
if (hConn != NULL) {
@@ -490,7 +488,7 @@ void CJabberProto::ByteSendViaProxy(JABBER_BYTE_TRANSFER *jbt)
<< XCHILDNS(L"item-not-found", L"urn:ietf:params:xml:ns:xmpp-stanzas"));
}
-int CJabberProto::ByteSendProxyParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, char* buffer, int datalen)
+int CJabberProto::ByteSendProxyParse(HNETLIBCONN hConn, JABBER_BYTE_TRANSFER *jbt, char* buffer, int datalen)
{
int num = datalen;
@@ -593,7 +591,6 @@ void __cdecl CJabberProto::ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt)
const wchar_t *sid = NULL, *from = NULL, *to = NULL, *szId = NULL, *szHost, *szPort, *str;
int i;
WORD port;
- HANDLE hConn;
char data[3];
char* buffer;
int datalen, bytesParsed, recvResult;
@@ -634,7 +631,7 @@ void __cdecl CJabberProto::ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt)
nloc.cbSize = sizeof(nloc);
nloc.szHost = mir_u2a(szHost);
nloc.wPort = port;
- hConn = Netlib_OpenConnection(m_hNetlibUser, &nloc);
+ HNETLIBCONN hConn = Netlib_OpenConnection(m_hNetlibUser, &nloc);
mir_free((void*)nloc.szHost);
if (hConn == NULL) {
@@ -686,7 +683,7 @@ void __cdecl CJabberProto::ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt)
debugLogA("Thread ended: type=bytestream_recv");
}
-int CJabberProto::ByteReceiveParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, char* buffer, int datalen)
+int CJabberProto::ByteReceiveParse(HNETLIBCONN hConn, JABBER_BYTE_TRANSFER *jbt, char* buffer, int datalen)
{
int bytesReceived, num = datalen;
diff --git a/protocols/JabberG/src/jabber_byte.h b/protocols/JabberG/src/jabber_byte.h
index 3b6b8423b3..b89c12a711 100644
--- a/protocols/JabberG/src/jabber_byte.h
+++ b/protocols/JabberG/src/jabber_byte.h
@@ -44,8 +44,8 @@ struct JABBER_BYTE_TRANSFER
HANDLE hConn;
HANDLE hEvent;
HXML iqNode;
- BOOL (CJabberProto::*pfnSend)(HANDLE hConn, filetransfer *ft);
- int (CJabberProto::*pfnRecv)(HANDLE hConn, filetransfer *ft, char* buffer, int datalen);
+ BOOL (CJabberProto::*pfnSend)(HNETLIBCONN hConn, filetransfer *ft);
+ int (CJabberProto::*pfnRecv)(HNETLIBCONN hConn, filetransfer *ft, char* buffer, int datalen);
void (CJabberProto::*pfnFinal)(BOOL success, filetransfer *ft);
filetransfer *ft;
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp
index 2ac8d9b0c3..0d9904899f 100644
--- a/protocols/JabberG/src/jabber_file.cpp
+++ b/protocols/JabberG/src/jabber_file.cpp
@@ -171,7 +171,7 @@ int CJabberProto::FileReceiveParse(filetransfer *ft, char* buffer, int datalen)
return num;
}
-void JabberFileServerConnection(JABBER_SOCKET hConnection, DWORD /*dwRemoteIP*/, void* extra)
+void JabberFileServerConnection(HNETLIBCONN hConnection, DWORD /*dwRemoteIP*/, void* extra)
{
CJabberProto *ppro = (CJabberProto*)extra;
@@ -190,7 +190,7 @@ void JabberFileServerConnection(JABBER_SOCKET hConnection, DWORD /*dwRemoteIP*/,
}
filetransfer *ft = item->ft;
- JABBER_SOCKET slisten = ft->s;
+ HNETLIBCONN slisten = ft->s;
ft->s = hConnection;
ppro->debugLogA("Set ft->s to %d (saving %d)", hConnection, slisten);
@@ -241,12 +241,11 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft)
ft->type = FT_OOB;
NETLIBBIND nlb = {};
- nlb.cbSize = sizeof(NETLIBBIND);
nlb.pfnNewConnectionV2 = JabberFileServerConnection;
nlb.pExtra = this;
nlb.wPort = 0; // Use user-specified incoming port ranges, if available
- info.s = Netlib_BindPort(m_hNetlibUser, &nlb);
+ info.s = (HNETLIBCONN)Netlib_BindPort(m_hNetlibUser, &nlb);
if (info.s == NULL) {
debugLogA("Cannot allocate port to bind for file server thread, thread ended.");
ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
@@ -341,7 +340,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft)
delete ft;
}
-int CJabberProto::FileSendParse(JABBER_SOCKET s, filetransfer *ft, char* buffer, int datalen)
+int CJabberProto::FileSendParse(HNETLIBCONN s, filetransfer *ft, char* buffer, int datalen)
{
char* p, *q, *eob;
char* str;
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp
index 76f3c99cac..eb34f5afe4 100644
--- a/protocols/JabberG/src/jabber_ft.cpp
+++ b/protocols/JabberG/src/jabber_ft.cpp
@@ -180,7 +180,7 @@ void CJabberProto::OnFtSiResult(HXML iqNode, CJabberIqInfo *pInfo)
}
}
-BOOL CJabberProto::FtSend(HANDLE hConn, filetransfer *ft)
+BOOL CJabberProto::FtSend(HNETLIBCONN hConn, filetransfer *ft)
{
struct _stati64 statbuf;
int fd;
@@ -532,7 +532,7 @@ BOOL CJabberProto::FtHandleIbbRequest(HXML iqNode, BOOL bOpen)
return FALSE;
}
-int CJabberProto::FtReceive(HANDLE, filetransfer *ft, char* buffer, int datalen)
+int CJabberProto::FtReceive(HNETLIBCONN, filetransfer *ft, char* buffer, int datalen)
{
if (ft->create() == -1)
return -1;
diff --git a/protocols/JabberG/src/jabber_ibb.h b/protocols/JabberG/src/jabber_ibb.h
index 6680829881..a835ecaa94 100644
--- a/protocols/JabberG/src/jabber_ibb.h
+++ b/protocols/JabberG/src/jabber_ibb.h
@@ -39,7 +39,7 @@ typedef struct {
BOOL bStreamClosed;
WORD wPacketId;
BOOL (CJabberProto::*pfnSend)(int blocksize, filetransfer *ft);
- int (CJabberProto::*pfnRecv)(HANDLE hConn, filetransfer *ft, char* buffer, int datalen);
+ int (CJabberProto::*pfnRecv)(HNETLIBCONN hConn, filetransfer *ft, char* buffer, int datalen);
void (CJabberProto::*pfnFinal)(BOOL success, filetransfer *ft);
filetransfer *ft;
}
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index 9eb9640ea6..f62d73c528 100644
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -303,10 +303,10 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
void IqResultProxyDiscovery(HXML iqNode, CJabberIqInfo *pInfo);
void ByteInitiateResult(HXML iqNode, CJabberIqInfo *pInfo);
void ByteSendViaProxy(JABBER_BYTE_TRANSFER *jbt);
- int ByteSendParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, char* buffer, int datalen);
+ int ByteSendParse(HNETLIBCONN hConn, JABBER_BYTE_TRANSFER *jbt, char* buffer, int datalen);
void IqResultStreamActivate(HXML iqNode, CJabberIqInfo *pInfo);
- int ByteReceiveParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, char* buffer, int datalen);
- int ByteSendProxyParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, char* buffer, int datalen);
+ int ByteReceiveParse(HNETLIBCONN hConn, JABBER_BYTE_TRANSFER *jbt, char* buffer, int datalen);
+ int ByteSendProxyParse(HNETLIBCONN hConn, JABBER_BYTE_TRANSFER *jbt, char* buffer, int datalen);
//---- jabber_caps.cpp ---------------------------------------------------------------
@@ -378,7 +378,7 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
//---- jabber_file.cpp ---------------------------------------------------------------
int FileReceiveParse(filetransfer *ft, char* buffer, int datalen);
- int FileSendParse(JABBER_SOCKET s, filetransfer *ft, char* buffer, int datalen);
+ int FileSendParse(HNETLIBCONN s, filetransfer *ft, char* buffer, int datalen);
void UpdateChatUserStatus(wchar_t* chat_jid, wchar_t* jid, wchar_t* nick, int role, int affil, int status, BOOL update_nick);
@@ -498,9 +498,9 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
void OnFtSiResult(HXML iqNode, CJabberIqInfo *pInfo);
BOOL FtIbbSend(int blocksize, filetransfer *ft);
- BOOL FtSend(HANDLE hConn, filetransfer *ft);
+ BOOL FtSend(HNETLIBCONN hConn, filetransfer *ft);
void FtSendFinal(BOOL success, filetransfer *ft);
- int FtReceive(HANDLE hConn, filetransfer *ft, char* buffer, int datalen);
+ int FtReceive(HNETLIBCONN hConn, filetransfer *ft, char* buffer, int datalen);
void FtReceiveFinal(BOOL success, filetransfer *ft);
//---- jabber_iqid.cpp ---------------------------------------------------------------
@@ -765,12 +765,12 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
//---- jabber_ws.c -------------------------------------------------
- JABBER_SOCKET WsConnect(char* host, WORD port);
+ HNETLIBCONN WsConnect(char* host, WORD port);
BOOL WsInit(void);
void WsUninit(void);
- int WsSend(JABBER_SOCKET s, char* data, int datalen, int flags);
- int WsRecv(JABBER_SOCKET s, char* data, long datalen, int flags);
+ int WsSend(HNETLIBCONN s, char* data, int datalen, int flags);
+ int WsRecv(HNETLIBCONN s, char* data, long datalen, int flags);
//---- jabber_xml.c ------------------------------------------------------------------
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index 86850775aa..11185bd6b4 100644
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -889,7 +889,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param)
Thread_SetName("Jabber: LoadHttpAvatars");
OBJLIST<JABBER_HTTP_AVATARS> &avs = *(OBJLIST<JABBER_HTTP_AVATARS>*)param;
- HANDLE hHttpCon = NULL;
+ HNETLIBCONN hHttpCon = NULL;
for (int i = 0; i < avs.getCount(); i++) {
NETLIBHTTPREQUEST nlhr = { 0 };
nlhr.cbSize = sizeof(nlhr);
diff --git a/protocols/JabberG/src/jabber_ws.cpp b/protocols/JabberG/src/jabber_ws.cpp
index 92dab17061..db491e365b 100644
--- a/protocols/JabberG/src/jabber_ws.cpp
+++ b/protocols/JabberG/src/jabber_ws.cpp
@@ -45,7 +45,7 @@ void CJabberProto::WsUninit(void)
m_hNetlibUser = NULL;
}
-JABBER_SOCKET CJabberProto::WsConnect(char* host, WORD port)
+HNETLIBCONN CJabberProto::WsConnect(char* host, WORD port)
{
NETLIBOPENCONNECTION nloc = {};
nloc.cbSize = sizeof(nloc);
@@ -55,7 +55,7 @@ JABBER_SOCKET CJabberProto::WsConnect(char* host, WORD port)
return Netlib_OpenConnection(m_hNetlibUser, &nloc);
}
-int CJabberProto::WsSend(JABBER_SOCKET hConn, char* data, int datalen, int flags)
+int CJabberProto::WsSend(HNETLIBCONN hConn, char* data, int datalen, int flags)
{
m_lastTicks = ::GetTickCount();
int len;
@@ -67,7 +67,7 @@ int CJabberProto::WsSend(JABBER_SOCKET hConn, char* data, int datalen, int flags
return len;
}
-int CJabberProto::WsRecv(JABBER_SOCKET hConn, char* data, long datalen, int flags)
+int CJabberProto::WsRecv(HNETLIBCONN hConn, char* data, long datalen, int flags)
{
int ret;
diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h
index 1d09f4d866..df2533fbfc 100644
--- a/protocols/JabberG/src/stdafx.h
+++ b/protocols/JabberG/src/stdafx.h
@@ -336,7 +336,6 @@ struct CJabberHttpAuthParams
/*******************************************************************
* Global data structures and data type definitions
*******************************************************************/
-typedef HANDLE JABBER_SOCKET;
#define CAPS_BOOKMARK 0x0001
#define CAPS_BOOKMARKS_LOADED 0x8000
@@ -371,7 +370,7 @@ struct ThreadData
char* buffer;
// network support
- JABBER_SOCKET s;
+ HNETLIBCONN s;
HANDLE iomutex; // protects i/o operations
CJabberProto *proto;
@@ -442,7 +441,7 @@ struct filetransfer
PROTOFILETRANSFERSTATUS std;
JABBER_FT_TYPE type;
- JABBER_SOCKET s;
+ HNETLIBCONN s;
JABBER_FILE_STATE state;
wchar_t *jid;
int fileId;
diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp
index 20d7cb9770..de646f2c2a 100644
--- a/protocols/MRA/src/MraAvatars.cpp
+++ b/protocols/MRA/src/MraAvatars.cpp
@@ -37,14 +37,14 @@ struct MRA_AVATARS_QUEUE_ITEM : public FIFO_MT_ITEM
char szAvtSectName[MAX_PATH];
#define MRA_AVT_SECT_NAME szAvtSectName
-HANDLE MraAvatarsHttpConnect(HNETLIBUSER hNetlibUser, LPCSTR lpszHost, DWORD dwPort);
+HNETLIBCONN MraAvatarsHttpConnect(HNETLIBUSER hNetlibUser, LPCSTR lpszHost, DWORD dwPort);
#define MAHTRO_AVT 0
#define MAHTRO_AVTMRIM 1
#define MAHTRO_AVTSMALL 2
#define MAHTRO_AVTSMALLMRIM 3
-DWORD MraAvatarsHttpTransaction(HANDLE hConnection, DWORD dwRequestType, LPCSTR lpszUser, LPCSTR lpszDomain, LPCSTR lpszHost, DWORD dwReqObj, BOOL bUseKeepAliveConn, DWORD *pdwResultCode, BOOL *pbKeepAlive, DWORD *pdwFormat, size_t *pdwAvatarSize, INTERNET_TIME *pitLastModifiedTime);
+DWORD MraAvatarsHttpTransaction(HNETLIBCONN hConnection, DWORD dwRequestType, LPCSTR lpszUser, LPCSTR lpszDomain, LPCSTR lpszHost, DWORD dwReqObj, BOOL bUseKeepAliveConn, DWORD *pdwResultCode, BOOL *pbKeepAlive, DWORD *pdwFormat, size_t *pdwAvatarSize, INTERNET_TIME *pitLastModifiedTime);
DWORD CMraProto::MraAvatarsQueueInitialize(HANDLE *phAvatarsQueueHandle)
{
@@ -152,7 +152,7 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter)
size_t dwAvatarSizeServer;
FILETIME ftLastModifiedTimeServer, ftLastModifiedTimeLocal;
SYSTEMTIME stAvatarLastModifiedTimeLocal;
- HANDLE hConnection = NULL;
+ HNETLIBCONN hConnection = NULL;
NETLIBSELECT nls = { 0 };
INTERNET_TIME itAvatarLastModifiedTimeServer;
WCHAR szErrorText[2048];
@@ -331,7 +331,7 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter)
CloseHandle(hThreadEvent);
}
-HANDLE MraAvatarsHttpConnect(HNETLIBUSER hNetlibUser, LPCSTR lpszHost, DWORD dwPort)
+HNETLIBCONN MraAvatarsHttpConnect(HNETLIBUSER hNetlibUser, LPCSTR lpszHost, DWORD dwPort)
{
NETLIBOPENCONNECTION nloc = { 0 };
nloc.cbSize = sizeof(nloc);
@@ -344,7 +344,7 @@ HANDLE MraAvatarsHttpConnect(HNETLIBUSER hNetlibUser, LPCSTR lpszHost, DWORD dwP
DWORD dwConnectReTryCount = db_get_dw(NULL, MRA_AVT_SECT_NAME, "ConnectReTryCount", MRA_AVT_DEFAULT_CONN_RETRY_COUNT);
DWORD dwCurConnectReTryCount = dwConnectReTryCount;
- HANDLE hConnection;
+ HNETLIBCONN hConnection;
do {
hConnection = Netlib_OpenConnection(hNetlibUser, &nloc);
}
@@ -353,7 +353,7 @@ HANDLE MraAvatarsHttpConnect(HNETLIBUSER hNetlibUser, LPCSTR lpszHost, DWORD dwP
return hConnection;
}
-DWORD MraAvatarsHttpTransaction(HANDLE hConnection, DWORD dwRequestType, LPCSTR lpszUser, LPCSTR lpszDomain, LPCSTR lpszHost, DWORD dwReqObj, BOOL bUseKeepAliveConn, DWORD *pdwResultCode, BOOL *pbKeepAlive, DWORD *pdwFormat, size_t *pdwAvatarSize, INTERNET_TIME *pitLastModifiedTime)
+DWORD MraAvatarsHttpTransaction(HNETLIBCONN hConnection, DWORD dwRequestType, LPCSTR lpszUser, LPCSTR lpszDomain, LPCSTR lpszHost, DWORD dwReqObj, BOOL bUseKeepAliveConn, DWORD *pdwResultCode, BOOL *pbKeepAlive, DWORD *pdwFormat, size_t *pdwAvatarSize, INTERNET_TIME *pitLastModifiedTime)
{
if (pdwResultCode) *pdwResultCode = 0;
if (pbKeepAlive) *pbKeepAlive = FALSE;
diff --git a/protocols/MRA/src/MraFilesQueue.cpp b/protocols/MRA/src/MraFilesQueue.cpp
index 9b062e46c7..edf341a755 100644
--- a/protocols/MRA/src/MraFilesQueue.cpp
+++ b/protocols/MRA/src/MraFilesQueue.cpp
@@ -37,7 +37,7 @@ struct MRA_FILES_QUEUE_ITEM : public LIST_MT_ITEM
LPWSTR lpwszPath;
size_t dwPathSize;
bool bSending;
- HANDLE hConnection;
+ HNETLIBCONN hConnection;
HANDLE hListen;
HANDLE hThread;
HANDLE hWaitHandle;
@@ -378,7 +378,7 @@ DWORD CMraProto::MraFilesQueueSendMirror(HANDLE hQueue, DWORD dwIDRequest, const
return dwRetErrorCode;
}
-bool CMraProto::MraFilesQueueHandCheck(HANDLE hConnection, MRA_FILES_QUEUE_ITEM *dat)
+bool CMraProto::MraFilesQueueHandCheck(HNETLIBCONN hConnection, MRA_FILES_QUEUE_ITEM *dat)
{
if (hConnection && dat) {
BYTE btBuff[((MAX_EMAIL_LEN * 2) + (sizeof(MRA_FT_HELLO)* 2) + 8)] = { 0 };
@@ -522,7 +522,6 @@ HANDLE CMraProto::MraFilesQueueConnectIn(MRA_FILES_QUEUE_ITEM *dat)
// êîïèðóåì àäðåñà â ñîîòâåòñòâèè ñ ïðàâèëàìè è íà÷èíàåì ñëóøàòü ïîðò
if (getByte("FileSendEnableDirectConn", MRA_DEF_FS_ENABLE_DIRECT_CONN)) {
NETLIBBIND nlbBind = {};
- nlbBind.cbSize = sizeof(nlbBind);
nlbBind.pfnNewConnectionV2 = MraFilesQueueConnectionReceived;
nlbBind.wPort = 0;
nlbBind.pExtra = (LPVOID)dat;
@@ -587,7 +586,7 @@ HANDLE CMraProto::MraFilesQueueConnectIn(MRA_FILES_QUEUE_ITEM *dat)
// This function is called from the Netlib when someone is connecting to
// one of our incomming DC ports
-void MraFilesQueueConnectionReceived(HANDLE hNewConnection, DWORD dwRemoteIP, void *pExtra)
+void MraFilesQueueConnectionReceived(HNETLIBCONN hNewConnection, DWORD dwRemoteIP, void *pExtra)
{
if (pExtra) {
MRA_FILES_QUEUE_ITEM *dat = (MRA_FILES_QUEUE_ITEM*)pExtra;
diff --git a/protocols/MRA/src/MraFilesQueue.h b/protocols/MRA/src/MraFilesQueue.h
index dbcba782cf..c833c02fa5 100644
--- a/protocols/MRA/src/MraFilesQueue.h
+++ b/protocols/MRA/src/MraFilesQueue.h
@@ -8,7 +8,7 @@ INT_PTR CALLBACK MraFilesQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam,
DWORD MraFilesQueueInitialize(DWORD dwFilesTimeOutInterval, HANDLE *phFilesQueueHandle);
void MraFilesQueueDestroy(HANDLE hFilesQueueHandle);
-void MraFilesQueueConnectionReceived(HANDLE hNewConnection, DWORD dwRemoteIP, void *pExtra);
+void MraFilesQueueConnectionReceived(HNETLIBCONN hNewConnection, DWORD dwRemoteIP, void *pExtra);
HANDLE MraFilesQueueItemProxyByID(HANDLE hFilesQueueHandle, DWORD dwIDRequest);
DWORD MraFilesQueueStartMrimProxy(HANDLE hFilesQueueHandle, DWORD dwIDRequest);
diff --git a/protocols/MRA/src/MraMRIMProxy.cpp b/protocols/MRA/src/MraMRIMProxy.cpp
index f29fd6e0e8..1f9aa28733 100644
--- a/protocols/MRA/src/MraMRIMProxy.cpp
+++ b/protocols/MRA/src/MraMRIMProxy.cpp
@@ -11,7 +11,7 @@ struct MRA_MRIMPROXY_DATA
size_t dwUserDataSize;
MRA_ADDR_LIST malAddrList; // LPS lps_ip_port
MRA_GUID mguidSessionID; // DWORD session_id[4]
- HANDLE hConnection;
+ HNETLIBCONN hConnection;
HANDLE hWaitHandle; // internal
};
@@ -69,7 +69,7 @@ void MraMrimProxyCloseConnection(HANDLE hMraMrimProxyData)
}
}
-DWORD CMraProto::MraMrimProxyConnect(HANDLE hMraMrimProxyData, HANDLE *phConnection)
+DWORD CMraProto::MraMrimProxyConnect(HANDLE hMraMrimProxyData, HNETLIBCONN *phConnection)
{
DWORD dwRetErrorCode;
diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h
index e9167e1879..89b969790b 100644
--- a/protocols/MRA/src/MraProto.h
+++ b/protocols/MRA/src/MraProto.h
@@ -166,7 +166,7 @@ struct CMraProto : public PROTO<CMraProto>
HANDLE hSendQueueHandle, hFilesQueueHandle, hMPopSessionQueue;
HANDLE m_heNudgeReceived;
- HANDLE m_hConnection;
+ HNETLIBCONN m_hConnection;
DWORD m_dwNextPingSendTickTime;
DWORD m_dwPingPeriod;
volatile DWORD m_dwThreadWorkerLastPingTime;
@@ -215,7 +215,7 @@ struct CMraProto : public PROTO<CMraProto>
DWORD MraProxyAck(DWORD dwStatus, const CMStringA &szEmail, DWORD dwIDRequest, DWORD dwDataType, const CMStringA &lpszData, const CMStringA &szAddresses, MRA_GUID mguidSessionID);
DWORD MraChangeUserBlogStatus(DWORD dwFlags, const CMStringW &wszText, DWORDLONG dwBlogStatusID);
- DWORD MraSendPacket(HANDLE hConnection, DWORD dwCMDNum, DWORD dwType, LPVOID lpData, size_t dwDataSize);
+ DWORD MraSendPacket(HNETLIBCONN hConnection, DWORD dwCMDNum, DWORD dwType, LPVOID lpData, size_t dwDataSize);
DWORD MraSendCMD(DWORD dwType, LPVOID lpData, size_t dwDataSize);
DWORD MraSendQueueCMD(HANDLE hSendQueueHandle, DWORD dwFlags, MCONTACT hContact, DWORD dwAckType, LPBYTE lpbDataQueue, size_t dwDataQueueSize, DWORD dwType, LPVOID lpData, size_t dwDataSize);
@@ -289,7 +289,7 @@ struct CMraProto : public PROTO<CMraProto>
bool MraSendReplyBlogStatus(MCONTACT hContact);
DWORD MraSelectEMailDlgShow(MCONTACT hContact, DWORD dwType);
- DWORD MraMrimProxyConnect(HANDLE hMraMrimProxyData, HANDLE *phConnection);
+ DWORD MraMrimProxyConnect(HANDLE hMraMrimProxyData, HNETLIBCONN *phConnection);
DWORD MraMPopSessionQueueAddUrl(HANDLE hMPopSessionQueue, const CMStringA &szUrl);
DWORD MraMPopSessionQueueAddUrlAndEMail(HANDLE hMPopSessionQueue, const CMStringA &, CMStringA &szEmail);
@@ -302,7 +302,7 @@ struct CMraProto : public PROTO<CMraProto>
DWORD MraFilesQueueCancel(HANDLE hFilesQueueHandle, DWORD dwIDRequest, BOOL bSendDecline);
DWORD MraFilesQueueStartMrimProxy(HANDLE hFilesQueueHandle, DWORD dwIDRequest);
DWORD MraFilesQueueSendMirror(HANDLE hFilesQueueHandle, DWORD dwIDRequest, const CMStringA &szAddresses);
- bool MraFilesQueueHandCheck(HANDLE hConnection, MRA_FILES_QUEUE_ITEM *pmrafqFilesQueueItem);
+ bool MraFilesQueueHandCheck(HNETLIBCONN hConnection, MRA_FILES_QUEUE_ITEM *pmrafqFilesQueueItem);
HANDLE MraFilesQueueConnectOut(MRA_FILES_QUEUE_ITEM *pmrafqFilesQueueItem);
HANDLE MraFilesQueueConnectIn(MRA_FILES_QUEUE_ITEM *pmrafqFilesQueueItem);
DWORD MraFilesQueueAccept(HANDLE hFilesQueueHandle, DWORD dwIDRequest, LPCWSTR lpwszPath, size_t dwPathSize);
diff --git a/protocols/MRA/src/MraSendCommand.cpp b/protocols/MRA/src/MraSendCommand.cpp
index f5c9849e9f..7fdbfb361f 100644
--- a/protocols/MRA/src/MraSendCommand.cpp
+++ b/protocols/MRA/src/MraSendCommand.cpp
@@ -498,7 +498,7 @@ DWORD CMraProto::MraChangeUserBlogStatus(DWORD dwFlags, const CMStringW &wszText
return MraSendCMD(MRIM_CS_CHANGE_USER_BLOG_STATUS, buf.Data(), buf.Len());
}
-DWORD CMraProto::MraSendPacket(HANDLE hConnection, DWORD dwCmdNum, DWORD dwType, LPVOID lpData, size_t dwDataSize)
+DWORD CMraProto::MraSendPacket(HNETLIBCONN hConnection, DWORD dwCmdNum, DWORD dwType, LPVOID lpData, size_t dwDataSize)
{
LPBYTE lpbData = (LPBYTE)_alloca(dwDataSize + sizeof(mrim_packet_header_t));
diff --git a/protocols/MSN/src/msn_http.cpp b/protocols/MSN/src/msn_http.cpp
index f280daa823..243b7b6967 100644
--- a/protocols/MSN/src/msn_http.cpp
+++ b/protocols/MSN/src/msn_http.cpp
@@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdafx.h"
#include "msn_proto.h"
-static ThreadData* FindThreadConn(HANDLE hConn)
+static ThreadData* FindThreadConn(HNETLIBCONN hConn)
{
ThreadData *res = NULL;
for (int i = 0; i < g_Instances.getCount() && res == NULL; ++i)
@@ -36,7 +36,7 @@ static ThreadData* FindThreadConn(HANDLE hConn)
// Fake function - it does nothing but confirms successful session initialization
//=======================================================================================
-int msn_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION*, NETLIBHTTPREQUEST*)
+int msn_httpGatewayInit(HNETLIBCONN hConn, NETLIBOPENCONNECTION*, NETLIBHTTPREQUEST*)
{
NETLIBHTTPPROXYINFO nlhpi = {};
nlhpi.szHttpGetUrl = NULL;
@@ -51,7 +51,7 @@ int msn_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION*, NETLIBHTTPREQUEST*)
// function generates the initial URL depending on a thread type
//=======================================================================================
-int msn_httpGatewayWrapSend(HANDLE hConn, PBYTE buf, int len, int flags)
+int msn_httpGatewayWrapSend(HNETLIBCONN hConn, PBYTE buf, int len, int flags)
{
ThreadData *T = FindThreadConn(hConn);
if (T != NULL) {
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp
index a938b42be9..b93d1a1903 100644
--- a/protocols/MSN/src/msn_proto.cpp
+++ b/protocols/MSN/src/msn_proto.cpp
@@ -23,10 +23,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
static const COLORREF crCols[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
-int msn_httpGatewayInit(HANDLE hConn,NETLIBOPENCONNECTION *nloc,NETLIBHTTPREQUEST *nlhr);
-int msn_httpGatewayBegin(HANDLE hConn,NETLIBOPENCONNECTION *nloc);
-int msn_httpGatewayWrapSend(HANDLE hConn,PBYTE buf,int len,int flags);
-PBYTE msn_httpGatewayUnwrapRecv(NETLIBHTTPREQUEST *nlhr,PBYTE buf,int len,int *outBufLen,void *(*NetlibRealloc)(void*,size_t));
+int msn_httpGatewayInit(HNETLIBCONN hConn, NETLIBOPENCONNECTION *nloc, NETLIBHTTPREQUEST *nlhr);
+int msn_httpGatewayBegin(HNETLIBCONN hConn, NETLIBOPENCONNECTION *nloc);
+int msn_httpGatewayWrapSend(HNETLIBCONN hConn, PBYTE buf, int len, int flags);
+PBYTE msn_httpGatewayUnwrapRecv(NETLIBHTTPREQUEST *nlhr, PBYTE buf, int len, int *outBufLen, void *(*NetlibRealloc)(void*, size_t));
static int CompareLists(const MsnContact *p1, const MsnContact *p2)
{
@@ -541,7 +541,7 @@ void __cdecl CMsnProto::MsnFileAckThread(void* arg)
if (nloc.flags & NLOCF_SSL)
nlhr.flags |= NLHRF_SSL;
- HANDLE nlc = Netlib_OpenConnection(m_hNetlibUser, &nloc);
+ HNETLIBCONN nlc = Netlib_OpenConnection(m_hNetlibUser, &nloc);
if (nlc && Netlib_SendHttpRequest(nlc, &nlhr) != SOCKET_ERROR && (nlhrReply = Netlib_RecvHttpHeaders(nlc))) {
if (nlhrReply->resultCode == 200 || nlhrReply->resultCode == 206) {
INT_PTR dw;
diff --git a/protocols/MSN/src/msn_proto.h b/protocols/MSN/src/msn_proto.h
index 5f75cb3ea1..e210889035 100644
--- a/protocols/MSN/src/msn_proto.h
+++ b/protocols/MSN/src/msn_proto.h
@@ -184,7 +184,7 @@ struct CMsnProto : public PROTO<CMsnProto>
HANDLE msnSearchId;
HNETLIBUSER hNetlibUserHttps;
- HANDLE hHttpsConnection;
+ HNETLIBCONN hHttpsConnection;
HANDLE hMSNNudge;
HANDLE hPopupError, hPopupHotmail, hPopupNotify;
diff --git a/protocols/MSN/src/msn_threads.cpp b/protocols/MSN/src/msn_threads.cpp
index c3888ba028..a7a65ec54e 100644
--- a/protocols/MSN/src/msn_threads.cpp
+++ b/protocols/MSN/src/msn_threads.cpp
@@ -50,7 +50,7 @@ void __cdecl CMsnProto::msn_keepAliveThread(void*)
p2p_clearDormantSessions();
#endif
if (hHttpsConnection && (clock() - mHttpsTS) > 60 * CLOCKS_PER_SEC) {
- HANDLE hConn = hHttpsConnection;
+ HNETLIBCONN hConn = hHttpsConnection;
hHttpsConnection = NULL;
Netlib_Shutdown(hConn);
}
@@ -608,7 +608,7 @@ ThreadData::~ThreadData()
mir_free(mData);
}
-void ThreadData::applyGatewayData(HANDLE hConn, bool isPoll)
+void ThreadData::applyGatewayData(HNETLIBCONN hConn, bool isPoll)
{
char szHttpPostUrl[300];
getGatewayUrl(szHttpPostUrl, sizeof(szHttpPostUrl), isPoll);
diff --git a/protocols/MSN/src/stdafx.h b/protocols/MSN/src/stdafx.h
index 2f5c777c6d..e0ea208c9c 100644
--- a/protocols/MSN/src/stdafx.h
+++ b/protocols/MSN/src/stdafx.h
@@ -568,12 +568,12 @@ struct ThreadData
STRLIST mJoinedIdentContactsWLID;
char* mInitialContactWLID;
- TInfoType mType; // thread type
- MsnThreadFunc mFunc; // thread entry point
- char mServer[80]; // server name
- char mState[128]; // state on XFR
+ TInfoType mType; // thread type
+ MsnThreadFunc mFunc; // thread entry point
+ char mServer[80]; // server name
+ char mState[128]; // state on XFR
- HANDLE s; // NetLib connection for the thread
+ HNETLIBCONN s; // NetLib connection for the thread
HANDLE mIncomingBoundPort; // Netlib listen for the thread
HANDLE hWaitEvent;
WORD mIncomingPort;
@@ -608,7 +608,7 @@ struct ThreadData
size_t mDataSize;
//----| methods |---------------------------------------------------------------------
- void applyGatewayData(HANDLE hConn, bool isPoll);
+ void applyGatewayData(HNETLIBCONN hConn, bool isPoll);
void getGatewayUrl(char* dest, int destlen, bool isPoll);
void processSessionData(const char* xMsgr, const char* xHost);
void startThread(MsnThreadFunc , CMsnProto *prt);
diff --git a/protocols/MinecraftDynmap/src/proto.h b/protocols/MinecraftDynmap/src/proto.h
index ce2e4eac8d..ff643f4be8 100644
--- a/protocols/MinecraftDynmap/src/proto.h
+++ b/protocols/MinecraftDynmap/src/proto.h
@@ -87,8 +87,8 @@ public:
HANDLE events_loop_event_;
// Handles
- HANDLE hConnection;
- HANDLE hEventsConnection;
+ HNETLIBCONN hConnection;
+ HNETLIBCONN hEventsConnection;
HANDLE chatHandle_;
// Data storage
diff --git a/protocols/Omegle/src/client.h b/protocols/Omegle/src/client.h
index 1f95e0c335..f9d8f23634 100644
--- a/protocols/Omegle/src/client.h
+++ b/protocols/Omegle/src/client.h
@@ -57,8 +57,8 @@ public:
chatHandle_ = NULL;
}
- HANDLE hConnection;
- HANDLE hEventsConnection;
+ HNETLIBCONN hConnection;
+ HNETLIBCONN hEventsConnection;
HANDLE connection_lock_;
HANDLE chatHandle_;
diff --git a/protocols/Sametime/src/sametime_proto.h b/protocols/Sametime/src/sametime_proto.h
index 4e652a5dd8..f822118c88 100644
--- a/protocols/Sametime/src/sametime_proto.h
+++ b/protocols/Sametime/src/sametime_proto.h
@@ -174,7 +174,7 @@ struct CSametimeProto : public PROTO<CSametimeProto>
int login_status;
bool idle_status;
int idle_timerid;
- HANDLE server_connection;
+ HNETLIBCONN server_connection;
// conference.cpp
InviteQueue invite_queue;
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h
index e5863b8730..fa1feb2635 100644
--- a/protocols/SkypeWeb/src/skype_proto.h
+++ b/protocols/SkypeWeb/src/skype_proto.h
@@ -139,10 +139,8 @@ private:
std::map<std::string, std::string> cookies;
static std::map<std::wstring, std::wstring> languages;
- HANDLE m_pollingConnection,
- m_hPollingThread,
- m_hTrouterThread,
- m_TrouterConnection;
+ HNETLIBCONN m_pollingConnection, m_TrouterConnection;
+ HANDLE m_hPollingThread, m_hTrouterThread;
TRInfo TRouter;
diff --git a/protocols/Steam/src/steam_events.cpp b/protocols/Steam/src/steam_events.cpp
index 43a906b56e..db3b5a054c 100644
--- a/protocols/Steam/src/steam_events.cpp
+++ b/protocols/Steam/src/steam_events.cpp
@@ -17,13 +17,6 @@ int CSteamProto::OnModulesLoaded(WPARAM, LPARAM)
return 0;
}
-int CSteamProto::OnPreShutdown(WPARAM, LPARAM)
-{
- Netlib_Shutdown(this->m_hNetlibUser);
- this->m_hNetlibUser = NULL;
- return 0;
-}
-
INT_PTR CSteamProto::OnAccountManagerInit(WPARAM, LPARAM lParam)
{
return (INT_PTR)(CSteamOptionsMain::CreateAccountManagerPage(this, (HWND)lParam))->GetHwnd();
diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp
index fb6d7e31f3..e9fc5ba35c 100644
--- a/protocols/Steam/src/steam_proto.cpp
+++ b/protocols/Steam/src/steam_proto.cpp
@@ -396,9 +396,6 @@ int __cdecl CSteamProto::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM
case EV_PROTO_ONLOAD:
return this->OnModulesLoaded(wParam, lParam);
- case EV_PROTO_ONEXIT:
- return this->OnPreShutdown(wParam, lParam);
-
/*case EV_PROTO_ONOPTIONS:
return this->OnOptionsInit(wParam, lParam);*/
diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h
index 812f88051e..b9d4ca8556 100644
--- a/protocols/Steam/src/steam_proto.h
+++ b/protocols/Steam/src/steam_proto.h
@@ -212,7 +212,6 @@ protected:
// events
int OnModulesLoaded(WPARAM, LPARAM);
- int OnPreShutdown(WPARAM, LPARAM);
int __cdecl OnIdleChanged(WPARAM, LPARAM);
int __cdecl OnOptionsInit(WPARAM wParam, LPARAM lParam);
INT_PTR __cdecl OnAccountManagerInit(WPARAM wParam, LPARAM lParam);
diff --git a/protocols/Tlen/src/stdafx.h b/protocols/Tlen/src/stdafx.h
index 67f085a708..d5783e17ee 100644
--- a/protocols/Tlen/src/stdafx.h
+++ b/protocols/Tlen/src/stdafx.h
@@ -348,7 +348,7 @@ typedef struct ThreadDataStruct{
WORD port;
BOOL useEncryption;
- HANDLE s; //HANDLE from CallService(MS_NETLIB_OPENCONNECTION (tlen_ws.c:68)
+ HNETLIBCONN s;
aes_context aes_in_context;
aes_context aes_out_context;
unsigned char aes_in_iv[16];
@@ -364,7 +364,7 @@ typedef enum { FT_CONNECTING, FT_INITIALIZING, FT_RECEIVING, FT_DONE, FT_ERROR,
typedef enum { FT_RECV, FT_SEND} TLEN_FILE_MODE;
typedef struct TLEN_FILE_TRANSFER_STRUCT{
MCONTACT hContact;
- HANDLE s;
+ HNETLIBCONN s;
NETLIBNEWCONNECTIONPROC_V2 pfnNewConnectionV2;
TLEN_FILE_STATE state;
char *jid;
@@ -437,9 +437,9 @@ void __cdecl TlenServerThread(ThreadData *info);
// tlen_ws.cpp
BOOL TlenWsInit(TlenProtocol *proto);
void TlenWsUninit(TlenProtocol *proto);
-HANDLE TlenWsConnect(TlenProtocol *proto, char *host, WORD port);
-int TlenWsSend(TlenProtocol *proto, HANDLE s, char *data, int datalen);
-int TlenWsRecv(TlenProtocol *proto, HANDLE s, char *data, long datalen);
+HNETLIBCONN TlenWsConnect(TlenProtocol *proto, char *host, WORD port);
+int TlenWsSend(TlenProtocol *proto, HNETLIBCONN s, char *data, int datalen);
+int TlenWsRecv(TlenProtocol *proto, HNETLIBCONN s, char *data, long datalen);
int TlenWsSendAES(TlenProtocol *proto, char *data, int datalen, aes_context *aes_ctx, unsigned char *aes_iv);
int TlenWsRecvAES(TlenProtocol *proto, char *data, long datalen, aes_context *aes_ctx, unsigned char *aes_iv);
diff --git a/protocols/Tlen/src/tlen_file.cpp b/protocols/Tlen/src/tlen_file.cpp
index dcbc77d8c0..f97e6f1b19 100644
--- a/protocols/Tlen/src/tlen_file.cpp
+++ b/protocols/Tlen/src/tlen_file.cpp
@@ -144,12 +144,12 @@ static void TlenFileReceiveParse(TLEN_FILE_TRANSFER *ft)
}
}
-static void TlenFileReceivingConnection(HANDLE hConnection, DWORD, void * pExtra)
+static void TlenFileReceivingConnection(HNETLIBCONN hConnection, DWORD, void * pExtra)
{
TlenProtocol *proto = (TlenProtocol *)pExtra;
TLEN_FILE_TRANSFER *ft = TlenP2PEstablishIncomingConnection(proto, hConnection, LIST_FILE, TRUE);
if (ft != NULL) {
- HANDLE slisten = ft->s;
+ HNETLIBCONN slisten = ft->s;
ft->s = hConnection;
ft->proto->debugLogA("Set ft->s to %d (saving %d)", hConnection, slisten);
ft->proto->debugLogA("Entering send loop for this file connection... (ft->s is hConnection)");
@@ -182,7 +182,7 @@ static void __cdecl TlenFileReceiveThread(void *arg)
nloc.szHost = ft->hostName;
nloc.wPort = ft->wPort;
ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
- HANDLE s = Netlib_OpenConnection(ft->proto->m_hNetlibUser, &nloc);
+ HNETLIBCONN s = Netlib_OpenConnection(ft->proto->m_hNetlibUser, &nloc);
if (s != NULL) {
ft->s = s;
ft->proto->debugLogA("Entering file receive loop");
@@ -378,9 +378,9 @@ static void TlenFileSendParse(TLEN_FILE_TRANSFER *ft)
}
}
-static void TlenFileSendingConnection(HANDLE hConnection, DWORD, void * pExtra)
+static void TlenFileSendingConnection(HNETLIBCONN hConnection, DWORD, void * pExtra)
{
- HANDLE slisten;
+ HNETLIBCONN slisten;
TlenProtocol *proto = (TlenProtocol *)pExtra;
TLEN_FILE_TRANSFER *ft = TlenP2PEstablishIncomingConnection(proto, hConnection, LIST_FILE, TRUE);
@@ -450,7 +450,7 @@ static void __cdecl TlenFileSendingThread(void *arg)
ft->proto->debugLogA("Thread started: type=tlen_file_send");
ft->mode = FT_SEND;
ft->pfnNewConnectionV2 = TlenFileSendingConnection;
- HANDLE s = TlenP2PListen(ft);
+ HNETLIBCONN s = TlenP2PListen(ft);
if (s != NULL) {
ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
ft->s = s;
@@ -481,7 +481,7 @@ static void __cdecl TlenFileSendingThread(void *arg)
NETLIBOPENCONNECTION nloc = { sizeof(nloc) };
nloc.szHost = ft->hostName;
nloc.wPort = ft->wPort;
- HANDLE hConn = Netlib_OpenConnection(ft->proto->m_hNetlibUser, &nloc);
+ HNETLIBCONN hConn = Netlib_OpenConnection(ft->proto->m_hNetlibUser, &nloc);
if (hConn != NULL) {
ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
ft->s = hConn;
diff --git a/protocols/Tlen/src/tlen_p2p_old.cpp b/protocols/Tlen/src/tlen_p2p_old.cpp
index 71eee92fc8..2180bde7a7 100644
--- a/protocols/Tlen/src/tlen_p2p_old.cpp
+++ b/protocols/Tlen/src/tlen_p2p_old.cpp
@@ -114,7 +114,7 @@ void TlenP2PInit() {
void TlenP2PUninit() {
}
-int TlenP2PPacketSend(HANDLE s, TLEN_FILE_PACKET *packet)
+int TlenP2PPacketSend(HNETLIBCONN s, TLEN_FILE_PACKET *packet)
{
DWORD sendResult;
if (packet != NULL && packet->packet != NULL) {
@@ -126,7 +126,7 @@ int TlenP2PPacketSend(HANDLE s, TLEN_FILE_PACKET *packet)
return 1;
}
-TLEN_FILE_PACKET* TlenP2PPacketReceive(HANDLE s)
+TLEN_FILE_PACKET* TlenP2PPacketReceive(HNETLIBCONN s)
{
DWORD type, len, pos;
DWORD recvResult = Netlib_Recv(s, (char *)&type, 4, MSG_NODUMP);
@@ -182,7 +182,7 @@ void TlenP2PEstablishOutgoingConnection(TLEN_FILE_TRANSFER *ft, BOOL sendAck)
}
}
-TLEN_FILE_TRANSFER* TlenP2PEstablishIncomingConnection(TlenProtocol *proto, HANDLE s, TLEN_LIST list, BOOL sendAck)
+TLEN_FILE_TRANSFER* TlenP2PEstablishIncomingConnection(TlenProtocol *proto, HNETLIBCONN s, TLEN_LIST list, BOOL sendAck)
{
char str[300];
DWORD iqId;
@@ -290,7 +290,7 @@ static void __cdecl TlenFileBindSocks5Thread(TLEN_FILE_TRANSFER* ft)
}
-static HANDLE TlenP2PBindSocks4(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft)
+static HNETLIBCONN TlenP2PBindSocks4(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft)
{ //rfc1928
int len;
BYTE buf[256];
@@ -300,7 +300,7 @@ static HANDLE TlenP2PBindSocks4(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft)
NETLIBOPENCONNECTION nloc = { sizeof(nloc) };
nloc.szHost = sb->szHost;
nloc.wPort = sb->wPort;
- HANDLE s = Netlib_OpenConnection(ft->proto->hFileNetlibUser, &nloc);
+ HNETLIBCONN s = Netlib_OpenConnection(ft->proto->hFileNetlibUser, &nloc);
if (s == NULL) {
// TlenLog("Connection failed (%d), thread ended", WSAGetLastError());
return NULL;
@@ -343,7 +343,7 @@ static HANDLE TlenP2PBindSocks4(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft)
return s;
}
-static HANDLE TlenP2PBindSocks5(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft)
+static HNETLIBCONN TlenP2PBindSocks5(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft)
{ //rfc1928
BYTE buf[512];
int len, status;
@@ -352,7 +352,7 @@ static HANDLE TlenP2PBindSocks5(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft)
NETLIBOPENCONNECTION nloc = { sizeof(nloc) };
nloc.szHost = sb->szHost;
nloc.wPort = sb->wPort;
- HANDLE s = Netlib_OpenConnection(ft->proto->hFileNetlibUser, &nloc);
+ HNETLIBCONN s = Netlib_OpenConnection(ft->proto->hFileNetlibUser, &nloc);
if (s == NULL) {
ft->proto->debugLogA("Connection failed (%d), thread ended", WSAGetLastError());
return NULL;
@@ -441,9 +441,9 @@ static HANDLE TlenP2PBindSocks5(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft)
}
-HANDLE TlenP2PListen(TLEN_FILE_TRANSFER *ft)
+HNETLIBCONN TlenP2PListen(TLEN_FILE_TRANSFER *ft)
{
- HANDLE s = NULL;
+ HNETLIBCONN s = NULL;
int useProxy;
DBVARIANT dbv;
SOCKSBIND sb;
@@ -493,12 +493,11 @@ HANDLE TlenP2PListen(TLEN_FILE_TRANSFER *ft)
NETLIBBIND nlb = {};
if (useProxy<2) {
- nlb.cbSize = sizeof(NETLIBBIND);
nlb.pfnNewConnectionV2 = ft->pfnNewConnectionV2;
nlb.wPort = 0; // Use user-specified incoming port ranges, if available
nlb.pExtra = proto;
ft->proto->debugLogA("Calling MS_NETLIB_BINDPORT");
- s = Netlib_BindPort(ft->proto->m_hNetlibUser, &nlb);
+ s = (HNETLIBCONN)Netlib_BindPort(ft->proto->m_hNetlibUser, &nlb);
ft->proto->debugLogA("listening on %d",s);
}
if (useProxy == 0) {
diff --git a/protocols/Tlen/src/tlen_p2p_old.h b/protocols/Tlen/src/tlen_p2p_old.h
index 563054a83e..8b5a6ffde4 100644
--- a/protocols/Tlen/src/tlen_p2p_old.h
+++ b/protocols/Tlen/src/tlen_p2p_old.h
@@ -57,12 +57,12 @@ extern void TlenP2PPacketSetType(TLEN_FILE_PACKET *packet, DWORD type);
extern void TlenP2PPacketSetLen(TLEN_FILE_PACKET *packet, DWORD len);
extern void TlenP2PPacketPackDword(TLEN_FILE_PACKET *packet, DWORD data);
extern void TlenP2PPacketPackBuffer(TLEN_FILE_PACKET *packet, char *buffer, int len);
-extern int TlenP2PPacketSend(HANDLE s, TLEN_FILE_PACKET *packet);
-extern TLEN_FILE_PACKET* TlenP2PPacketReceive(HANDLE s);
+extern int TlenP2PPacketSend(HNETLIBCONN s, TLEN_FILE_PACKET *packet);
+extern TLEN_FILE_PACKET* TlenP2PPacketReceive(HNETLIBCONN s);
extern void TlenP2PEstablishOutgoingConnection(TLEN_FILE_TRANSFER *ft, BOOL sendAck);
-extern TLEN_FILE_TRANSFER* TlenP2PEstablishIncomingConnection(TlenProtocol *proto, HANDLE s, TLEN_LIST list, BOOL sendAck);
-extern HANDLE TlenP2PListen(TLEN_FILE_TRANSFER *ft);
-extern void TlenP2PStopListening(HANDLE s);
+extern TLEN_FILE_TRANSFER* TlenP2PEstablishIncomingConnection(TlenProtocol *proto, HNETLIBCONN s, TLEN_LIST list, BOOL sendAck);
+extern HNETLIBCONN TlenP2PListen(TLEN_FILE_TRANSFER *ft);
+extern void TlenP2PStopListening(HNETLIBCONN s);
void __cdecl TlenProcessP2P(XmlNode *node, void *userdata);
diff --git a/protocols/Tlen/src/tlen_picture.cpp b/protocols/Tlen/src/tlen_picture.cpp
index 14b15ad15c..79e9b7b545 100644
--- a/protocols/Tlen/src/tlen_picture.cpp
+++ b/protocols/Tlen/src/tlen_picture.cpp
@@ -42,7 +42,7 @@ static void TlenPsPostThread(void *ptr) {
TLENPSREQUESTTHREADDATA *data = (TLENPSREQUESTTHREADDATA *)ptr;
TlenProtocol *proto = data->proto;
TLEN_LIST_ITEM *item = data->item;
- HANDLE socket = TlenWsConnect(proto, "ps.tlen.pl", 443);
+ HNETLIBCONN socket = TlenWsConnect(proto, "ps.tlen.pl", 443);
BOOL bSent = FALSE;
if (socket != NULL) {
char header[512];
@@ -99,7 +99,7 @@ static void TlenPsGetThread(void *ptr) {
FILE *fp;
fp = fopen( item->ft->files[0], "wb" );
if (fp) {
- HANDLE socket = TlenWsConnect(proto, "ps.tlen.pl", 443);
+ HNETLIBCONN socket = TlenWsConnect(proto, "ps.tlen.pl", 443);
if (socket != NULL) {
XmlState xmlState;
char header[512];
diff --git a/protocols/Tlen/src/tlen_voice.cpp b/protocols/Tlen/src/tlen_voice.cpp
index eb52fb034b..3255cd53f1 100644
--- a/protocols/Tlen/src/tlen_voice.cpp
+++ b/protocols/Tlen/src/tlen_voice.cpp
@@ -43,7 +43,7 @@ static HBITMAP vuMeterBitmaps[100];
static void TlenVoiceReceiveParse(TLEN_FILE_TRANSFER *ft);
static void TlenVoiceSendParse(TLEN_FILE_TRANSFER *ft);
-static void TlenVoiceReceivingConnection(HANDLE hNewConnection, DWORD dwRemoteIP, void * pExtra);
+static void TlenVoiceReceivingConnection(HNETLIBCONN hNewConnection, DWORD dwRemoteIP, void * pExtra);
static void CALLBACK TlenVoicePlaybackCallback(HWAVEOUT hwo, UINT uMsg, DWORD* dwInstance, DWORD dwParam1, DWORD)
{
@@ -297,7 +297,7 @@ static void __cdecl TlenVoiceReceiveThread(void *arg)
NETLIBOPENCONNECTION nloc = { sizeof(nloc) };
nloc.szHost = ft->hostName;
nloc.wPort = ft->wPort;
- HANDLE s = Netlib_OpenConnection(ft->proto->m_hNetlibUser, &nloc);
+ HNETLIBCONN s = Netlib_OpenConnection(ft->proto->m_hNetlibUser, &nloc);
if (s != NULL) {
ft->s = s;
ft->proto->debugLogA("Entering file receive loop");
@@ -322,7 +322,7 @@ static void __cdecl TlenVoiceReceiveThread(void *arg)
else {
ft->proto->debugLogA("Connection failed - receiving as server");
ft->pfnNewConnectionV2 = TlenVoiceReceivingConnection;
- s = TlenP2PListen(ft);
+ s = (HNETLIBCONN)TlenP2PListen(ft);
if (s != NULL) {
SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Waiting for connection..."));
ft->s = s;
@@ -362,9 +362,9 @@ static void __cdecl TlenVoiceReceiveThread(void *arg)
TlenP2PFreeFileTransfer(ft);
}
-static void TlenVoiceReceivingConnection(HANDLE hConnection, DWORD, void * pExtra)
+static void TlenVoiceReceivingConnection(HNETLIBCONN hConnection, DWORD, void * pExtra)
{
- HANDLE slisten;
+ HNETLIBCONN slisten;
TlenProtocol *proto = (TlenProtocol *)pExtra;
TLEN_FILE_TRANSFER *ft = TlenP2PEstablishIncomingConnection(proto, hConnection, LIST_VOICE, FALSE);
@@ -517,7 +517,7 @@ static void __cdecl TlenVoiceSendingThread(void *arg)
ft->proto->debugLogA("Thread started: type=voice_send");
ft->pfnNewConnectionV2 = TlenVoiceReceivingConnection;
- HANDLE s = TlenP2PListen(ft);
+ HNETLIBCONN s = (HNETLIBCONN)TlenP2PListen(ft);
if (s != NULL) {
SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Waiting for connection..."));
//ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
@@ -549,7 +549,7 @@ static void __cdecl TlenVoiceSendingThread(void *arg)
NETLIBOPENCONNECTION nloc = { sizeof(nloc) };
nloc.szHost = ft->hostName;
nloc.wPort = ft->wPort;
- HANDLE sock = Netlib_OpenConnection(ft->proto->m_hNetlibUser, &nloc);
+ HNETLIBCONN sock = Netlib_OpenConnection(ft->proto->m_hNetlibUser, &nloc);
if (sock != NULL) {
SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Connecting..."));
//ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
diff --git a/protocols/Tlen/src/tlen_ws.cpp b/protocols/Tlen/src/tlen_ws.cpp
index eaa952d33b..98b21892d4 100644
--- a/protocols/Tlen/src/tlen_ws.cpp
+++ b/protocols/Tlen/src/tlen_ws.cpp
@@ -55,7 +55,7 @@ void TlenWsUninit(TlenProtocol *proto)
proto->hFileNetlibUser = NULL;
}
-HANDLE TlenWsConnect(TlenProtocol *proto, char *host, WORD port)
+HNETLIBCONN TlenWsConnect(TlenProtocol *proto, char *host, WORD port)
{
NETLIBOPENCONNECTION nloc = {};
nloc.cbSize = sizeof(NETLIBOPENCONNECTION); //NETLIBOPENCONNECTION_V1_SIZE;
@@ -66,7 +66,7 @@ HANDLE TlenWsConnect(TlenProtocol *proto, char *host, WORD port)
return Netlib_OpenConnection(proto->m_hNetlibUser, &nloc);
}
-int TlenWsSend(TlenProtocol *proto, HANDLE s, char *data, int datalen)
+int TlenWsSend(TlenProtocol *proto, HNETLIBCONN s, char *data, int datalen)
{
int len;
if ((len=Netlib_Send(s, data, datalen, /*MSG_NODUMP|*/MSG_DUMPASTEXT)) == SOCKET_ERROR || len != datalen) {
@@ -76,7 +76,7 @@ int TlenWsSend(TlenProtocol *proto, HANDLE s, char *data, int datalen)
return TRUE;
}
-int TlenWsRecv(TlenProtocol *proto, HANDLE s, char *data, long datalen)
+int TlenWsRecv(TlenProtocol *proto, HNETLIBCONN s, char *data, long datalen)
{
int ret;
ret = Netlib_Recv(s, data, datalen, /*MSG_NODUMP|*/MSG_DUMPASTEXT);
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp
index 8446207d64..8160e13e14 100644
--- a/protocols/Twitter/src/proto.cpp
+++ b/protocols/Twitter/src/proto.cpp
@@ -191,7 +191,6 @@ int TwitterProto::OnEvent(PROTOEVENTTYPE event, WPARAM wParam, LPARAM lParam)
{
switch (event) {
case EV_PROTO_ONLOAD: return OnModulesLoaded(wParam, lParam);
- case EV_PROTO_ONEXIT: return OnPreShutdown(wParam, lParam);
case EV_PROTO_ONOPTIONS: return OnOptionsInit(wParam, lParam);
}
@@ -347,13 +346,6 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM)
return 0;
}
-int TwitterProto::OnPreShutdown(WPARAM, LPARAM)
-{
- Netlib_Shutdown(m_hNetlibUser);
- Netlib_Shutdown(hAvatarNetlib_);
- return 0;
-}
-
int TwitterProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM)
{
MCONTACT hContact = (MCONTACT) wParam;
diff --git a/protocols/Twitter/src/proto.h b/protocols/Twitter/src/proto.h
index d344bc1a9e..c1be3f728c 100644
--- a/protocols/Twitter/src/proto.h
+++ b/protocols/Twitter/src/proto.h
@@ -65,7 +65,6 @@ public:
int __cdecl OnBuildStatusMenu(WPARAM,LPARAM);
int __cdecl OnOptionsInit(WPARAM,LPARAM);
int __cdecl OnModulesLoaded(WPARAM,LPARAM);
- int __cdecl OnPreShutdown(WPARAM,LPARAM);
int __cdecl OnPrebuildContactMenu(WPARAM,LPARAM);
int __cdecl OnChatOutgoing(WPARAM,LPARAM);
diff --git a/protocols/Twitter/src/utility.h b/protocols/Twitter/src/utility.h
index e7e14e084c..b8052df5be 100644
--- a/protocols/Twitter/src/utility.h
+++ b/protocols/Twitter/src/utility.h
@@ -85,7 +85,7 @@ public:
protected:
http::response slurp(const std::string &,http::method, OAuthParameters );
- HANDLE httpPOST_;
+ HNETLIBCONN httpPOST_;
HNETLIBUSER handle_;
PROTO_INTERFACE *ppro_;
};
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h
index 84167b2a4f..86e09413f8 100644
--- a/protocols/VKontakte/src/vk_proto.h
+++ b/protocols/VKontakte/src/vk_proto.h
@@ -188,10 +188,12 @@ private:
m_pollingTs,
m_szAccessToken;
- HANDLE
+ HNETLIBCONN
m_pollingConn,
+ m_hAPIConnection;
+
+ HANDLE
m_hPollingThread,
- m_hAPIConnection,
m_hPopupClassError,
m_hPopupClassNotification,
m_evRequestsQueue,
diff --git a/protocols/WhatsApp/src/WASocketConnection.h b/protocols/WhatsApp/src/WASocketConnection.h
index 23beac6ef2..83eb61e7f5 100644
--- a/protocols/WhatsApp/src/WASocketConnection.h
+++ b/protocols/WhatsApp/src/WASocketConnection.h
@@ -10,7 +10,7 @@ class WASocketConnection : public ISocketConnection
int maxBufRead;
bool connected;
- HANDLE hConn;
+ HNETLIBCONN hConn;
public:
WASocketConnection(const std::string &dir, int port) throw (WAException);
diff --git a/src/mir_app/src/netlib.cpp b/src/mir_app/src/netlib.cpp
index a0051c2dc5..4405f265e5 100644
--- a/src/mir_app/src/netlib.cpp
+++ b/src/mir_app/src/netlib.cpp
@@ -354,14 +354,14 @@ MIR_APP_DLL(HNETLIBUSER) Netlib_GetConnNlu(HANDLE hConn)
/////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(void) Netlib_Shutdown(HANDLE h)
+MIR_APP_DLL(void) Netlib_Shutdown(HNETLIBCONN h)
{
if (h) {
WaitForSingleObject(hConnectionHeaderMutex, INFINITE);
switch (GetNetlibHandleType(h)) {
case NLH_CONNECTION:
{
- NetlibConnection *nlc = (NetlibConnection*)h;
+ NetlibConnection *nlc = h;
if (!nlc->termRequested) {
if (nlc->hSsl) sslApi.shutdown(nlc->hSsl);
if (nlc->s != INVALID_SOCKET) shutdown(nlc->s, 2);
@@ -372,7 +372,7 @@ MIR_APP_DLL(void) Netlib_Shutdown(HANDLE h)
break;
case NLH_BOUNDPORT:
- struct NetlibBoundPort *nlb = (NetlibBoundPort*)h;
+ NetlibBoundPort *nlb = (NetlibBoundPort*)h;
if (nlb->s != INVALID_SOCKET)
shutdown(nlb->s, 2);
break;
@@ -403,10 +403,9 @@ void UnloadNetlibModule(void)
int LoadNetlibModule(void)
{
- WSADATA wsadata;
-
bModuleInitialized = TRUE;
+ WSADATA wsadata;
WSAStartup(MAKEWORD(2, 2), &wsadata);
HookEvent(ME_OPT_INITIALISE, NetlibOptInitialise);
diff --git a/src/mir_app/src/netlibbind.cpp b/src/mir_app/src/netlibbind.cpp
index b5dcc6b6c3..fff3f092d2 100644
--- a/src/mir_app/src/netlibbind.cpp
+++ b/src/mir_app/src/netlibbind.cpp
@@ -174,15 +174,13 @@ static void NetlibBindAcceptThread(void* param)
Netlib_Logf(nlbp->nlu, "NetlibBindAcceptThread: (%p) thread for port %u closed", nlbp->s, nlbp->wPort);
}
-MIR_APP_DLL(HANDLE) Netlib_BindPort(HNETLIBUSER nlu, NETLIBBIND *nlb)
+MIR_APP_DLL(HNETLIBBIND) Netlib_BindPort(HNETLIBUSER nlu, NETLIBBIND *nlb)
{
if (GetNetlibHandleType(nlu) != NLH_USER || !(nlu->user.flags & NUF_INCOMING) ||
nlb == NULL || nlb->pfnNewConnection == NULL) {
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
- if (nlb->cbSize != sizeof(NETLIBBIND))
- return 0;
NetlibBoundPort *nlbp = (NetlibBoundPort*)mir_calloc(sizeof(NetlibBoundPort));
nlbp->handleType = NLH_BOUNDPORT;
diff --git a/src/mir_app/src/netlibhttp.cpp b/src/mir_app/src/netlibhttp.cpp
index 5209ca6468..a680d26f67 100644
--- a/src/mir_app/src/netlibhttp.cpp
+++ b/src/mir_app/src/netlibhttp.cpp
@@ -367,9 +367,8 @@ static int SendHttpRequestAndData(NetlibConnection *nlc, CMStringA &httpRequest,
return bytesSent;
}
-MIR_APP_DLL(int) Netlib_SendHttpRequest(HANDLE hConnection, NETLIBHTTPREQUEST *nlhr)
+MIR_APP_DLL(int) Netlib_SendHttpRequest(HNETLIBCONN nlc, NETLIBHTTPREQUEST *nlhr)
{
- NetlibConnection *nlc = (NetlibConnection*)hConnection;
NETLIBHTTPREQUEST *nlhrReply = NULL;
HttpSecurityContext httpSecurity;
@@ -717,7 +716,7 @@ MIR_APP_DLL(bool) Netlib_FreeHttpRequest(NETLIBHTTPREQUEST *nlhr)
#define NHRV_BUF_SIZE 8192
-MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_RecvHttpHeaders(HANDLE hConnection, int flags)
+MIR_APP_DLL(NETLIBHTTPREQUEST*) Netlib_RecvHttpHeaders(HNETLIBCONN hConnection, int flags)
{
NetlibConnection *nlc = (NetlibConnection*)hConnection;
if (!NetlibEnterNestedCS(nlc, NLNCS_RECV))
diff --git a/src/mir_app/src/netlibopenconn.cpp b/src/mir_app/src/netlibopenconn.cpp
index 9d504b66ad..dba769dd27 100644
--- a/src/mir_app/src/netlibopenconn.cpp
+++ b/src/mir_app/src/netlibopenconn.cpp
@@ -816,7 +816,7 @@ bool NetlibReconnect(NetlibConnection *nlc)
return true;
}
-MIR_APP_DLL(HANDLE) Netlib_OpenConnection(NetlibUser *nlu, const NETLIBOPENCONNECTION *nloc)
+MIR_APP_DLL(HNETLIBCONN) Netlib_OpenConnection(NetlibUser *nlu, const NETLIBOPENCONNECTION *nloc)
{
if (nloc == NULL || nloc->cbSize != sizeof(NETLIBOPENCONNECTION) || nloc->szHost == NULL || nloc->wPort == 0) {
@@ -851,7 +851,7 @@ MIR_APP_DLL(HANDLE) Netlib_OpenConnection(NetlibUser *nlu, const NETLIBOPENCONNE
return nlc;
}
-MIR_APP_DLL(int) Netlib_StartSsl(HANDLE hConnection, const char *szHost)
+MIR_APP_DLL(int) Netlib_StartSsl(HNETLIBCONN hConnection, const char *szHost)
{
NetlibConnection *nlc = (NetlibConnection*)hConnection;
if (nlc == NULL)
diff --git a/src/mir_app/src/netlibsock.cpp b/src/mir_app/src/netlibsock.cpp
index a920f7cd93..57cb023b4b 100644
--- a/src/mir_app/src/netlibsock.cpp
+++ b/src/mir_app/src/netlibsock.cpp
@@ -29,9 +29,8 @@ extern HANDLE hConnectionHeaderMutex, hSendEvent, hRecvEvent;
/////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(int) Netlib_Send(HANDLE hConn, const char *buf, int len, int flags)
+MIR_APP_DLL(int) Netlib_Send(HNETLIBCONN nlc, const char *buf, int len, int flags)
{
- NetlibConnection *nlc = (NetlibConnection*)hConn;
if (!NetlibEnterNestedCS(nlc, NLNCS_SEND))
return SOCKET_ERROR;
@@ -39,7 +38,7 @@ MIR_APP_DLL(int) Netlib_Send(HANDLE hConn, const char *buf, int len, int flags)
if (nlc->usingHttpGateway && !(flags & MSG_RAW)) {
if (!(flags & MSG_NOHTTPGATEWAYWRAP) && nlc->nlu->user.pfnHttpGatewayWrapSend) {
NetlibDumpData(nlc, (PBYTE)buf, len, 1, flags);
- result = nlc->nlu->user.pfnHttpGatewayWrapSend((HANDLE)nlc, (PBYTE)buf, len, flags | MSG_NOHTTPGATEWAYWRAP);
+ result = nlc->nlu->user.pfnHttpGatewayWrapSend(nlc, (PBYTE)buf, len, flags | MSG_NOHTTPGATEWAYWRAP);
}
else result = NetlibHttpGatewayPost(nlc, buf, len, flags);
}
@@ -60,9 +59,8 @@ MIR_APP_DLL(int) Netlib_Send(HANDLE hConn, const char *buf, int len, int flags)
/////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(int) Netlib_Recv(HANDLE hConn, char *buf, int len, int flags)
+MIR_APP_DLL(int) Netlib_Recv(HNETLIBCONN nlc, char *buf, int len, int flags)
{
- NetlibConnection *nlc = (NetlibConnection*)hConn;
if (!NetlibEnterNestedCS(nlc, NLNCS_RECV))
return SOCKET_ERROR;
@@ -95,11 +93,11 @@ MIR_APP_DLL(int) Netlib_Recv(HANDLE hConn, char *buf, int len, int flags)
/////////////////////////////////////////////////////////////////////////////////////////
-static int ConnectionListToSocketList(const HANDLE *hConns, fd_set *fd, int& pending)
+static int ConnectionListToSocketList(const HNETLIBCONN *hConns, fd_set *fd, int& pending)
{
FD_ZERO(fd);
for (int i = 0; hConns[i] && hConns[i] != INVALID_HANDLE_VALUE && i < FD_SETSIZE; i++) {
- NetlibConnection *nlcCheck = (NetlibConnection*)hConns[i];
+ NetlibConnection *nlcCheck = hConns[i];
if (nlcCheck->handleType != NLH_CONNECTION && nlcCheck->handleType != NLH_BOUNDPORT) {
SetLastError(ERROR_INVALID_DATA);
return 0;
@@ -224,7 +222,7 @@ MIR_APP_DLL(char*) Netlib_AddressToString(sockaddr_in *addr)
/////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(int) Netlib_GetConnectionInfo(HANDLE hConnection, NETLIBCONNINFO *connInfo)
+MIR_APP_DLL(int) Netlib_GetConnectionInfo(HNETLIBCONN hConnection, NETLIBCONNINFO *connInfo)
{
NetlibConnection *nlc = (NetlibConnection*)hConnection;
if (!nlc || !connInfo)