diff options
author | George Hazan <ghazan@miranda.im> | 2017-01-13 00:01:59 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-01-13 00:01:59 +0300 |
commit | e145db68fb5b7d0682a4b2be0174cebfe47dd74e (patch) | |
tree | c8f9edc907876d236eb16bc8ca8b592accb9846f /plugins | |
parent | 3cb3883908e3168e5f955be3143771721614307a (diff) |
a bit less netlib services
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/HTTPServer/src/main.cpp | 9 | ||||
-rw-r--r-- | plugins/Ping/src/utils.cpp | 2 | ||||
-rw-r--r-- | plugins/Utils.pas/mirutils.pas | 2 | ||||
-rwxr-xr-x | plugins/Watrack_MPD/src/main.cpp | 29 | ||||
-rw-r--r-- | plugins/Weather/src/weather.cpp | 2 | ||||
-rw-r--r-- | plugins/YAMN/src/proto/netlib.cpp | 5 |
6 files changed, 18 insertions, 31 deletions
diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index 1f9c89dc22..c9f69a61a6 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -634,12 +634,11 @@ static int nProtoAck(WPARAM /*wParam*/, LPARAM lParam) INT_PTR nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/)
{
if (!hDirectBoundPort) {
- NETLIBUSERSETTINGS nus = { 0 };
+ NETLIBUSERSETTINGS nus = {};
nus.cbSize = sizeof(nus);
- if (!CallService(MS_NETLIB_GETUSERSETTINGS, (WPARAM)hNetlibUser, (LPARAM)&nus))
- Netlib_Logf(hNetlibUser, "Failed to get NETLIBUSERSETTINGS using MS_NETLIB_GETUSERSETTINGS");
+ Netlib_GetUserSettings(hNetlibUser, &nus);
- NETLIBBIND nlb = { 0 };
+ NETLIBBIND nlb = {};
nlb.cbSize = sizeof(NETLIBBIND);
nlb.pfnNewConnection = ConnectionOpen;
if (nus.specifyIncomingPorts && nus.szIncomingPorts && nus.szIncomingPorts[0])
@@ -647,7 +646,7 @@ INT_PTR nToggelAcceptConnections(WPARAM wparam, LPARAM /*lparam*/) else
nlb.wPort = 80;
- hDirectBoundPort = (HANDLE)CallService(MS_NETLIB_BINDPORT, (WPARAM)hNetlibUser, (LPARAM)& nlb);
+ hDirectBoundPort = Netlib_BindPort(hNetlibUser, &nlb);
if (!hDirectBoundPort) {
char szTemp[200];
mir_snprintf(szTemp, Translate("Failed to bind to port %s\r\nThis is most likely because another program or service is using this port"),
diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp index f1882181dc..949c8cd1ee 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 = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hNetlibUser, (LPARAM)&conn);
+ HANDLE s = Netlib_OpenConnection(hNetlibUser, &conn);
mir_free((void*)conn.szHost);
clock_t end_tcp = clock();
diff --git a/plugins/Utils.pas/mirutils.pas b/plugins/Utils.pas/mirutils.pas index 46cc56aa94..f6ffad2c6a 100644 --- a/plugins/Utils.pas/mirutils.pas +++ b/plugins/Utils.pas/mirutils.pas @@ -543,7 +543,7 @@ var begin
result:=nil;
nlus.cbSize:=SizeOf(nlus);
- if CallService(MS_NETLIB_GETUSERSETTINGS,hNetLib,lparam(@nlus))<>0 then
+ if Netlib_GetUserSettings(hNetLib,@nlus)<>0 then
begin
if nlus.useProxy<>0 then
begin
diff --git a/plugins/Watrack_MPD/src/main.cpp b/plugins/Watrack_MPD/src/main.cpp index a4ca0c1943..a923777982 100755 --- a/plugins/Watrack_MPD/src/main.cpp +++ b/plugins/Watrack_MPD/src/main.cpp @@ -31,9 +31,9 @@ void Start(void*) nloc.flags = NLOCF_V2; nloc.wPort = gbPort; Connected = FALSE; - ghConnection = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)ghNetlibUser, (LPARAM)&nloc); - if(ghConnection) - ghPacketReciever = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER,(WPARAM)ghConnection,2048); + ghConnection = Netlib_OpenConnection(ghNetlibUser, &nloc); + if (ghConnection) + ghPacketReciever = Netlib_CreatePacketReceiver(ghConnection, 2048); } void ReStart(void*) @@ -48,12 +48,11 @@ void ReStart(void*) int Parser() { - static NETLIBPACKETRECVER nlpr = {0}; + static NETLIBPACKETRECVER nlpr = {}; char *ptr; int i; char *buf; static char ver[16]; - nlpr.cbSize = sizeof(nlpr); nlpr.dwTimeout = 5; if(!ghConnection) { @@ -62,21 +61,11 @@ int Parser() if(ghConnection) { int recvResult; -/* do - { - recvResult = CallService(MS_NETLIB_GETMOREPACKETS,(WPARAM)ghPacketReciever, (LPARAM)&nlpr); - if(recvResult == SOCKET_ERROR) - { - ReStart(); - return 1; - } - } - while(recvResult > 0);*/ if(!Connected) { char tmp[128]; char *tmp2 = mir_u2a(gbPassword); - recvResult = CallService(MS_NETLIB_GETMOREPACKETS,(WPARAM)ghPacketReciever, (LPARAM)&nlpr); + recvResult = Netlib_GetMorePackets(ghPacketReciever, &nlpr); if(recvResult == SOCKET_ERROR) { mir_forkthread(&ReStart, 0); @@ -89,7 +78,7 @@ int Parser() mir_strcat(tmp, tmp2); mir_strcat(tmp, "\n"); Netlib_Send(ghConnection, tmp, (int)mir_strlen(tmp), 0); - recvResult = CallService(MS_NETLIB_GETMOREPACKETS,(WPARAM)ghPacketReciever, (LPARAM)&nlpr); + recvResult = Netlib_GetMorePackets(ghPacketReciever, &nlpr); if(recvResult == SOCKET_ERROR) { mir_forkthread(&ReStart, 0); @@ -99,14 +88,14 @@ int Parser() mir_free(tmp2); } Netlib_Send(ghConnection, "status\n", (int)mir_strlen("status\n"), 0); - recvResult = CallService(MS_NETLIB_GETMOREPACKETS,(WPARAM)ghPacketReciever, (LPARAM)&nlpr); + recvResult = Netlib_GetMorePackets(ghPacketReciever, &nlpr); if(recvResult == SOCKET_ERROR) { mir_forkthread(&ReStart, 0); return 1; } Netlib_Send(ghConnection, "currentsong\n", (int)mir_strlen("currentsong\n"), 0); - recvResult = CallService(MS_NETLIB_GETMOREPACKETS,(WPARAM)ghPacketReciever, (LPARAM)&nlpr); + recvResult = Netlib_GetMorePackets(ghPacketReciever, &nlpr); if(recvResult == SOCKET_ERROR) { mir_forkthread(&ReStart, 0); @@ -274,7 +263,7 @@ void Stop() if(ghConnection) Netlib_CloseHandle(ghConnection); if(ghNetlibUser && (ghNetlibUser != INVALID_HANDLE_VALUE)) - CallService(MS_NETLIB_SHUTDOWN,(WPARAM)ghNetlibUser,0); + Netlib_Shutdown(ghNetlibUser); } int Init() diff --git a/plugins/Weather/src/weather.cpp b/plugins/Weather/src/weather.cpp index 75ef89f777..827b5514eb 100644 --- a/plugins/Weather/src/weather.cpp +++ b/plugins/Weather/src/weather.cpp @@ -92,7 +92,7 @@ int WeatherShutdown(WPARAM, LPARAM) SaveOptions(); // save options once more
status = ID_STATUS_OFFLINE; // set status to offline
- CallService(MS_NETLIB_SHUTDOWN, (WPARAM)hNetlibHttp, 0);
+ Netlib_Shutdown(hNetlibHttp);
WindowList_Broadcast(hWindowList, WM_CLOSE, 0, 0);
WindowList_Broadcast(hDataWindowList, WM_CLOSE, 0, 0);
diff --git a/plugins/YAMN/src/proto/netlib.cpp b/plugins/YAMN/src/proto/netlib.cpp index df4dc150e6..b6405b7e90 100644 --- a/plugins/YAMN/src/proto/netlib.cpp +++ b/plugins/YAMN/src/proto/netlib.cpp @@ -85,8 +85,6 @@ void CNLClient::SSLify() throw(DWORD) //if not success, exception is throwed
void CNLClient::Connect(const char* servername, const int port) throw(DWORD)
{
- NETLIBOPENCONNECTION nloc;
-
NetworkError = SystemError = 0;
isTLSed = false;
@@ -94,11 +92,12 @@ void CNLClient::Connect(const char* servername, const int port) throw(DWORD) DebugLog(CommFile, "<connect>\n");
#endif
try {
+ NETLIBOPENCONNECTION nloc;
nloc.cbSize = sizeof(NETLIBOPENCONNECTION);
nloc.szHost = servername;
nloc.wPort = port;
nloc.flags = 0;
- if (NULL == (hConnection = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hNetlibUser, (LPARAM)&nloc))) {
+ if (NULL == (hConnection = Netlib_OpenConnection(hNetlibUser, &nloc))) {
SystemError = WSAGetLastError();
throw NetworkError = (DWORD)ENL_CONNECT;
}
|