From d73ec8491056f109d8470b973e9f514a26644010 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sun, 17 Aug 2014 08:49:56 +0000 Subject: Tox: - updated tox lib - ability to disable udp - ability to disable ipv6 - socks proxy support git-svn-id: http://svn.miranda-ng.org/main/trunk@10212 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tox/src/tox_options.cpp | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) (limited to 'protocols/Tox/src/tox_options.cpp') diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp index 33d73604c6..975a59a241 100644 --- a/protocols/Tox/src/tox_options.cpp +++ b/protocols/Tox/src/tox_options.cpp @@ -28,11 +28,16 @@ INT_PTR CALLBACK CToxProto::MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, SetDlgItemText(hwnd, IDC_GROUP, groupName); SendDlgItemMessage(hwnd, IDC_GROUP, EM_LIMITTEXT, 64, 0); - /*if (proto->IsOnline()) + CheckDlgButton(hwnd, IDC_DISABLE_UDP, proto->getByte("DisableUDP", 0)); + CheckDlgButton(hwnd, IDC_DISABLE_IPV6, proto->getByte("DisableIPv6", 0)); + + if (proto->IsOnline()) { EnableWindow(GetDlgItem(hwnd, IDC_USERNAME), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_DATAPATH), FALSE); - }*/ + EnableWindow(GetDlgItem(hwnd, IDC_DISABLE_UDP), FALSE); + EnableWindow(GetDlgItem(hwnd, IDC_DISABLE_IPV6), FALSE); + } } return TRUE; @@ -43,7 +48,7 @@ INT_PTR CALLBACK CToxProto::MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, case IDC_USERNAME: if ((HWND)lParam == GetFocus()) { - //EnableWindow(GetDlgItem(hwnd, IDC_USERNAME), !proto->IsOnline()); + EnableWindow(GetDlgItem(hwnd, IDC_USERNAME), !proto->IsOnline()); if (HIWORD(wParam) != EN_CHANGE) return 0; char username[128]; GetDlgItemTextA(hwnd, IDC_USERNAME, username, SIZEOF(username)); @@ -54,7 +59,7 @@ INT_PTR CALLBACK CToxProto::MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, case IDC_DATAPATH: if ((HWND)lParam == GetFocus()) { - //EnableWindow(GetDlgItem(hwnd, IDC_DATAPATH), !proto->IsOnline()); + EnableWindow(GetDlgItem(hwnd, IDC_DATAPATH), !proto->IsOnline()); if (HIWORD(wParam) != EN_CHANGE) return 0; char dataPath[128]; GetDlgItemTextA(hwnd, IDC_DATAPATH, dataPath, SIZEOF(dataPath)); @@ -94,6 +99,14 @@ INT_PTR CALLBACK CToxProto::MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); } break; + + case IDC_DISABLE_UDP: + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); + break; + + case IDC_DISABLE_IPV6: + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); + break; } } break; @@ -101,20 +114,23 @@ INT_PTR CALLBACK CToxProto::MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, case WM_NOTIFY: if (reinterpret_cast(lParam)->code == PSN_APPLY) { - //if (!proto->IsOnline()) + if (!proto->IsOnline()) { char username[128]; GetDlgItemTextA(hwnd, IDC_USERNAME, username, SIZEOF(username)); proto->setString("Username", username); + tox_set_name(proto->tox, (uint8_t*)&username[0], strlen(username)); - if (tox_set_name(proto->tox, (uint8_t*)&username[0], strlen(username)) == 0) - { - proto->SaveToxData(); - } + proto->UninitToxCore(); char dataPath[128]; GetDlgItemTextA(hwnd, IDC_DATAPATH, dataPath, SIZEOF(dataPath)); proto->setString("DataPath", dataPath); + + proto->setByte("DisableUDP", (BYTE)IsDlgButtonChecked(hwnd, IDC_DISABLE_UDP)); + proto->setByte("DisableIPv6", (BYTE)IsDlgButtonChecked(hwnd, IDC_DISABLE_IPV6)); + + proto->InitToxCore(); } wchar_t groupName[128]; -- cgit v1.2.3