summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-01-31 19:01:52 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-01-31 19:01:52 +0300
commit2600097dcc6e357d4d8df6105e9afb66b6d4b296 (patch)
treefe6a1f8a777531ef1a28d373301dacdfc4854544 /src/mir_app
parent5f9ab0cf3c13bd2a0cae62bd9c5427ad302ac540 (diff)
- NUF_HTTPGATEWAY: unused option removed;
- NETLIBUSER::szDescriptiveName replaced with MAllStrings; - code cleaning.
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/netlib.cpp10
-rw-r--r--src/mir_app/src/netliblog.cpp2
-rw-r--r--src/mir_app/src/netlibopenconn.cpp9
-rw-r--r--src/mir_app/src/netlibopts.cpp18
4 files changed, 21 insertions, 18 deletions
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;