From a66281d8453edde56145e032e8d38db91580ba08 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Fri, 29 May 2015 21:33:17 +0000 Subject: Tox: - reworked code related with address/public key - added tox_add_tcp_relay to bootstrap - updated tox core - version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@13900 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tox/src/tox_network.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'protocols/Tox/src/tox_network.cpp') diff --git a/protocols/Tox/src/tox_network.cpp b/protocols/Tox/src/tox_network.cpp index 1191568773..860f5c5798 100644 --- a/protocols/Tox/src/tox_network.cpp +++ b/protocols/Tox/src/tox_network.cpp @@ -5,13 +5,16 @@ bool CToxProto::IsOnline() return isConnected && m_iStatus > ID_STATUS_OFFLINE; } -void CToxProto::BootstrapNode(const char *address, int port, const uint8_t *pubKey) +void CToxProto::BootstrapNode(const char *address, int port, const char *hexKey) { + if (hexKey == NULL) + return; + ToxBinAddress binKey(hexKey, TOX_PUBLIC_KEY_SIZE * 2); TOX_ERR_BOOTSTRAP error; - if (!tox_bootstrap(tox, address, port, pubKey, &error)) - { - debugLogA("CToxProto::BootstrapNode: failed to bootstrap node %s:%d \"%s\" (%d)", address, port, (const char*)ToxHexAddress(pubKey), error); - } + if (!tox_bootstrap(tox, address, port, binKey, &error)) + debugLogA(__FUNCTION__ ": failed to bootstrap node %s:%d \"%s\" (%d)", address, port, hexKey, error); + if (!tox_add_tcp_relay(tox, address, port, binKey, &error)) + debugLogA(__FUNCTION__ ": failed to add tcp relay%s:%d \"%s\" (%d)", address, port, hexKey, error); } void CToxProto::BootstrapNodesFromDb(bool isIPv6) @@ -29,7 +32,7 @@ void CToxProto::BootstrapNodesFromDb(bool isIPv6) 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); - ToxBinAddress pubKey(ptrA(db_get_sa(NULL, module, setting))); + ptrA pubKey(db_get_sa(NULL, module, setting)); BootstrapNode(address, port, pubKey); if (isIPv6) { @@ -59,7 +62,7 @@ void CToxProto::BootstrapNodesFromIni(bool isIPv6) ptrA address(mir_strdup(value)); int port = GetPrivateProfileIntA(section, "Port", 33445, fileName); GetPrivateProfileStringA(section, "PubKey", NULL, value, SIZEOF(value), fileName); - ToxBinAddress pubKey(value); + ptrA pubKey(mir_strdup(value)); BootstrapNode(address, port, pubKey); if (isIPv6) { -- cgit v1.2.3