summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_options.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-08-17 08:49:56 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-08-17 08:49:56 +0000
commitd73ec8491056f109d8470b973e9f514a26644010 (patch)
tree258b99b57c137c507da04665e442b445acaf6009 /protocols/Tox/src/tox_options.cpp
parent1c894ee5f3448792123b550e0620fe3bafc1635e (diff)
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
Diffstat (limited to 'protocols/Tox/src/tox_options.cpp')
-rw-r--r--protocols/Tox/src/tox_options.cpp34
1 files changed, 25 insertions, 9 deletions
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<NMHDR*>(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];