From d958e3fb847813075cc059bd5a7aa28252982268 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 11 Jan 2017 22:23:57 +0300 Subject: strong typization - better typization --- protocols/IcqOscarJ/src/icq_proto.cpp | 12 ++++++------ protocols/IcqOscarJ/src/icq_proto.h | 2 +- protocols/IcqOscarJ/src/utilities.cpp | 8 ++++---- protocols/IcqOscarJ/src/utilities.h | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) (limited to 'protocols/IcqOscarJ') diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index d9ed1b32dd..e385a13aec 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -156,10 +156,10 @@ CIcqProto::CIcqProto(const char* aProtoName, const wchar_t* aUserName) : HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &CIcqProto::OnPreBuildStatusMenu); // Register netlib users - NETLIBUSER nlu = { 0 }; wchar_t szBuffer[MAX_PATH + 64]; mir_snwprintf(szBuffer, TranslateT("%s server connection"), m_tszUserName); - nlu.cbSize = sizeof(nlu); + + NETLIBUSER nlu = {}; nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.ptszDescriptiveName = szBuffer; nlu.szSettingsModule = m_szModuleName; @@ -169,7 +169,7 @@ CIcqProto::CIcqProto(const char* aProtoName, const wchar_t* aUserName) : nlu.pfnHttpGatewayBegin = icq_httpGatewayBegin; nlu.pfnHttpGatewayWrapSend = icq_httpGatewayWrapSend; nlu.pfnHttpGatewayUnwrapRecv = icq_httpGatewayUnwrapRecv; - m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); + m_hNetlibUser = Netlib_RegisterUser(&nlu); char szP2PModuleName[MAX_PATH]; mir_snprintf(szP2PModuleName, "%sP2P", m_szModuleName); @@ -178,7 +178,7 @@ CIcqProto::CIcqProto(const char* aProtoName, const wchar_t* aUserName) : nlu.ptszDescriptiveName = szBuffer; nlu.szSettingsModule = szP2PModuleName; nlu.minIncomingPorts = 1; - m_hDirectNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu); + m_hDirectNetlibUser = Netlib_RegisterUser(&nlu); // Register custom database events DBEVENTTYPEDESCR eventType = { sizeof(eventType) }; @@ -211,8 +211,8 @@ CIcqProto::~CIcqProto() delete m_arAvatars[i]; // NetLib clean-up - NetLib_SafeCloseHandle(&m_hDirectNetlibUser); - NetLib_SafeCloseHandle(&m_hNetlibUser); + Netlib_CloseHandle(m_hDirectNetlibUser); + Netlib_CloseHandle(m_hNetlibUser); // Destroy hookable events if (m_modeMsgsEvent) diff --git a/protocols/IcqOscarJ/src/icq_proto.h b/protocols/IcqOscarJ/src/icq_proto.h index 3c5da05d35..7fa039a78b 100644 --- a/protocols/IcqOscarJ/src/icq_proto.h +++ b/protocols/IcqOscarJ/src/icq_proto.h @@ -140,7 +140,7 @@ struct CIcqProto : public PROTO int __cdecl OnPreBuildStatusMenu(WPARAM, LPARAM); //====| Data |======================================================================== - HANDLE m_hDirectNetlibUser; + HNETLIBUSER m_hDirectNetlibUser; BYTE m_bGatewayMode; BYTE m_bSecureLogin; diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index 49ef420754..7ad7f12dbf 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(HANDLE hUser, const char* szIdent, NETLIBOPENCONNECTION* nloc) +HANDLE NetLib_OpenConnection(HNETLIBUSER hUser, const char* szIdent, NETLIBOPENCONNECTION* nloc) { Netlib_Logf(hUser, "%sConnecting to %s:%u", szIdent ? szIdent : "", nloc->szHost, nloc->wPort); @@ -1417,7 +1417,7 @@ int CIcqProto::NetLog_Direct(const char *fmt, ...) va_start(va, fmt); mir_vsnprintf(szText, sizeof(szText), fmt, va); va_end(va); - return CallService(MS_NETLIB_LOG, (WPARAM)m_hDirectNetlibUser, (LPARAM)szText); + return Netlib_Log(m_hDirectNetlibUser, szText); } int CIcqProto::NetLog_Uni(BOOL bDC, const char *fmt, ...) @@ -1428,8 +1428,8 @@ int CIcqProto::NetLog_Uni(BOOL bDC, const char *fmt, ...) mir_vsnprintf(szText, sizeof(szText), fmt, va); va_end(va); - HANDLE hNetlib = (bDC) ? m_hDirectNetlibUser : m_hNetlibUser; - return CallService(MS_NETLIB_LOG, (WPARAM)hNetlib, (LPARAM)szText); + HNETLIBUSER hNetlib = (bDC) ? m_hDirectNetlibUser : m_hNetlibUser; + return Netlib_Log(hNetlib, szText); } char* __fastcall ICQTranslateUtf(const char *src) diff --git a/protocols/IcqOscarJ/src/utilities.h b/protocols/IcqOscarJ/src/utilities.h index 119ebe79eb..ad5907c1bb 100644 --- a/protocols/IcqOscarJ/src/utilities.h +++ b/protocols/IcqOscarJ/src/utilities.h @@ -95,7 +95,7 @@ __inline static void SAFE_FREE(WCHAR** str) { SAFE_FREE((void**)str); } DWORD ICQWaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds, int bWaitAlways = FALSE); -HANDLE NetLib_OpenConnection(HANDLE hUser, const char* szIdent, NETLIBOPENCONNECTION* nloc); +HANDLE NetLib_OpenConnection(HNETLIBUSER hUser, const char* szIdent, NETLIBOPENCONNECTION* nloc); void NetLib_CloseConnection(HANDLE *hConnection, int bServerConn); void NetLib_SafeCloseHandle(HANDLE *hConnection); -- cgit v1.2.3