From 2600097dcc6e357d4d8df6105e9afb66b6d4b296 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 31 Jan 2017 19:01:52 +0300 Subject: - NUF_HTTPGATEWAY: unused option removed; - NETLIBUSER::szDescriptiveName replaced with MAllStrings; - code cleaning. --- include/delphi/m_netlib.inc | 3 --- include/m_core.h | 2 +- include/m_netlib.h | 10 +++------- plugins/Console/src/Console.cpp | 2 +- plugins/CrashDumper/src/upload.cpp | 2 +- plugins/CryptoPP/src/main.cpp | 2 +- plugins/Dropbox/src/dropbox_events.cpp | 2 +- plugins/HTTPServer/src/main.cpp | 2 +- plugins/LotusNotify/src/debug.cpp | 2 +- plugins/MirFox/src/MirandaUtils.cpp | 2 +- plugins/MirLua/src/main.cpp | 2 +- plugins/NewsAggregator/Src/Utils.cpp | 4 ++-- plugins/Non-IM Contact/src/http.cpp | 2 +- plugins/PackUpdater/Src/Utils.cpp | 4 ++-- plugins/PasteIt/src/PasteIt.cpp | 2 +- plugins/Ping/src/ping.cpp | 7 +------ plugins/PluginUpdater/src/Utils.cpp | 4 ++-- plugins/Quotes/src/HTTPSession.cpp | 2 +- plugins/SecureIM/src/commonheaders.cpp | 2 +- plugins/SendScreenshotPlus/src/Main.cpp | 2 +- plugins/SmileyAdd/src/download.cpp | 2 +- plugins/Watrack_MPD/src/init.cpp | 2 +- plugins/Weather/src/weather_http.cpp | 2 +- plugins/WebView/src/main.cpp | 2 +- plugins/YAMN/src/proto/netlib.cpp | 2 +- protocols/AimOscar/src/proto.cpp | 2 +- protocols/Discord/src/proto.cpp | 4 ++-- protocols/FacebookRM/src/proto.cpp | 2 +- protocols/Gadu-Gadu/src/gg_proto.cpp | 2 +- protocols/IRCG/src/ircproto.cpp | 4 ++-- protocols/IcqOscarJ/src/icq_proto.cpp | 4 ++-- protocols/JabberG/src/jabber_ws.cpp | 4 ++-- protocols/MRA/src/MraAvatars.cpp | 2 +- protocols/MRA/src/MraProto.cpp | 2 +- protocols/MSN/src/msn_proto.cpp | 4 ++-- protocols/MinecraftDynmap/src/proto.cpp | 5 +++-- protocols/Omegle/src/proto.cpp | 2 +- protocols/Sametime/src/sametime_proto.cpp | 2 +- protocols/SkypeWeb/src/skype_network.cpp | 2 +- protocols/Steam/src/steam_proto.cpp | 2 +- protocols/Tlen/src/tlen_ws.cpp | 4 ++-- protocols/Tox/src/tox_netlib.cpp | 2 +- protocols/Twitter/src/proto.cpp | 4 ++-- protocols/VKontakte/src/vk_proto.cpp | 2 +- protocols/WhatsApp/src/proto.cpp | 2 +- src/mir_app/src/netlib.cpp | 10 +++++----- src/mir_app/src/netliblog.cpp | 2 +- src/mir_app/src/netlibopenconn.cpp | 9 +++++---- src/mir_app/src/netlibopts.cpp | 18 ++++++++++-------- 49 files changed, 79 insertions(+), 87 deletions(-) diff --git a/include/delphi/m_netlib.inc b/include/delphi/m_netlib.inc index ab60822163..1ab6c9fa8b 100644 --- a/include/delphi/m_netlib.inc +++ b/include/delphi/m_netlib.inc @@ -31,9 +31,6 @@ const // for TNETLIBUSER.flags NUF_INCOMING = $01; // bind incoming ports NUF_OUTGOING = $02; // makes outgoing plain connections - NUF_HTTPGATEWAY = $04; // can use HTTP gateway for plain sockets. - // ???HttpGateway* are valid, enables the HTTP - // proxy option, displayed in options NUF_NOOPTIONS = $08; // don't show this as an entry for custom settings to // be defined for, TNETLIB.szDescriptiveName is ignored NUF_HTTPCONNS = $10; // some connections are made for HTTP communication, diff --git a/include/m_core.h b/include/m_core.h index 2f5073cf16..e02d594c66 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -124,7 +124,7 @@ MIR_CORE_DLL(bool) ServiceExists(const char *name); MIR_CORE_DLL(INT_PTR) CallService(const char *name, WPARAM wParam = 0, LPARAM lParam = 0); MIR_CORE_DLL(INT_PTR) CallServiceSync(const char *name, WPARAM wParam = 0, LPARAM lParam = 0); -MIR_CORE_DLL(INT_PTR) CallFunctionSync(INT_PTR(__stdcall *func)(void *), void *arg); +MIR_CORE_DLL(INT_PTR) CallFunctionSync(INT_PTR(__stdcall *func)(void *), void *arg); MIR_CORE_DLL(int) CallFunctionAsync(void (__stdcall *func)(void *), void *arg); MIR_CORE_DLL(void) KillModuleServices(HINSTANCE hInst); MIR_CORE_DLL(void) KillObjectServices(void* pObject); diff --git a/include/m_netlib.h b/include/m_netlib.h index 7f71da3dd3..e2b15ab90b 100644 --- a/include/m_netlib.h +++ b/include/m_netlib.h @@ -64,11 +64,8 @@ typedef PBYTE (*NETLIBHTTPGATEWAYUNWRAPRECVPROC)(NETLIBHTTPREQUEST *nlhr, PBYTE struct NETLIBUSER { - char *szSettingsModule; // used for db settings and log - union { - char *szDescriptiveName; // used in options dialog, already translated - wchar_t *ptszDescriptiveName; - }; + char *szSettingsModule; // used for db settings and log + MAllStrings szDescriptiveName; // used in options dialog, already translated DWORD flags; char *szHttpGatewayHello; char *szHttpGatewayUserAgent; // can be NULL to send no user-agent, also used by HTTPS proxies @@ -76,12 +73,11 @@ struct NETLIBUSER NETLIBHTTPGATEWAYBEGINPROC pfnHttpGatewayBegin; // can be NULL if no beginning required NETLIBHTTPGATEWAYWRAPSENDPROC pfnHttpGatewayWrapSend; // can be NULL if no wrapping required NETLIBHTTPGATEWAYUNWRAPRECVPROC pfnHttpGatewayUnwrapRecv; // can be NULL if no wrapping required - int minIncomingPorts; // only if NUF_INCOMING. Will be used for validation of user input. + int minIncomingPorts; // only if NUF_INCOMING. Will be used for validation of user input. }; #define NUF_INCOMING 0x01 // binds incoming ports #define NUF_OUTGOING 0x02 // makes outgoing plain connections -#define NUF_HTTPGATEWAY 0x04 // can use HTTP gateway for plain sockets. ???HttpGateway* are valid. Enables the HTTP proxy option in options. #define NUF_NOOPTIONS 0x08 // don't create an options page for this. szDescriptiveName is never used. #define NUF_HTTPCONNS 0x10 // at least some connections are made for HTTP communication. Enables the HTTP proxy option in options. #define NUF_NOHTTPSOPTION 0x20 // disable the HTTPS proxy option in options. Use this if all communication is HTTP. diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp index 542baf1dc0..dec5f24afb 100644 --- a/plugins/Console/src/Console.cpp +++ b/plugins/Console/src/Console.cpp @@ -932,7 +932,7 @@ static int OnFastDump(WPARAM wParam, LPARAM lParam) DUMPMSG *dumpMsg = (DUMPMSG *)mir_alloc(len); wchar_t *str = dumpMsg->szMsg; - char *szModule = (wParam) ? ((NETLIBUSER *)wParam)->szDescriptiveName : "[Core]"; + char *szModule = (wParam) ? ((NETLIBUSER *)wParam)->szDescriptiveName.a : "[Core]"; mir_strncpy(dumpMsg->szModule, szModule, _countof(dumpMsg->szModule)); wchar_t *ucs2 = mir_a2u(logMsg->pszHead); diff --git a/plugins/CrashDumper/src/upload.cpp b/plugins/CrashDumper/src/upload.cpp index 26359b0b74..7b0eff23b2 100644 --- a/plugins/CrashDumper/src/upload.cpp +++ b/plugins/CrashDumper/src/upload.cpp @@ -217,7 +217,7 @@ void UploadInit(void) NETLIBUSER nlu = {}; nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_UNICODE; nlu.szSettingsModule = (char*)PluginName; - nlu.ptszDescriptiveName = TranslateT("Crash Dumper HTTP connections"); + nlu.szDescriptiveName.w = TranslateT("Crash Dumper HTTP connections"); hNetlibUser = Netlib_RegisterUser(&nlu); } diff --git a/plugins/CryptoPP/src/main.cpp b/plugins/CryptoPP/src/main.cpp index 3b2c814f29..dc5e3c67e9 100644 --- a/plugins/CryptoPP/src/main.cpp +++ b/plugins/CryptoPP/src/main.cpp @@ -121,7 +121,7 @@ void InitNetlib() { NETLIBUSER nl_user = {}; nl_user.szSettingsModule = (LPSTR)szModuleName; - nl_user.szDescriptiveName = (LPSTR)szModuleName; + nl_user.szDescriptiveName.a = (LPSTR)szModuleName; nl_user.flags = NUF_NOOPTIONS; hNetlibUser = Netlib_RegisterUser(&nl_user); } diff --git a/plugins/Dropbox/src/dropbox_events.cpp b/plugins/Dropbox/src/dropbox_events.cpp index 0384bb127c..77f5e2c820 100644 --- a/plugins/Dropbox/src/dropbox_events.cpp +++ b/plugins/Dropbox/src/dropbox_events.cpp @@ -26,7 +26,7 @@ int CDropbox::OnModulesLoaded(WPARAM, LPARAM) NETLIBUSER nlu = {}; nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = MODULE; - nlu.ptszDescriptiveName = L"Dropbox"; + nlu.szDescriptiveName.w = L"Dropbox"; hNetlibConnection = Netlib_RegisterUser(&nlu); GetDefaultContact(); diff --git a/plugins/HTTPServer/src/main.cpp b/plugins/HTTPServer/src/main.cpp index 2670c256f0..a6126e8f51 100644 --- a/plugins/HTTPServer/src/main.cpp +++ b/plugins/HTTPServer/src/main.cpp @@ -741,7 +741,7 @@ int MainInit(WPARAM /*wparam*/, LPARAM /*lparam*/) NETLIBUSER nlu = {}; nlu.flags = NUF_OUTGOING | NUF_INCOMING; nlu.szSettingsModule = MODULE; - nlu.szDescriptiveName = Translate("HTTP Server"); + nlu.szDescriptiveName.a = Translate("HTTP Server"); hNetlibUser = Netlib_RegisterUser(& nlu); if (!hNetlibUser) { MessageBox(NULL, "Failed to register NetLib user", MSG_BOX_TITEL, MB_OK); diff --git a/plugins/LotusNotify/src/debug.cpp b/plugins/LotusNotify/src/debug.cpp index e814d6f508..6c59964094 100644 --- a/plugins/LotusNotify/src/debug.cpp +++ b/plugins/LotusNotify/src/debug.cpp @@ -8,7 +8,7 @@ void logRegister(){ NETLIBUSER nlu = {}; nlu.flags = NUF_UNICODE | NUF_NOOPTIONS; nlu.szSettingsModule = PLUGINNAME; - nlu.ptszDescriptiveName = mir_a2u(PLUGINNAME); + nlu.szDescriptiveName.w = mir_a2u(PLUGINNAME); netlibHandle = Netlib_RegisterUser(&nlu); } diff --git a/plugins/MirFox/src/MirandaUtils.cpp b/plugins/MirFox/src/MirandaUtils.cpp index a5b89fbf77..c0bbeded82 100644 --- a/plugins/MirFox/src/MirandaUtils.cpp +++ b/plugins/MirFox/src/MirandaUtils.cpp @@ -32,7 +32,7 @@ void MirandaUtils::netlibRegister(){ NETLIBUSER nlu = {}; nlu.flags = NUF_UNICODE | NUF_NOOPTIONS; nlu.szSettingsModule = PLUGIN_DB_ID; - nlu.ptszDescriptiveName = TranslateT("MirFox log"); + nlu.szDescriptiveName.w = TranslateT("MirFox log"); netlibHandle = Netlib_RegisterUser(&nlu); } diff --git a/plugins/MirLua/src/main.cpp b/plugins/MirLua/src/main.cpp index 03aed915d7..7648ecf930 100644 --- a/plugins/MirLua/src/main.cpp +++ b/plugins/MirLua/src/main.cpp @@ -62,7 +62,7 @@ extern "C" int __declspec(dllexport) Load(void) NETLIBUSER nlu = {}; nlu.flags = NUF_NOOPTIONS; - nlu.szDescriptiveName = MODULE; + nlu.szDescriptiveName.a = MODULE; nlu.szSettingsModule = MODULE; hNetlib = Netlib_RegisterUser(&nlu); diff --git a/plugins/NewsAggregator/Src/Utils.cpp b/plugins/NewsAggregator/Src/Utils.cpp index 242218e4c1..e9863f83a5 100644 --- a/plugins/NewsAggregator/Src/Utils.cpp +++ b/plugins/NewsAggregator/Src/Utils.cpp @@ -32,8 +32,8 @@ bool IsMyContact(MCONTACT hContact) void NetlibInit() { NETLIBUSER nlu = {}; - nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE; // | NUF_HTTPGATEWAY; - nlu.ptszDescriptiveName = TranslateT("NewsAggregator HTTP connection"); + nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE; + nlu.szDescriptiveName.w = TranslateT("NewsAggregator HTTP connection"); nlu.szSettingsModule = MODULE; hNetlibUser = Netlib_RegisterUser(&nlu); } diff --git a/plugins/Non-IM Contact/src/http.cpp b/plugins/Non-IM Contact/src/http.cpp index 38eb3c510d..54e16954e4 100644 --- a/plugins/Non-IM Contact/src/http.cpp +++ b/plugins/Non-IM Contact/src/http.cpp @@ -95,6 +95,6 @@ void NetlibInit() NETLIBUSER nlu = {}; nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_UNICODE; nlu.szSettingsModule = MODNAME; - nlu.ptszDescriptiveName = TranslateT("Non-IM Contacts"); + nlu.szDescriptiveName.w = TranslateT("Non-IM Contacts"); hNetlibUser = Netlib_RegisterUser(&nlu); } diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp index 9396d59be2..9a8ce67da2 100644 --- a/plugins/PackUpdater/Src/Utils.cpp +++ b/plugins/PackUpdater/Src/Utils.cpp @@ -50,8 +50,8 @@ void IcoLibInit() BOOL NetlibInit() { NETLIBUSER nlu = {}; - nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE; // | NUF_HTTPGATEWAY; - nlu.ptszDescriptiveName = TranslateT("Pack Updater HTTP connection"); + nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE; + nlu.szDescriptiveName.w = TranslateT("Pack Updater HTTP connection"); nlu.szSettingsModule = MODNAME; hNetlibUser = Netlib_RegisterUser(&nlu); diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index ce2c20ad34..19a818d1bd 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -394,7 +394,7 @@ extern "C" int __declspec(dllexport) Load(void) NETLIBUSER nlu = {}; nlu.flags = NUF_UNICODE | NUF_OUTGOING | NUF_HTTPCONNS; nlu.szSettingsModule = MODULE; - nlu.ptszDescriptiveName = TranslateT("Paste It HTTP connections"); + nlu.szDescriptiveName.w = TranslateT("Paste It HTTP connections"); g_hNetlibUser = Netlib_RegisterUser(&nlu); pasteToWebs[0] = new PasteToWeb1(); diff --git a/plugins/Ping/src/ping.cpp b/plugins/Ping/src/ping.cpp index 45096e79c7..7688afb496 100644 --- a/plugins/Ping/src/ping.cpp +++ b/plugins/Ping/src/ping.cpp @@ -86,12 +86,7 @@ int OnModulesLoaded(WPARAM, LPARAM) NETLIBUSER nl_user = {}; nl_user.szSettingsModule = PLUG; nl_user.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; - nl_user.ptszDescriptiveName = TranslateT("Ping Plugin"); - nl_user.szHttpGatewayHello = 0; - nl_user.szHttpGatewayUserAgent = 0; - nl_user.pfnHttpGatewayInit = 0; - nl_user.pfnHttpGatewayWrapSend = 0; - nl_user.pfnHttpGatewayUnwrapRecv = 0; + nl_user.szDescriptiveName.w = TranslateT("Ping Plugin"); hNetlibUser = Netlib_RegisterUser(&nl_user); diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index 73d8036345..c136c5c20c 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -58,8 +58,8 @@ void InitIcoLib() void InitNetlib() { NETLIBUSER nlu = {}; - nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE; // | NUF_HTTPGATEWAY; - nlu.ptszDescriptiveName = TranslateT("Plugin Updater HTTP connections"); + nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE; + nlu.szDescriptiveName.w = TranslateT("Plugin Updater HTTP connections"); nlu.szSettingsModule = MODNAME; hNetlibUser = Netlib_RegisterUser(&nlu); } diff --git a/plugins/Quotes/src/HTTPSession.cpp b/plugins/Quotes/src/HTTPSession.cpp index 345b3d0cec..7c9ea5a880 100644 --- a/plugins/Quotes/src/HTTPSession.cpp +++ b/plugins/Quotes/src/HTTPSession.cpp @@ -35,7 +35,7 @@ public: NETLIBUSER nlu = {}; nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_UNICODE; nlu.szSettingsModule = QUOTES_PROTOCOL_NAME; - nlu.ptszDescriptiveName = TranslateT("Quotes HTTP connections"); + nlu.szDescriptiveName.w = TranslateT("Quotes HTTP connections"); g_hNetLib = Netlib_RegisterUser(&nlu); return (NULL != g_hNetLib); } diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp index 199942925c..31fe1d8792 100644 --- a/plugins/SecureIM/src/commonheaders.cpp +++ b/plugins/SecureIM/src/commonheaders.cpp @@ -99,7 +99,7 @@ void InitNetlib() { NETLIBUSER nl_user = {}; nl_user.szSettingsModule = (LPSTR)MODULENAME; - nl_user.szDescriptiveName = (LPSTR)MODULENAME; + nl_user.szDescriptiveName.a = (LPSTR)MODULENAME; nl_user.flags = NUF_NOOPTIONS; hNetlibUser = Netlib_RegisterUser(&nl_user); diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp index 9ad0d286f5..9b9645c8f9 100644 --- a/plugins/SendScreenshotPlus/src/Main.cpp +++ b/plugins/SendScreenshotPlus/src/Main.cpp @@ -234,7 +234,7 @@ int hook_ModulesLoaded(WPARAM, LPARAM) // Netlib register NETLIBUSER nlu = {}; nlu.szSettingsModule = __PLUGIN_NAME; - nlu.ptszDescriptiveName = TranslateT("SendSS HTTP connections"); + nlu.szDescriptiveName.w = TranslateT("SendSS HTTP connections"); nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; //|NUF_NOHTTPSOPTION; g_hNetlibUser = Netlib_RegisterUser(&nlu); // load my button class / or use UInfoEx diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index 04df9baf8a..3d0c5ebcba 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -221,7 +221,7 @@ void DownloadInit(void) NETLIBUSER nlu = {}; nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_UNICODE; nlu.szSettingsModule = MODULENAME; - nlu.ptszDescriptiveName = TranslateT("SmileyAdd HTTP connections"); + nlu.szDescriptiveName.w = TranslateT("SmileyAdd HTTP connections"); hNetlibUser = Netlib_RegisterUser(&nlu); GetSmileyCacheFolder(); diff --git a/plugins/Watrack_MPD/src/init.cpp b/plugins/Watrack_MPD/src/init.cpp index 2d2989289c..4ed6cfb8ee 100755 --- a/plugins/Watrack_MPD/src/init.cpp +++ b/plugins/Watrack_MPD/src/init.cpp @@ -59,7 +59,7 @@ static int OnModulesLoaded(WPARAM, LPARAM) { NETLIBUSER nlu = {}; nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; - nlu.ptszDescriptiveName = TranslateT("Watrack MPD connection"); + nlu.szDescriptiveName.w = TranslateT("Watrack MPD connection"); nlu.szSettingsModule = __PLUGIN_NAME; ghNetlibUser = Netlib_RegisterUser(&nlu); InitVars(); diff --git a/plugins/Weather/src/weather_http.cpp b/plugins/Weather/src/weather_http.cpp index e1dde203ea..d2ffb09070 100644 --- a/plugins/Weather/src/weather_http.cpp +++ b/plugins/Weather/src/weather_http.cpp @@ -156,7 +156,7 @@ void NetlibInit(void) NETLIBUSER nlu = {}; nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_UNICODE; nlu.szSettingsModule = WEATHERPROTONAME; - nlu.ptszDescriptiveName = TranslateT("Weather HTTP connections"); + nlu.szDescriptiveName.w = TranslateT("Weather HTTP connections"); hNetlibUser = Netlib_RegisterUser(&nlu); } diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp index bcb0c4a2e2..2709aa050f 100644 --- a/plugins/WebView/src/main.cpp +++ b/plugins/WebView/src/main.cpp @@ -150,7 +150,7 @@ extern "C" int __declspec(dllexport) Load() NETLIBUSER nlu = {}; nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS; nlu.szSettingsModule = MODULENAME; - nlu.szDescriptiveName = tempNdesc; + nlu.szDescriptiveName.a = tempNdesc; hNetlibUser = Netlib_RegisterUser(&nlu); // register webview protocol diff --git a/plugins/YAMN/src/proto/netlib.cpp b/plugins/YAMN/src/proto/netlib.cpp index b737dc89e2..24485fe871 100644 --- a/plugins/YAMN/src/proto/netlib.cpp +++ b/plugins/YAMN/src/proto/netlib.cpp @@ -43,7 +43,7 @@ HANDLE RegisterNLClient(const char *name) NETLIBUSER nlu = {}; nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS; - nlu.szDescriptiveName = desc; + nlu.szDescriptiveName.a = desc; nlu.szSettingsModule = (char *)name; hNetlibUser = Netlib_RegisterUser(&nlu); diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index a670de6faa..7fd35eec98 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -52,7 +52,7 @@ CAimProto::CAimProto(const char* aProtoName, const wchar_t* aUserName) : nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName); - nlu.ptszDescriptiveName = descr; + nlu.szDescriptiveName.w = descr; m_hNetlibUser = Netlib_RegisterUser(&nlu); char szP2P[128]; diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp index 03e903e46f..b0d47a941e 100644 --- a/protocols/Discord/src/proto.cpp +++ b/protocols/Discord/src/proto.cpp @@ -79,14 +79,14 @@ CDiscordProto::CDiscordProto(const char *proto_name, const wchar_t *username) : nlu.szSettingsModule = m_szModuleName; nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; descr.Format(TranslateT("%s server connection"), m_tszUserName); - nlu.ptszDescriptiveName = descr.GetBuffer(); + nlu.szDescriptiveName.w = descr.GetBuffer(); m_hNetlibUser = Netlib_RegisterUser(&nlu); CMStringA module(FORMAT, "%s.Gateway", m_szModuleName); nlu.szSettingsModule = module.GetBuffer(); nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_UNICODE; descr.Format(TranslateT("%s gateway connection"), m_tszUserName); - nlu.ptszDescriptiveName = descr.GetBuffer(); + nlu.szDescriptiveName.w = descr.GetBuffer(); m_hGatewayNetlibUser = Netlib_RegisterUser(&nlu); } diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 8c63120cb4..246fbdd480 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -88,7 +88,7 @@ FacebookProto::FacebookProto(const char* proto_name, const wchar_t* username) : nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName); - nlu.ptszDescriptiveName = descr; + nlu.szDescriptiveName.w = descr; m_hNetlibUser = Netlib_RegisterUser(&nlu); if (m_hNetlibUser == NULL) { wchar_t error[200]; diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 5606f0a398..3fe2a9d605 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -45,7 +45,7 @@ GGPROTO::GGPROTO(const char *pszProtoName, const wchar_t *tszUserName) : NETLIBUSER nlu = {}; nlu.flags = NUF_UNICODE | NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS; nlu.szSettingsModule = m_szModuleName; - nlu.ptszDescriptiveName = name; + nlu.szDescriptiveName.w = name; m_hNetlibUser = Netlib_RegisterUser(&nlu); diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 440359e82a..b062662c29 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -181,7 +181,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) NETLIBUSER nlu = {}; nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; - nlu.ptszDescriptiveName = name; + nlu.szDescriptiveName.w = name; m_hNetlibUser = Netlib_RegisterUser(&nlu); nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE; @@ -189,7 +189,7 @@ int CIrcProto::OnModulesLoaded(WPARAM, LPARAM) mir_snprintf(szTemp2, "%s DCC", m_szModuleName); nlu.szSettingsModule = szTemp2; mir_snwprintf(name, TranslateT("%s client-to-client connections"), m_tszUserName); - nlu.ptszDescriptiveName = name; + nlu.szDescriptiveName.w = name; hNetlibDCC = Netlib_RegisterUser(&nlu); GCREGISTER gcr = {}; diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index fcc6cb3d8f..a97e56df77 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -161,7 +161,7 @@ CIcqProto::CIcqProto(const char* aProtoName, const wchar_t* aUserName) : NETLIBUSER nlu = {}; nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; - nlu.ptszDescriptiveName = szBuffer; + nlu.szDescriptiveName.w = szBuffer; nlu.szSettingsModule = m_szModuleName; nlu.szHttpGatewayHello = "http://http.proxy.icq.com/hello"; nlu.szHttpGatewayUserAgent = NETLIB_USER_AGENT; @@ -175,7 +175,7 @@ CIcqProto::CIcqProto(const char* aProtoName, const wchar_t* aUserName) : mir_snprintf(szP2PModuleName, "%sP2P", m_szModuleName); mir_snwprintf(szBuffer, TranslateT("%s client-to-client connections"), m_tszUserName); nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_UNICODE; - nlu.ptszDescriptiveName = szBuffer; + nlu.szDescriptiveName.w = szBuffer; nlu.szSettingsModule = szP2PModuleName; nlu.minIncomingPorts = 1; m_hDirectNetlibUser = Netlib_RegisterUser(&nlu); diff --git a/protocols/JabberG/src/jabber_ws.cpp b/protocols/JabberG/src/jabber_ws.cpp index db491e365b..29129a74f8 100644 --- a/protocols/JabberG/src/jabber_ws.cpp +++ b/protocols/JabberG/src/jabber_ws.cpp @@ -32,8 +32,8 @@ BOOL CJabberProto::WsInit(void) mir_snwprintf(name, TranslateT("%s connection"), m_tszUserName); NETLIBUSER nlu = {}; - nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE; // | NUF_HTTPGATEWAY; - nlu.ptszDescriptiveName = name; + nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE; + nlu.szDescriptiveName.w = name; nlu.szSettingsModule = m_szModuleName; m_hNetlibUser = Netlib_RegisterUser(&nlu); return m_hNetlibUser != NULL; diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp index de646f2c2a..7c80a1230a 100644 --- a/protocols/MRA/src/MraAvatars.cpp +++ b/protocols/MRA/src/MraAvatars.cpp @@ -61,7 +61,7 @@ DWORD CMraProto::MraAvatarsQueueInitialize(HANDLE *phAvatarsQueueHandle) NETLIBUSER nlu = {}; nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = MRA_AVT_SECT_NAME; - nlu.ptszDescriptiveName = szBuffer; + nlu.szDescriptiveName.w = szBuffer; pmraaqAvatarsQueue->hNetlibUser = Netlib_RegisterUser(&nlu); if (pmraaqAvatarsQueue->hNetlibUser) { pmraaqAvatarsQueue->iThreadsCount = db_get_dw(NULL, MRA_AVT_SECT_NAME, "WorkThreadsCount", MRA_AVT_DEFAULT_WRK_THREAD_COUNTS); diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index 75a684f233..4ced9192fc 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -41,7 +41,7 @@ CMraProto::CMraProto(const char* _module, const wchar_t* _displayName) : NETLIBUSER nlu = {}; nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; - nlu.ptszDescriptiveName = name; + nlu.szDescriptiveName.w = name; m_hNetlibUser = Netlib_RegisterUser(&nlu); InitMenus(); diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 0868dd76e7..44cd861286 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -140,7 +140,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const wchar_t* aUserName) : NETLIBUSER nlu1 = {}; nlu1.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu1.szSettingsModule = szDbsettings; - nlu1.ptszDescriptiveName = szBuffer; + nlu1.szDescriptiveName.w = szBuffer; mir_snprintf(szDbsettings, "%s_HTTPS", m_szModuleName); mir_snwprintf(szBuffer, TranslateT("%s plugin HTTPS connections"), m_tszUserName); @@ -149,7 +149,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const wchar_t* aUserName) : NETLIBUSER nlu = {}; nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; - nlu.ptszDescriptiveName = szBuffer; + nlu.szDescriptiveName.w = szBuffer; nlu.szHttpGatewayUserAgent = (char*)MSN_USER_AGENT; nlu.pfnHttpGatewayInit = msn_httpGatewayInit; diff --git a/protocols/MinecraftDynmap/src/proto.cpp b/protocols/MinecraftDynmap/src/proto.cpp index a29f44c89a..83a05652d2 100644 --- a/protocols/MinecraftDynmap/src/proto.cpp +++ b/protocols/MinecraftDynmap/src/proto.cpp @@ -43,11 +43,12 @@ MinecraftDynmapProto::MinecraftDynmapProto(const char* proto_name, const wchar_t // Create standard network connection wchar_t descr[512]; + mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName); + NETLIBUSER nlu = {}; nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; - mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName); - nlu.ptszDescriptiveName = descr; + nlu.szDescriptiveName.w = descr; m_hNetlibUser = Netlib_RegisterUser(&nlu); if (m_hNetlibUser == NULL) { wchar_t error[200]; diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp index 57434aa3b1..3eae533cda 100644 --- a/protocols/Omegle/src/proto.cpp +++ b/protocols/Omegle/src/proto.cpp @@ -47,7 +47,7 @@ PROTO(proto_name, username) nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName); - nlu.ptszDescriptiveName = descr; + nlu.szDescriptiveName.w = descr; m_hNetlibUser = Netlib_RegisterUser(&nlu); if (m_hNetlibUser == NULL) { wchar_t error[200]; diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index 3890deb053..2013429bbc 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -20,7 +20,7 @@ CSametimeProto::CSametimeProto(const char* pszProtoName, const wchar_t* tszUserN NETLIBUSER nlu = {}; nlu.flags = NUF_UNICODE | NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS; nlu.szSettingsModule = m_szModuleName; - nlu.ptszDescriptiveName = name; + nlu.szDescriptiveName.w = name; m_hNetlibUser = Netlib_RegisterUser(&nlu); RegisterGLibLogger(); diff --git a/protocols/SkypeWeb/src/skype_network.cpp b/protocols/SkypeWeb/src/skype_network.cpp index de12a06b7b..49920c47dc 100644 --- a/protocols/SkypeWeb/src/skype_network.cpp +++ b/protocols/SkypeWeb/src/skype_network.cpp @@ -23,7 +23,7 @@ void CSkypeProto::InitNetwork() NETLIBUSER nlu = {}; nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE; - nlu.ptszDescriptiveName = name.GetBuffer(); + nlu.szDescriptiveName.w = name.GetBuffer(); nlu.szSettingsModule = m_szModuleName; m_hNetlibUser = Netlib_RegisterUser(&nlu); } diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index e9fc5ba35c..aef0747f81 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -70,7 +70,7 @@ CSteamProto::CSteamProto(const char* protoName, const wchar_t* userName) NETLIBUSER nlu = {}; nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; - nlu.ptszDescriptiveName = name; + nlu.szDescriptiveName.w = name; nlu.szSettingsModule = m_szModuleName; m_hNetlibUser = Netlib_RegisterUser(&nlu); diff --git a/protocols/Tlen/src/tlen_ws.cpp b/protocols/Tlen/src/tlen_ws.cpp index 98b21892d4..3da3a54c88 100644 --- a/protocols/Tlen/src/tlen_ws.cpp +++ b/protocols/Tlen/src/tlen_ws.cpp @@ -28,10 +28,10 @@ BOOL TlenWsInit(TlenProtocol *proto) wchar_t name[128]; NETLIBUSER nlu = {}; - nlu.ptszDescriptiveName = name; + nlu.szDescriptiveName.w = name; nlu.szSettingsModule = proto->m_szModuleName; - nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE; // | NUF_HTTPGATEWAY; + nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE; mir_snwprintf(name, TranslateT("%s connection"), proto->m_tszUserName); proto->m_hNetlibUser = Netlib_RegisterUser(&nlu); diff --git a/protocols/Tox/src/tox_netlib.cpp b/protocols/Tox/src/tox_netlib.cpp index 3376697df5..f41f312722 100644 --- a/protocols/Tox/src/tox_netlib.cpp +++ b/protocols/Tox/src/tox_netlib.cpp @@ -7,7 +7,7 @@ void CToxProto::InitNetlib() NETLIBUSER nlu = {}; nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE; - nlu.ptszDescriptiveName = name; + nlu.szDescriptiveName.w = name; nlu.szSettingsModule = m_szModuleName; m_hNetlibUser = Netlib_RegisterUser(&nlu); diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index 8160e13e14..19bc5452e7 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -306,7 +306,7 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM) // Create standard network connection mir_snwprintf(descr, TranslateT("%s server connection"), m_tszUserName); - nlu.ptszDescriptiveName = descr; + nlu.szDescriptiveName.w = descr; m_hNetlibUser = Netlib_RegisterUser(&nlu); if (m_hNetlibUser == NULL) { wchar_t error[200]; @@ -319,7 +319,7 @@ int TwitterProto::OnModulesLoaded(WPARAM, LPARAM) mir_snprintf(module, "%sAv", m_szModuleName); nlu.szSettingsModule = module; mir_snwprintf(descr, TranslateT("%s avatar connection"), m_tszUserName); - nlu.ptszDescriptiveName = descr; + nlu.szDescriptiveName.w = descr; hAvatarNetlib_ = Netlib_RegisterUser(&nlu); if (hAvatarNetlib_ == NULL) { wchar_t error[200]; diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index a4d1e4f1b8..145f7545ee 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -67,7 +67,7 @@ CVkProto::CVkProto(const char *szModuleName, const wchar_t *pwszUserName) : NETLIBUSER nlu = {}; nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; - nlu.ptszDescriptiveName = descr; + nlu.szDescriptiveName.w = descr; m_hNetlibUser = Netlib_RegisterUser(&nlu); Clist_GroupCreate(NULL, m_vkOptions.pwszDefaultGroup); diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp index 23246c783f..c41266f98c 100644 --- a/protocols/WhatsApp/src/proto.cpp +++ b/protocols/WhatsApp/src/proto.cpp @@ -38,7 +38,7 @@ WhatsAppProto::WhatsAppProto(const char *proto_name, const wchar_t *username) NETLIBUSER nlu = {}; nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = m_szModuleName; - nlu.ptszDescriptiveName = descr; + nlu.szDescriptiveName.w = descr; m_hNetlibUser = Netlib_RegisterUser(&nlu); if (m_hNetlibUser == NULL) { wchar_t error[200]; diff --git a/src/mir_app/src/netlib.cpp b/src/mir_app/src/netlib.cpp index dc67a7f990..52ff637ad6 100644 --- a/src/mir_app/src/netlib.cpp +++ b/src/mir_app/src/netlib.cpp @@ -137,7 +137,7 @@ static char* GetNetlibUserSettingString(const char *szUserModule, const char *sz MIR_APP_DLL(HNETLIBUSER) Netlib_RegisterUser(const NETLIBUSER *nlu) { - if (nlu == NULL || nlu->szSettingsModule == NULL || (!(nlu->flags & NUF_NOOPTIONS) && nlu->szDescriptiveName == NULL) || (nlu->flags & NUF_HTTPGATEWAY && (nlu->pfnHttpGatewayInit == NULL))) { + if (nlu == NULL || nlu->szSettingsModule == NULL || (!(nlu->flags & NUF_NOOPTIONS) && nlu->szDescriptiveName.w == NULL)) { SetLastError(ERROR_INVALID_PARAMETER); return 0; } @@ -157,8 +157,8 @@ MIR_APP_DLL(HNETLIBUSER) Netlib_RegisterUser(const NETLIBUSER *nlu) return 0; } - if (nlu->szDescriptiveName) - thisUser->user.ptszDescriptiveName = (thisUser->user.flags&NUF_UNICODE ? mir_wstrdup((WCHAR*)nlu->ptszDescriptiveName) : mir_a2u(nlu->szDescriptiveName)); + if (nlu->szDescriptiveName.w) + thisUser->user.szDescriptiveName.w = (thisUser->user.flags & NUF_UNICODE) ? mir_wstrdup(nlu->szDescriptiveName.w) : mir_a2u(nlu->szDescriptiveName.a); if ((thisUser->user.szSettingsModule = mir_strdup(nlu->szSettingsModule)) == NULL || (nlu->szDescriptiveName && thisUser->user.ptszDescriptiveName == NULL) @@ -178,7 +178,7 @@ MIR_APP_DLL(HNETLIBUSER) Netlib_RegisterUser(const NETLIBUSER *nlu) thisUser->settings.proxyType = GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLProxyType", PROXYTYPE_SOCKS5); if (thisUser->user.flags&NUF_NOHTTPSOPTION && thisUser->settings.proxyType == PROXYTYPE_HTTPS) thisUser->settings.proxyType = PROXYTYPE_HTTP; - if (!(thisUser->user.flags&(NUF_HTTPCONNS|NUF_HTTPGATEWAY)) && thisUser->settings.proxyType == PROXYTYPE_HTTP) { + if (!(thisUser->user.flags & NUF_HTTPCONNS) && thisUser->settings.proxyType == PROXYTYPE_HTTP) { thisUser->settings.useProxy = 0; thisUser->settings.proxyType = PROXYTYPE_SOCKS5; } @@ -259,7 +259,7 @@ MIR_APP_DLL(int) Netlib_CloseHandle(HANDLE hNetlib) NetlibFreeUserSettingsStruct(&nlu->settings); mir_free(nlu->user.szSettingsModule); - mir_free(nlu->user.szDescriptiveName); + mir_free(nlu->user.szDescriptiveName.a); mir_free(nlu->user.szHttpGatewayHello); mir_free(nlu->user.szHttpGatewayUserAgent); mir_free(nlu->szStickyHeaders); diff --git a/src/mir_app/src/netliblog.cpp b/src/mir_app/src/netliblog.cpp index d61f3ebe00..0a5a9f1e73 100644 --- a/src/mir_app/src/netliblog.cpp +++ b/src/mir_app/src/netliblog.cpp @@ -128,7 +128,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa tvis.item.stateMask = TVIS_STATEIMAGEMASK; for (int i = 0; i < netlibUser.getCount(); i++) { - tvis.item.pszText = netlibUser[i]->user.ptszDescriptiveName; + tvis.item.pszText = netlibUser[i]->user.szDescriptiveName.w; tvis.item.lParam = i; tvis.item.state = INDEXTOSTATEIMAGEMASK((netlibUser[i]->toLog) ? 2 : 1); TreeView_InsertItem(hwndFilter, &tvis); diff --git a/src/mir_app/src/netlibopenconn.cpp b/src/mir_app/src/netlibopenconn.cpp index dba769dd27..81bb807767 100644 --- a/src/mir_app/src/netlibopenconn.cpp +++ b/src/mir_app/src/netlibopenconn.cpp @@ -743,10 +743,10 @@ bool NetlibDoConnect(NetlibConnection *nlc) case PROXYTYPE_HTTP: nlc->proxyAuthNeeded = true; - if (!(nlu->user.flags & NUF_HTTPGATEWAY || nloc->flags & NLOCF_HTTPGATEWAY) || nloc->flags & NLOCF_SSL) { - //NLOCF_HTTP not specified and no HTTP gateway available: try HTTPS + if (!(nloc->flags & NLOCF_HTTPGATEWAY) || nloc->flags & NLOCF_SSL) { + // NLOCF_HTTP not specified and no HTTP gateway available: try HTTPS if (!NetlibInitHttpsConnection(nlc, nlu, nloc)) { - //can't do HTTPS: try direct + // can't do HTTPS: try direct usingProxy = false; if (!NetlibHttpFallbackToDirect(nlc, nlu, nloc)) return false; @@ -764,7 +764,8 @@ bool NetlibDoConnect(NetlibConnection *nlc) } } else if (nloc->flags & NLOCF_HTTPGATEWAY) { - if (!NetlibInitHttpConnection(nlc, nlu, nloc)) return false; + if (!NetlibInitHttpConnection(nlc, nlu, nloc)) + return false; nlc->usingDirectHttpGateway = true; } diff --git a/src/mir_app/src/netlibopts.cpp b/src/mir_app/src/netlibopts.cpp index 5e66c66d21..b233dedfa2 100644 --- a/src/mir_app/src/netlibopts.cpp +++ b/src/mir_app/src/netlibopts.cpp @@ -276,7 +276,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, if (netlibUser[i]->user.flags & NUF_NOOPTIONS) continue; - iItem = SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS, CB_ADDSTRING, 0, (LPARAM)netlibUser[i]->user.ptszDescriptiveName); + iItem = SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS, CB_ADDSTRING, 0, (LPARAM)netlibUser[i]->user.szDescriptiveName.w); SendDlgItemMessage(hwndDlg, IDC_NETLIBUSERS, CB_SETITEMDATA, iItem, i); } } @@ -310,9 +310,9 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, if (settings.proxyType == 0) AddProxyTypeItem(hwndDlg, 0, settings.proxyType); AddProxyTypeItem(hwndDlg, PROXYTYPE_SOCKS4, settings.proxyType); AddProxyTypeItem(hwndDlg, PROXYTYPE_SOCKS5, settings.proxyType); - if (flags & (NUF_HTTPCONNS | NUF_HTTPGATEWAY)) AddProxyTypeItem(hwndDlg, PROXYTYPE_HTTP, settings.proxyType); + if (flags & NUF_HTTPCONNS) AddProxyTypeItem(hwndDlg, PROXYTYPE_HTTP, settings.proxyType); if (!(flags & NUF_NOHTTPSOPTION)) AddProxyTypeItem(hwndDlg, PROXYTYPE_HTTPS, settings.proxyType); - if (flags & (NUF_HTTPCONNS | NUF_HTTPGATEWAY) || !(flags & NUF_NOHTTPSOPTION)) + if ((flags & NUF_HTTPCONNS) || !(flags & NUF_NOHTTPSOPTION)) AddProxyTypeItem(hwndDlg, PROXYTYPE_IE, settings.proxyType); SetDlgItemTextA(hwndDlg, IDC_PROXYHOST, settings.szProxyServer ? settings.szProxyServer : ""); if (settings.wProxyPort) SetDlgItemInt(hwndDlg, IDC_PROXYPORT, settings.wProxyPort, FALSE); @@ -396,15 +396,17 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, return 0; case IDC_PROXYTYPE: - if (HIWORD(wParam) != CBN_SELCHANGE) return 0; - { + if (HIWORD(wParam) == CBN_SELCHANGE) { int newValue = SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_GETCURSEL, 0, 0), 0); if (iUser == -1) { - if (newValue == 0) return 0; + if (newValue == 0) + return 0; + for (int i=0; i < tempSettings.getCount(); i++) { NetlibTempSettings *p = tempSettings[i]; - if (p->flags & NUF_NOOPTIONS) continue; - if (newValue == PROXYTYPE_HTTP && !(p->flags & (NUF_HTTPCONNS | NUF_HTTPGATEWAY))) + if (p->flags & NUF_NOOPTIONS) + continue; + if (newValue == PROXYTYPE_HTTP && !(p->flags & NUF_HTTPCONNS)) p->settings.proxyType = PROXYTYPE_HTTPS; else if (newValue == PROXYTYPE_HTTPS && p->flags & NUF_NOHTTPSOPTION) p->settings.proxyType = PROXYTYPE_HTTP; -- cgit v1.2.3