summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rwxr-xr-xprotocols/AimOscar/src/client.cpp4
-rwxr-xr-xprotocols/AimOscar/src/connection.cpp5
-rw-r--r--protocols/AimOscar/src/direct_connect.cpp4
-rw-r--r--protocols/AimOscar/src/file.cpp4
-rw-r--r--protocols/IRCG/src/irclib.cpp2
-rw-r--r--protocols/IRCG/src/tools.cpp2
-rw-r--r--protocols/IcqOscarJ/src/chan_04close.cpp2
-rw-r--r--protocols/IcqOscarJ/src/fam_01service.cpp4
-rw-r--r--protocols/IcqOscarJ/src/icq_http.cpp6
-rw-r--r--protocols/IcqOscarJ/src/icq_server.cpp2
-rw-r--r--protocols/JabberG/src/jabber_byte.cpp6
-rw-r--r--protocols/JabberG/src/jabber_file.cpp4
-rwxr-xr-xprotocols/JabberG/src/jabber_thread.cpp12
-rw-r--r--protocols/MRA/src/MraAvatars.cpp4
-rw-r--r--protocols/MRA/src/MraFilesQueue.cpp3
-rw-r--r--protocols/MRA/src/MraMRIMProxy.cpp3
-rw-r--r--protocols/MRA/src/Mra_proto.cpp9
-rw-r--r--protocols/MSN/src/msn_commands.cpp4
-rw-r--r--protocols/MSN/src/msn_http.cpp5
-rw-r--r--protocols/MSN/src/msn_misc.cpp2
-rw-r--r--protocols/MSN/src/msn_threads.cpp12
-rw-r--r--protocols/MSN/src/msn_ws.cpp12
-rw-r--r--protocols/Tlen/src/tlen_thread.cpp7
23 files changed, 50 insertions, 68 deletions
diff --git a/protocols/AimOscar/src/client.cpp b/protocols/AimOscar/src/client.cpp
index d428154a0a..839698bb96 100755
--- a/protocols/AimOscar/src/client.cpp
+++ b/protocols/AimOscar/src/client.cpp
@@ -255,8 +255,8 @@ int CAimProto::aim_client_ready(HANDLE hServerConn, unsigned short &seqno)
{
unsigned short offset = 0;
- NETLIBCONNINFO connInfo = { sizeof(connInfo) };
- CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hServerConn, (LPARAM)&connInfo);
+ NETLIBCONNINFO connInfo = {};
+ Netlib_GetConnectionInfo(hServerConn, &connInfo);
m_internal_ip = connInfo.dwIpv4;
diff --git a/protocols/AimOscar/src/connection.cpp b/protocols/AimOscar/src/connection.cpp
index a3635cdcfc..03b51e2577 100755
--- a/protocols/AimOscar/src/connection.cpp
+++ b/protocols/AimOscar/src/connection.cpp
@@ -30,10 +30,7 @@ HANDLE CAimProto::aim_connect(const char* server, unsigned short port, bool use_
debugLogA("%s:%u", server, port);
HANDLE con = Netlib_OpenConnection(m_hNetlibUser, &ncon);
if (con && use_ssl) {
- NETLIBSSL ssl = { 0 };
- ssl.cbSize = sizeof(ssl);
- ssl.host = host;
- if (!CallService(MS_NETLIB_STARTSSL, (WPARAM)con, (LPARAM)&ssl)) {
+ if (!Netlib_StartSsl(con, host)) {
Netlib_CloseHandle(con);
con = NULL;
}
diff --git a/protocols/AimOscar/src/direct_connect.cpp b/protocols/AimOscar/src/direct_connect.cpp
index 2b4bcb9366..6f9eecf76b 100644
--- a/protocols/AimOscar/src/direct_connect.cpp
+++ b/protocols/AimOscar/src/direct_connect.cpp
@@ -65,8 +65,8 @@ void aim_direct_connection_initiated(HANDLE hNewConnection, DWORD, void* extra)/
{
CAimProto *ppro = (CAimProto*)extra;
- NETLIBCONNINFO connInfo = { sizeof(connInfo) };
- CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hNewConnection, (LPARAM)&connInfo);
+ NETLIBCONNINFO connInfo = {};
+ Netlib_GetConnectionInfo(hNewConnection, &connInfo);
ppro->debugLogA("Buddy connected: %s", connInfo.szIpPort);
diff --git a/protocols/AimOscar/src/file.cpp b/protocols/AimOscar/src/file.cpp
index cdb81e03b6..42c2ae2b8d 100644
--- a/protocols/AimOscar/src/file.cpp
+++ b/protocols/AimOscar/src/file.cpp
@@ -186,7 +186,6 @@ int CAimProto::sending_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLI
if (ft->pfts.currentFileProgress) _lseeki64(fid, ft->pfts.currentFileProgress, SEEK_SET);
NETLIBSELECT tSelect = { 0 };
- tSelect.cbSize = sizeof(tSelect);
tSelect.hReadConns[0] = ft->hConn;
ProtoBroadcastAck(ft->hContact, ACKTYPE_FILE, ACKRESULT_DATA, ft, (LPARAM)&ft->pfts);
@@ -203,7 +202,8 @@ int CAimProto::sending_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLI
if (clock() >= lNotify) {
ProtoBroadcastAck(ft->hContact, ACKTYPE_FILE, ACKRESULT_DATA, ft, (LPARAM)&ft->pfts);
- if (CallService(MS_NETLIB_SELECT, 0, (LPARAM)&tSelect)) break;
+ if (Netlib_Select(&tSelect))
+ break;
lNotify = clock() + 500;
}
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp
index 3235e06a76..cf6a7914d7 100644
--- a/protocols/IRCG/src/irclib.cpp
+++ b/protocols/IRCG/src/irclib.cpp
@@ -209,7 +209,7 @@ bool CIrcProto::Connect(const CIrcSessionInfo& info)
FindLocalIP(con); // get the local ip used for filetransfers etc
if (info.m_iSSL > 0) {
- if (!CallService(MS_NETLIB_STARTSSL, (WPARAM)con, 0) && info.m_iSSL == 2) {
+ if (!Netlib_StartSsl(con, 0) && info.m_iSSL == 2) {
Netlib_CloseHandle(con);
con = NULL;
m_info.Reset();
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp
index b6e5344e4d..34b0148b96 100644
--- a/protocols/IRCG/src/tools.cpp
+++ b/protocols/IRCG/src/tools.cpp
@@ -592,7 +592,7 @@ bool CIrcProto::AddWindowItemData(CMStringW window, const wchar_t* pszLimit, con
void CIrcProto::FindLocalIP(HANDLE hConn) // inspiration from jabber
{
// Determine local IP
- int socket = CallService(MS_NETLIB_GETSOCKET, (WPARAM)hConn, 0);
+ int socket = Netlib_GetSocket(hConn);
if (socket != INVALID_SOCKET) {
struct sockaddr_in saddr;
int len = sizeof(saddr);
diff --git a/protocols/IcqOscarJ/src/chan_04close.cpp b/protocols/IcqOscarJ/src/chan_04close.cpp
index 315b22c888..cc7ea7de46 100644
--- a/protocols/IcqOscarJ/src/chan_04close.cpp
+++ b/protocols/IcqOscarJ/src/chan_04close.cpp
@@ -137,7 +137,7 @@ int CIcqProto::connectNewServer(serverthread_info *info)
hServerConn = NetLib_OpenConnection(m_hNetlibUser, NULL, &nloc);
if (hServerConn && info->newServerSSL) /* Start SSL session if requested */
- if (!CallService(MS_NETLIB_STARTSSL, (WPARAM)hServerConn, 0))
+ if (!Netlib_StartSsl(hServerConn, NULL))
NetLib_CloseConnection(&hServerConn, FALSE);
if (hServerConn) {
diff --git a/protocols/IcqOscarJ/src/fam_01service.cpp b/protocols/IcqOscarJ/src/fam_01service.cpp
index a416b1b97a..72640bb168 100644
--- a/protocols/IcqOscarJ/src/fam_01service.cpp
+++ b/protocols/IcqOscarJ/src/fam_01service.cpp
@@ -369,9 +369,9 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, size_t wBufferLength, snac_heade
debugLogA("Unable to connect to ICQ new family server.");
// we want the handler to be called even if the connecting failed
else if (bServerSSL) { /* Start SSL session if requested */
- debugLogA("(%p) Starting SSL negotiation", CallService(MS_NETLIB_GETSOCKET, (WPARAM)hConnection, 0));
+ debugLogA("(%p) Starting SSL negotiation", Netlib_GetSocket(hConnection));
- if (!CallService(MS_NETLIB_STARTSSL, (WPARAM)hConnection, 0)) {
+ if (!Netlib_StartSsl(hConnection, NULL)) {
debugLogA("Unable to connect to ICQ new family server, SSL could not be negotiated");
NetLib_CloseConnection(&hConnection, FALSE);
}
diff --git a/protocols/IcqOscarJ/src/icq_http.cpp b/protocols/IcqOscarJ/src/icq_http.cpp
index d9a8e5378a..20d63bf75d 100644
--- a/protocols/IcqOscarJ/src/icq_http.cpp
+++ b/protocols/IcqOscarJ/src/icq_http.cpp
@@ -37,7 +37,6 @@ int icq_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION*, NETLIBHTTPREQUEST *
DWORD dwSid1, dwSid2, dwSid3, dwSid4;
BYTE *buf;
char szSid[33], szHttpServer[256], szHttpGetUrl[300], szHttpPostUrl[300];
- NETLIBHTTPPROXYINFO nlhpi = {0};
if (nlhr->dataLength < 31)
{
@@ -68,15 +67,14 @@ int icq_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION*, NETLIBHTTPREQUEST *
memcpy(szHttpServer, buf, wIpLen);
szHttpServer[wIpLen] = '\0';
- nlhpi.cbSize = sizeof(nlhpi);
+ NETLIBHTTPPROXYINFO nlhpi = {};
nlhpi.flags = NLHPIF_USEPOSTSEQUENCE;
nlhpi.szHttpGetUrl = szHttpGetUrl;
nlhpi.szHttpPostUrl = szHttpPostUrl;
nlhpi.firstPostSequence = 1;
mir_snprintf(szHttpGetUrl, "http://%s/monitor?sid=%s", szHttpServer, szSid);
mir_snprintf(szHttpPostUrl, "http://%s/data?sid=%s&seq=", szHttpServer, szSid);
-
- return CallService(MS_NETLIB_SETHTTPPROXYINFO, (WPARAM)hConn, (LPARAM)&nlhpi);
+ return Netlib_SetHttpProxyInfo(hConn, &nlhpi);
}
diff --git a/protocols/IcqOscarJ/src/icq_server.cpp b/protocols/IcqOscarJ/src/icq_server.cpp
index 1de0a261e5..732c251ec3 100644
--- a/protocols/IcqOscarJ/src/icq_server.cpp
+++ b/protocols/IcqOscarJ/src/icq_server.cpp
@@ -63,7 +63,7 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam)
SAFE_FREE((void**)&infoParam);
if (hServerConn && m_bSecureConnection) {
- if (!CallService(MS_NETLIB_STARTSSL, (WPARAM)hServerConn, 0)) {
+ if (!Netlib_StartSsl(hServerConn, 0)) {
icq_LogMessage(LOG_ERROR, LPGEN("Unable to connect to ICQ login server, SSL could not be negotiated"));
SetCurrentStatus(ID_STATUS_OFFLINE);
NetLib_CloseConnection(&hServerConn, TRUE);
diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp
index deefa4ebe7..95a9976176 100644
--- a/protocols/JabberG/src/jabber_byte.cpp
+++ b/protocols/JabberG/src/jabber_byte.cpp
@@ -91,8 +91,8 @@ void JabberByteSendConnection(HANDLE hConn, DWORD /*dwRemoteIP*/, void* extra)
char* buffer;
int datalen;
- NETLIBCONNINFO connInfo = { sizeof(connInfo) };
- CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hConn, (LPARAM)&connInfo);
+ NETLIBCONNINFO connInfo = {};
+ Netlib_GetConnectionInfo(hConn, &connInfo);
mir_snwprintf(szPort, L"%u", connInfo.wPort);
ppro->debugLogA("bytestream_send_connection incoming connection accepted: %s", connInfo.szIpPort);
@@ -220,7 +220,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt)
jbt->hSendEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
query << XCHILD(L"streamhost") << XATTR(L"jid", m_ThreadInfo->fullJID) << XATTR(L"host", _A2T(localAddr)) << XATTRI(L"port", nlb.wPort);
- NETLIBIPLIST* ihaddr = (NETLIBIPLIST*)CallService(MS_NETLIB_GETMYIP, 1, 0);
+ NETLIBIPLIST* ihaddr = Netlib_GetMyIp(true);
for (unsigned i=0; i < ihaddr->cbNum; i++)
if (mir_strcmp(localAddr, ihaddr->szIp[i]))
query << XCHILD(L"streamhost") << XATTR(L"jid", m_ThreadInfo->fullJID) << XATTR(L"host", _A2T(ihaddr->szIp[i])) << XATTRI(L"port", nlb.wPort);
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp
index ff95251f6f..2ac8d9b0c3 100644
--- a/protocols/JabberG/src/jabber_file.cpp
+++ b/protocols/JabberG/src/jabber_file.cpp
@@ -175,8 +175,8 @@ void JabberFileServerConnection(JABBER_SOCKET hConnection, DWORD /*dwRemoteIP*/,
{
CJabberProto *ppro = (CJabberProto*)extra;
- NETLIBCONNINFO connInfo = { sizeof(connInfo) };
- CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hConnection, (LPARAM)&connInfo);
+ NETLIBCONNINFO connInfo = {};
+ Netlib_GetConnectionInfo(hConnection, &connInfo);
wchar_t szPort[10];
mir_snwprintf(szPort, L"%d", connInfo.wPort);
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index af32ff56cc..778a2b72e8 100755
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -375,7 +375,7 @@ LBL_FatalError:
// Determine local IP
if (info.conn.useSSL) {
debugLogA("Intializing SSL connection");
- if (!CallService(MS_NETLIB_STARTSSL, (WPARAM)info.s, 0)) {
+ if (!Netlib_StartSsl(info.s, NULL)) {
debugLogA("SSL intialization failed");
if (!info.bIsReg)
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NONETWORK);
@@ -413,11 +413,10 @@ LBL_FatalError:
if (dwIdle >= dwConnectionKeepAliveInterval)
dwIdle = dwConnectionKeepAliveInterval - 10; // now!
- NETLIBSELECT nls = { 0 };
- nls.cbSize = sizeof(NETLIBSELECT);
+ NETLIBSELECT nls = {};
nls.dwTimeout = dwConnectionKeepAliveInterval - dwIdle;
nls.hReadConns[0] = info.s;
- int nSelRes = CallService(MS_NETLIB_SELECT, 0, (LPARAM)&nls);
+ int nSelRes = Netlib_Select(&nls);
if (nSelRes == -1) // error
break;
else if (nSelRes == 0 && m_bSendKeepAlive) {
@@ -905,10 +904,7 @@ void CJabberProto::OnProcessProceed(HXML node, ThreadData *info)
bool isHosted = gtlk && !gtlk[10] && mir_strcmpi(info->conn.server, "gmail.com") &&
mir_strcmpi(info->conn.server, "googlemail.com");
- NETLIBSSL ssl = { 0 };
- ssl.cbSize = sizeof(ssl);
- ssl.host = isHosted ? info->conn.manualHost : info->conn.server;
- if (!CallService(MS_NETLIB_STARTSSL, (WPARAM)info->s, (LPARAM)&ssl)) {
+ if (!Netlib_StartSsl(info->s, isHosted ? info->conn.manualHost : info->conn.server)) {
debugLogA("SSL initialization failed");
info->send("</stream:stream>");
info->shutdown();
diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp
index 2979323977..20d7cb9770 100644
--- a/protocols/MRA/src/MraAvatars.cpp
+++ b/protocols/MRA/src/MraAvatars.cpp
@@ -157,8 +157,6 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter)
INTERNET_TIME itAvatarLastModifiedTimeServer;
WCHAR szErrorText[2048];
- nls.cbSize = sizeof(nls);
-
Thread_SetName("MRA: AvatarsThreadProc");
HANDLE hThreadEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
@@ -256,7 +254,7 @@ void CMraProto::MraAvatarsThreadProc(LPVOID lpParameter)
nls.hReadConns[0] = hConnection;
while (bContinue) {
- switch (CallService(MS_NETLIB_SELECT, 0, (LPARAM)&nls)) {
+ switch (Netlib_Select(&nls)) {
case SOCKET_ERROR:
case 0:// Time out
dwErrorCode = GetLastError();
diff --git a/protocols/MRA/src/MraFilesQueue.cpp b/protocols/MRA/src/MraFilesQueue.cpp
index bad116e95e..9b062e46c7 100644
--- a/protocols/MRA/src/MraFilesQueue.cpp
+++ b/protocols/MRA/src/MraFilesQueue.cpp
@@ -729,7 +729,6 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter)
bFailed = TRUE;
bConnected = FALSE;
- nls.cbSize = sizeof(nls);
pfts.cbSize = sizeof(pfts);
pfts.hContact = dat->hContact;
pfts.flags = (PFTS_RECEIVING | PFTS_UNICODE);// pfts.sending = dat->bSending; //true if sending, false if receiving
@@ -818,7 +817,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter)
ProtoBroadcastAck(dat->hContact, ACKTYPE_FILE, ACKRESULT_DATA, (HANDLE)dat->dwIDRequest, (LPARAM)&pfts);
while (bContinue) {
- switch (CallService(MS_NETLIB_SELECT, 0, (LPARAM)&nls)) {
+ switch (Netlib_Select(&nls)) {
case SOCKET_ERROR:
case 0:// Time out
dwRetErrorCode = GetLastError();
diff --git a/protocols/MRA/src/MraMRIMProxy.cpp b/protocols/MRA/src/MraMRIMProxy.cpp
index 2953356770..f29fd6e0e8 100644
--- a/protocols/MRA/src/MraMRIMProxy.cpp
+++ b/protocols/MRA/src/MraMRIMProxy.cpp
@@ -126,7 +126,6 @@ DWORD CMraProto::MraMrimProxyConnect(HANDLE hMraMrimProxyData, HANDLE *phConnect
while (--dwCurConnectReTryCount && pmmpd->hConnection == NULL);
if (pmmpd->hConnection) {
- nls.cbSize = sizeof(nls);
nls.dwTimeout = (MRA_TIMEOUT_DIRECT_CONN*1000*2);
nls.hReadConns[0] = pmmpd->hConnection;
bContinue = TRUE;
@@ -137,7 +136,7 @@ DWORD CMraProto::MraMrimProxyConnect(HANDLE hMraMrimProxyData, HANDLE *phConnect
MraSendPacket(nls.hReadConns[0], 0, MRIM_CS_PROXY_HELLO, &pmmpd->mguidSessionID, sizeof(MRA_GUID));
while (bContinue) {
- switch (CallService(MS_NETLIB_SELECT, 0, (LPARAM)&nls)) {
+ switch (Netlib_Select(&nls)) {
case SOCKET_ERROR:
case 0:// Time out
dwRetErrorCode = GetLastError();
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp
index acd9977a65..8ee2d7101f 100644
--- a/protocols/MRA/src/Mra_proto.cpp
+++ b/protocols/MRA/src/Mra_proto.cpp
@@ -148,12 +148,11 @@ DWORD CMraProto::MraGetNLBData(CMStringA &szHost, WORD *pwPort)
while (--dwCurConnectReTryCount && nls.hReadConns[0] == NULL);
if (nls.hReadConns[0]) {
- nls.cbSize = sizeof(nls);
nls.dwTimeout = 1000 * getDword("TimeOutReceiveNLB", MRA_DEFAULT_TIMEOUT_RECV_NLB);
InterlockedExchange((volatile LONG*)&m_dwThreadWorkerLastPingTime, GetTickCount());
while (m_iStatus != ID_STATUS_OFFLINE && bContinue) {
- switch (CallService(MS_NETLIB_SELECT, 0, (LPARAM)&nls)) {
+ switch (Netlib_Select(&nls)) {
case SOCKET_ERROR:
case 0:// Time out
bContinue = FALSE;
@@ -218,8 +217,8 @@ DWORD CMraProto::MraNetworkDispatcher()
dwCMDNum = 0;
MraSendCMD(MRIM_CS_HELLO, NULL, 0);
while (m_iStatus != ID_STATUS_OFFLINE && bContinue) {
- DWORD dwSelectRet = CallService(MS_NETLIB_SELECT, 0, (LPARAM)&nls);
- if (SOCKET_ERROR == dwSelectRet) {
+ int iSelectRet = Netlib_Select(&nls);
+ if (SOCKET_ERROR == iSelectRet) {
if (m_iStatus != ID_STATUS_OFFLINE) {
dwRetErrorCode = GetLastError();
ShowFormattedErrorMessage(L"Disconnected, socket error", dwRetErrorCode);
@@ -267,7 +266,7 @@ DWORD CMraProto::MraNetworkDispatcher()
}
}
- if (dwSelectRet == 0) // Time out
+ if (iSelectRet == 0) // Time out
continue;
// expand receive buffer dynamically
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp
index cdea188a44..58391b4b29 100644
--- a/protocols/MSN/src/msn_commands.cpp
+++ b/protocols/MSN/src/msn_commands.cpp
@@ -1410,8 +1410,8 @@ void MSN_ConnectionProc(HANDLE hNewConnection, DWORD /* dwRemoteIP */, void* ext
proto->debugLogA("File transfer connection accepted");
- NETLIBCONNINFO connInfo = { sizeof(connInfo) };
- CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hNewConnection, (LPARAM)&connInfo);
+ NETLIBCONNINFO connInfo = {};
+ Netlib_GetConnectionInfo(hNewConnection, &connInfo);
ThreadData* T = proto->MSN_GetThreadByPort(connInfo.wPort);
if (T != NULL && T->s == NULL) {
diff --git a/protocols/MSN/src/msn_http.cpp b/protocols/MSN/src/msn_http.cpp
index 74a0f66fb7..f280daa823 100644
--- a/protocols/MSN/src/msn_http.cpp
+++ b/protocols/MSN/src/msn_http.cpp
@@ -38,13 +38,12 @@ static ThreadData* FindThreadConn(HANDLE hConn)
int msn_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION*, NETLIBHTTPREQUEST*)
{
- NETLIBHTTPPROXYINFO nlhpi = { 0 };
- nlhpi.cbSize = sizeof(nlhpi);
+ NETLIBHTTPPROXYINFO nlhpi = {};
nlhpi.szHttpGetUrl = NULL;
nlhpi.szHttpPostUrl = "messenger.hotmail.com";
nlhpi.flags = NLHPIF_HTTP11;
nlhpi.combinePackets = MSN_PACKETS_COMBINE;
- return CallService(MS_NETLIB_SETHTTPPROXYINFO, (WPARAM)hConn, (LPARAM)&nlhpi);
+ return Netlib_SetHttpProxyInfo(hConn, &nlhpi);
}
//=======================================================================================
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp
index 2f89d21fbe..cc620c1dc1 100644
--- a/protocols/MSN/src/msn_misc.cpp
+++ b/protocols/MSN/src/msn_misc.cpp
@@ -1396,7 +1396,7 @@ void MSN_MakeDigest(const char* chl, char* dgst)
char* GetGlobalIp(void)
{
- NETLIBIPLIST* ihaddr = (NETLIBIPLIST*)CallService(MS_NETLIB_GETMYIP, 1, 0);
+ NETLIBIPLIST *ihaddr = Netlib_GetMyIp(true);
for (unsigned i = 0; i < ihaddr->cbNum; ++i)
if (strchr(ihaddr->szIp[i], ':'))
return mir_strdup(ihaddr->szIp[i]);
diff --git a/protocols/MSN/src/msn_threads.cpp b/protocols/MSN/src/msn_threads.cpp
index de17faa243..c3888ba028 100644
--- a/protocols/MSN/src/msn_threads.cpp
+++ b/protocols/MSN/src/msn_threads.cpp
@@ -177,7 +177,7 @@ void __cdecl CMsnProto::MSNServerThread(void* arg)
}
if (usingGateway)
- CallService(MS_NETLIB_SETPOLLINGTIMEOUT, WPARAM(info->s), info->mGatewayTimeout);
+ Netlib_SetPollingTimeout(info->s, info->mGatewayTimeout);
debugLogA("Connected with handle=%08X", info->s);
@@ -318,8 +318,7 @@ void CMsnProto::MSN_CloseConnections(void)
{
mir_cslockfull lck(m_csThreads);
- NETLIBSELECTEX nls = { 0 };
- nls.cbSize = sizeof(nls);
+ NETLIBSELECTEX nls = {};
for (int i = 0; i < m_arThreads.getCount(); i++) {
ThreadData &T = m_arThreads[i];
@@ -329,7 +328,7 @@ void CMsnProto::MSN_CloseConnections(void)
case SERVER_SWITCHBOARD:
if (T.s != NULL && !T.sessionClosed && !T.termPending) {
nls.hReadConns[0] = T.s;
- int res = CallService(MS_NETLIB_SELECTEX, 0, (LPARAM)&nls);
+ int res = Netlib_SelectEx(&nls);
if (res >= 0 || nls.hReadStatus[0] == 0)
T.sendTerminate();
}
@@ -616,13 +615,12 @@ void ThreadData::applyGatewayData(HANDLE hConn, bool isPoll)
proto->debugLogA("applying '%s' to %08X [%08X]", szHttpPostUrl, this, GetCurrentThreadId());
- NETLIBHTTPPROXYINFO nlhpi = { 0 };
- nlhpi.cbSize = sizeof(nlhpi);
+ NETLIBHTTPPROXYINFO nlhpi = {};
nlhpi.flags = NLHPIF_HTTP11;
nlhpi.szHttpGetUrl = NULL;
nlhpi.szHttpPostUrl = szHttpPostUrl;
nlhpi.combinePackets = 5;
- CallService(MS_NETLIB_SETHTTPPROXYINFO, (WPARAM)hConn, (LPARAM)&nlhpi);
+ Netlib_SetHttpProxyInfo(hConn, &nlhpi);
}
void ThreadData::getGatewayUrl(char* dest, int destlen, bool isPoll)
diff --git a/protocols/MSN/src/msn_ws.cpp b/protocols/MSN/src/msn_ws.cpp
index 1c7dcd07e9..c82c660e8f 100644
--- a/protocols/MSN/src/msn_ws.cpp
+++ b/protocols/MSN/src/msn_ws.cpp
@@ -31,7 +31,7 @@ int ThreadData::send(const char data[], size_t datalen)
if (proto->usingGateway && !(mType == SERVER_FILETRANS || mType == SERVER_P2P_DIRECT)) {
mGatewayTimeout = 2;
- CallService(MS_NETLIB_SETPOLLINGTIMEOUT, WPARAM(s), mGatewayTimeout);
+ Netlib_SetPollingTimeout(s, mGatewayTimeout);
}
int rlen = Netlib_Send(s, data, (int)datalen);
@@ -113,13 +113,13 @@ int ThreadData::recv(char* data, size_t datalen)
{
if (!proto->usingGateway) {
resetTimeout();
- NETLIBSELECT nls = { 0 };
- nls.cbSize = sizeof(nls);
+
+ NETLIBSELECT nls = {};
nls.dwTimeout = 1000;
nls.hReadConns[0] = s;
for (;;) {
- int ret = CallService(MS_NETLIB_SELECT, 0, (LPARAM)&nls);
+ int ret = Netlib_Select(&nls);
if (ret < 0) {
proto->debugLogA("Connection abortively closed, error %d", WSAGetLastError());
return ret;
@@ -149,13 +149,13 @@ LBL_RecvAgain:
if (sessionClosed || isTimeout()) return 0;
if ((mGatewayTimeout += 2) > 20) mGatewayTimeout = 20;
- CallService(MS_NETLIB_SETPOLLINGTIMEOUT, WPARAM(s), mGatewayTimeout);
+ Netlib_SetPollingTimeout(s, mGatewayTimeout);
goto LBL_RecvAgain;
}
else {
resetTimeout();
mGatewayTimeout = 1;
- CallService(MS_NETLIB_SETPOLLINGTIMEOUT, WPARAM(s), mGatewayTimeout);
+ Netlib_SetPollingTimeout(s, mGatewayTimeout);
}
}
diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp
index b6956a3095..d5cd06e298 100644
--- a/protocols/Tlen/src/tlen_thread.cpp
+++ b/protocols/Tlen/src/tlen_thread.cpp
@@ -1305,14 +1305,13 @@ static void TlenProcessV(XmlNode *node, ThreadData *info)
static void __cdecl TlenKeepAliveThread(void *ptr)
{
- NETLIBSELECT nls = {0};
-
TlenProtocol *proto = (TlenProtocol *)ptr;
- nls.cbSize = sizeof(NETLIBSELECT);
+
+ NETLIBSELECT nls = {};
nls.dwTimeout = 60000; // 60000 millisecond (1 minute)
nls.hExceptConns[0] = proto->threadData->s;
for (;;) {
- if (CallService(MS_NETLIB_SELECT, 0, (LPARAM) &nls) != 0)
+ if (Netlib_Select(&nls) != 0)
break;
if (proto->tlenOptions.sendKeepAlive)
TlenSend(proto, " \t ");