summaryrefslogtreecommitdiff
path: root/protocols/Tox
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-02-18 20:47:25 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-02-18 20:47:25 +0000
commitf843b6efbcaa17582efcc9ae1fe35d1d22edcb63 (patch)
tree0bd42b549fce377c34e7bfeccaab6ac2f93f1007 /protocols/Tox
parenta434de21b52ff537346f279bb358a486759b6f25 (diff)
Tox: nodes index starts with 0
git-svn-id: http://svn.miranda-ng.org/main/trunk@12188 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox')
-rw-r--r--protocols/Tox/docs/autoexec_tox_nodes.ini104
-rw-r--r--protocols/Tox/src/tox_network.cpp23
-rw-r--r--protocols/Tox/src/tox_options.cpp35
3 files changed, 81 insertions, 81 deletions
diff --git a/protocols/Tox/docs/autoexec_tox_nodes.ini b/protocols/Tox/docs/autoexec_tox_nodes.ini
index e856814943..aaa452bb44 100644
--- a/protocols/Tox/docs/autoexec_tox_nodes.ini
+++ b/protocols/Tox/docs/autoexec_tox_nodes.ini
@@ -2,72 +2,72 @@ SETTINGS:
[TOX]
NodeCount=b20
-Node_1_IPv4=s192.254.75.102
-Node_1_IPv6=s2607:5600:284::2
-Node_1_PubKey=s951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F
+Node_0_IPv4=s192.254.75.102
+Node_0_IPv6=s2607:5600:284::2
+Node_0_PubKey=s951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F
+Node_0_Port=w33445
+Node_1_IPv4=s144.76.60.215
+Node_1_IPv6=s2a01:4f8:191:64d6::1
+Node_1_PubKey=s04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F
Node_1_Port=w33445
-Node_2_IPv4=s144.76.60.215
-Node_2_IPv6=s2a01:4f8:191:64d6::1
-Node_2_PubKey=s04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F
+Node_2_IPv4=s23.226.230.47
+Node_2_IPv6=s2604:180:1::3ded:b280
+Node_2_PubKey=sA09162D68618E742FFBCA1C2C70385E6679604B2D80EA6E84AD0996A1AC8A074
Node_2_Port=w33445
-Node_3_IPv4=s23.226.230.47
-Node_3_IPv6=s2604:180:1::3ded:b280
-Node_3_PubKey=sA09162D68618E742FFBCA1C2C70385E6679604B2D80EA6E84AD0996A1AC8A074
+Node_3_IPv4=s178.62.125.224
+Node_3_IPv6=s2a03:b0c0:1:d0::178:6001
+Node_3_PubKey=s10B20C49ACBD968D7C80F2E8438F92EA51F189F4E70CFBBB2C2C8C799E97F03E
Node_3_Port=w33445
-Node_4_IPv4=s178.62.125.224
-Node_4_IPv6=s2a03:b0c0:1:d0::178:6001
-Node_4_PubKey=s10B20C49ACBD968D7C80F2E8438F92EA51F189F4E70CFBBB2C2C8C799E97F03E
+Node_4_IPv4=s178.21.112.187
+Node_4_IPv6=s2a02:2308::216:3eff:fe82:eaef
+Node_4_PubKey=s4B2C19E924972CB9B57732FB172F8A8604DE13EEDA2A6234E348983344B23057
Node_4_Port=w33445
-Node_5_IPv4=s178.21.112.187
-Node_5_IPv6=s2a02:2308::216:3eff:fe82:eaef
-Node_5_PubKey=s4B2C19E924972CB9B57732FB172F8A8604DE13EEDA2A6234E348983344B23057
+Node_5_IPv4=s195.154.119.113
+Node_5_IPv6=s2001:bc8:3698:101::1
+Node_5_PubKey=sE398A69646B8CEACA9F0B84F553726C1C49270558C57DF5F3C368F05A7D71354
Node_5_Port=w33445
-Node_6_IPv4=s195.154.119.113
-Node_6_IPv6=s2001:bc8:3698:101::1
-Node_6_PubKey=sE398A69646B8CEACA9F0B84F553726C1C49270558C57DF5F3C368F05A7D71354
+Node_6_IPv4=s192.210.149.121
+Node_6_PubKey=sF404ABAA1C99A9D37D61AB54898F56793E1DEF8BD46B1038B9D822E8460FAB67
Node_6_Port=w33445
-Node_7_IPv4=s192.210.149.121
-Node_7_PubKey=sF404ABAA1C99A9D37D61AB54898F56793E1DEF8BD46B1038B9D822E8460FAB67
-Node_7_Port=w33445
-Node_8_IPv4=s104.219.184.206
-Node_8_PubKey=s8CD087E31C67568103E8C2A28653337E90E6B8EDA0D765D57C6B5172B4F1F04C
-Node_8_Port=w443
-Node_9_IPv4=s76.191.23.96
-Node_9_PubKey=s93574A3FAB7D612FEA29FD8D67D3DD10DFD07A075A5D62E8AF3DD9F5D0932E11
+Node_7_IPv4=s104.219.184.206
+Node_7_PubKey=s8CD087E31C67568103E8C2A28653337E90E6B8EDA0D765D57C6B5172B4F1F04C
+Node_7_Port=w443
+Node_8_IPv4=s76.191.23.96
+Node_8_PubKey=s93574A3FAB7D612FEA29FD8D67D3DD10DFD07A075A5D62E8AF3DD9F5D0932E11
+Node_8_Port=w33445
+Node_9_IPv4=s46.38.239.179
+Node_9_PubKey=sF5A1A38EFB6BD3C2C8AF8B10D85F0F89E931704D349F1D0720C3C4059AF2440A
Node_9_Port=w33445
-Node_10_IPv4=s46.38.239.179
-Node_10_PubKey=sF5A1A38EFB6BD3C2C8AF8B10D85F0F89E931704D349F1D0720C3C4059AF2440A
+Node_10_IPv4=s178.62.250.138
+Node_10_IPv6=s2a03:b0c0:2:d0::16:1
+Node_10_PubKey=s788236D34978D1D5BD822F0A5BEBD2C53C64CC31CD3149350EE27D4D9A2F9B6B
Node_10_Port=w33445
-Node_11_IPv4=s178.62.250.138
-Node_11_IPv6=s2a03:b0c0:2:d0::16:1
-Node_11_PubKey=s788236D34978D1D5BD822F0A5BEBD2C53C64CC31CD3149350EE27D4D9A2F9B6B
+Node_11_IPv4=s78.225.128.39
+Node_11_PubKey=s7A2306BFBA665E5480AE59B31E116BE9C04DCEFE04D9FE25082316FA34B4DA0C
Node_11_Port=w33445
-Node_12_IPv4=s78.225.128.39
-Node_12_PubKey=s7A2306BFBA665E5480AE59B31E116BE9C04DCEFE04D9FE25082316FA34B4DA0C
+Node_12_IPv4=s130.133.110.14
+Node_12_IPv6=s2001:6f8:1c3c:babe::14:1
+Node_12_PubKey=s461FA3776EF0FA655F1A05477DF1B3B614F7D6B124F7DB1DD4FE3C08B03B640F
Node_12_Port=w33445
-Node_13_IPv4=s130.133.110.14
-Node_13_IPv6=s2001:6f8:1c3c:babe::14:1
-Node_13_PubKey=s461FA3776EF0FA655F1A05477DF1B3B614F7D6B124F7DB1DD4FE3C08B03B640F
+Node_13_IPv4=s104.167.101.29
+Node_13_PubKey=s5918AC3C06955962A75AD7DF4F80A5D7C34F7DB9E1498D2E0495DE35B3FE8A57
Node_13_Port=w33445
-Node_14_IPv4=s104.167.101.29
-Node_14_PubKey=s5918AC3C06955962A75AD7DF4F80A5D7C34F7DB9E1498D2E0495DE35B3FE8A57
+Node_14_IPv4=s195.154.109.148
+Node_14_PubKey=s391C96CB67AE893D4782B8E4495EB9D89CF1031F48460C06075AA8CE76D50A21
Node_14_Port=w33445
-Node_15_IPv4=s195.154.109.148
-Node_15_PubKey=s391C96CB67AE893D4782B8E4495EB9D89CF1031F48460C06075AA8CE76D50A21
+Node_15_IPv4=s192.3.173.88
+Node_15_PubKey=s3E1FFDEB667BFF549F619EC6737834762124F50A89C8D0DBF1DDF64A2DD6CD1B
Node_15_Port=w33445
-Node_16_IPv4=s192.3.173.88
-Node_16_PubKey=s3E1FFDEB667BFF549F619EC6737834762124F50A89C8D0DBF1DDF64A2DD6CD1B
+Node_16_IPv4=s205.185.116.116
+Node_16_PubKey=sA179B09749AC826FF01F37A9613F6B57118AE014D4196A0E1105A98F93A54702
Node_16_Port=w33445
-Node_17_IPv4=s205.185.116.116
-Node_17_PubKey=sA179B09749AC826FF01F37A9613F6B57118AE014D4196A0E1105A98F93A54702
+Node_17_IPv4=s198.98.51.198
+Node_17_IPv6=s2605:6400:1:fed5:22:45af:ec10:f329
+Node_17_PubKey=s1D5A5F2F5D6233058BF0259B09622FB40B482E4FA0931EB8FD3AB8E7BF7DAF6F
Node_17_Port=w33445
-Node_18_IPv4=s198.98.51.198
-Node_18_IPv6=s2605:6400:1:fed5:22:45af:ec10:f329
-Node_18_PubKey=s1D5A5F2F5D6233058BF0259B09622FB40B482E4FA0931EB8FD3AB8E7BF7DAF6F
+Node_18_IPv4=s80.232.246.79
+Node_18_PubKey=s0B8DCEAA7BDDC44BB11173F987CAE3566A2D7057D8DD3CC642BD472B9391002A
Node_18_Port=w33445
-Node_19_IPv4=s80.232.246.79
-Node_19_PubKey=s0B8DCEAA7BDDC44BB11173F987CAE3566A2D7057D8DD3CC642BD472B9391002A
+Node_19_IPv4=s108.61.165.198
+Node_19_PubKey=s8E7D0B859922EF569298B4D261A8CCB5FEA14FB91ED412A7603A585A25698832
Node_19_Port=w33445
-Node_20_IPv4=s108.61.165.198
-Node_20_PubKey=s8E7D0B859922EF569298B4D261A8CCB5FEA14FB91ED412A7603A585A25698832
-Node_20_Port=w33445
diff --git a/protocols/Tox/src/tox_network.cpp b/protocols/Tox/src/tox_network.cpp
index 2db215a01d..3e4b9ed52c 100644
--- a/protocols/Tox/src/tox_network.cpp
+++ b/protocols/Tox/src/tox_network.cpp
@@ -9,14 +9,14 @@ void CToxProto::BootstrapNodes()
{
debugLogA("CToxProto::BootstrapDht: bootstraping DHT");
- bool isIPv4Only = getBool("DisableIPv6", 0);
+ bool isIPv6 = !getBool("DisableIPv6", 0);
int nodeCount = db_get_w(NULL, MODULE, TOX_SETTINGS_NODE_COUNT, 0);
if (!nodeCount)
{
tox_bootstrap_from_address(
tox, "192.254.75.102", 33445,
ToxBinAddress("951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F"));
- if (!isIPv4Only)
+ if (isIPv6)
tox_bootstrap_from_address(
tox, "2607:5600:284::2", 33445,
ToxBinAddress("951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F"));
@@ -26,22 +26,19 @@ void CToxProto::BootstrapNodes()
char setting[MAX_PATH];
for (int i = 0; i < nodeCount; i++)
{
- mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_IPV4, i + 1);
+ mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_IPV4, i);
ptrA address(db_get_sa(NULL, MODULE, setting));
- mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_IPV6, i + 1);
- ptrA addressv6(db_get_sa(NULL, MODULE, setting));
- mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_PORT, i + 1);
- int port = db_get_w(NULL, MODULE, setting, 0);
- mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_PKEY, i + 1);
+ mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_PORT, i);
+ int port = db_get_w(NULL, MODULE, setting, 33445);
+ mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_PKEY, i);
ptrA pubKey(db_get_sa(NULL, MODULE, setting));
- if (pubKey && address && port)
+ tox_bootstrap_from_address(tox, address, port, ToxBinAddress(pubKey));
+ if (isIPv6)
{
+ mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_IPV6, i);
+ address = db_get_sa(NULL, MODULE, setting);
tox_bootstrap_from_address(tox, address, port, ToxBinAddress(pubKey));
}
- if (!isIPv4Only && pubKey && addressv6 && port)
- {
- tox_bootstrap_from_address(tox, addressv6, port, ToxBinAddress(pubKey));
- }
}
}
}
diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp
index e99c73dcd5..db7e8bedbc 100644
--- a/protocols/Tox/src/tox_options.cpp
+++ b/protocols/Tox/src/tox_options.cpp
@@ -428,25 +428,28 @@ INT_PTR CALLBACK ToxNodesOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
lvi.iImage = -1;
lvi.mask = LVIF_TEXT | LVIF_IMAGE;
- mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_IPV4, lvi.iItem + 1);
+ mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_IPV4, lvi.iItem);
lvi.iSubItem = 0;
lvi.pszText = db_get_sa(NULL, MODULE, setting);
SendMessage(hwndList, LVM_INSERTITEMA, 0, (LPARAM)&lvi);
- mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_IPV6, lvi.iItem + 1);
+ mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_IPV6, lvi.iItem);
lvi.iSubItem = 1;
lvi.pszText = db_get_sa(NULL, MODULE, setting);
SendMessage(hwndList, LVM_SETITEMA, 0, (LPARAM)&lvi);
- mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_PORT, lvi.iItem + 1);
- int port = db_get_w(NULL, MODULE, setting, 33445);
- char portNum[10];
- itoa(port, portNum, 10);
+ mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_PORT, lvi.iItem);
+ int port = db_get_w(NULL, MODULE, setting, 0);
+ if (port > 0)
+ {
+ char portNum[10];
+ itoa(port, portNum, 10);
+ lvi.pszText = mir_strdup(portNum);
+ }
lvi.iSubItem = 2;
- lvi.pszText = mir_strdup(portNum);
SendMessage(hwndList, LVM_SETITEMA, 0, (LPARAM)&lvi);
- mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_PKEY, lvi.iItem + 1);
+ mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_PKEY, lvi.iItem);
lvi.iSubItem = 3;
lvi.pszText = db_get_sa(NULL, MODULE, setting);
SendMessage(hwndList, LVM_SETITEMA, 0, (LPARAM)&lvi);
@@ -515,35 +518,35 @@ INT_PTR CALLBACK ToxNodesOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
{
lvi.iSubItem = 0;
SendMessage(hwndList, LVM_GETITEMA, 0, (LPARAM)&lvi);
- mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_IPV4, lvi.iItem + 1);
+ mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_IPV4, lvi.iItem);
db_set_s(NULL, MODULE, setting, lvi.pszText);
lvi.iSubItem = 1;
SendMessage(hwndList, LVM_GETITEMA, 0, (LPARAM)&lvi);
- mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_IPV6, lvi.iItem + 1);
+ mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_IPV6, lvi.iItem);
db_set_s(NULL, MODULE, setting, lvi.pszText);
lvi.iSubItem = 2;
SendMessage(hwndList, LVM_GETITEMA, 0, (LPARAM)&lvi);
- mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_PORT, lvi.iItem + 1);
+ mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_PORT, lvi.iItem);
db_set_w(NULL, MODULE, setting, atoi(lvi.pszText));
lvi.iSubItem = 3;
SendMessage(hwndList, LVM_GETITEMA, 0, (LPARAM)&lvi);
- mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_PKEY, lvi.iItem + 1);
+ mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_PKEY, lvi.iItem);
db_set_s(NULL, MODULE, setting, lvi.pszText);
}
int nodeCount = db_get_b(NULL, MODULE, TOX_SETTINGS_NODE_COUNT, 0);
for (lvi.iItem = itemCount; lvi.iItem < nodeCount; lvi.iItem++)
{
- mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_IPV4, lvi.iItem + 1);
+ mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_IPV4, lvi.iItem);
db_unset(NULL, MODULE, setting);
- mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_IPV6, lvi.iItem + 1);
+ mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_IPV6, lvi.iItem);
db_unset(NULL, MODULE, setting);
- mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_PORT, lvi.iItem + 1);
+ mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_PORT, lvi.iItem);
db_unset(NULL, MODULE, setting);
- mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_PKEY, lvi.iItem + 1);
+ mir_snprintf(setting, SIZEOF(setting), TOX_SETTINGS_NODE_PKEY, lvi.iItem);
db_unset(NULL, MODULE, setting);
}