summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_network.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-05-29 21:33:17 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-05-29 21:33:17 +0000
commita66281d8453edde56145e032e8d38db91580ba08 (patch)
treeefdddb6f765cf020502eed9139dab6767adb5d0b /protocols/Tox/src/tox_network.cpp
parent6c5621e08b28ff3c3db26726aafd827d354d6934 (diff)
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
Diffstat (limited to 'protocols/Tox/src/tox_network.cpp')
-rw-r--r--protocols/Tox/src/tox_network.cpp17
1 files changed, 10 insertions, 7 deletions
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)
{