summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2016-09-12 19:20:02 +0000
committerAlexander Lantsev <aunsane@gmail.com>2016-09-12 19:20:02 +0000
commit6dcd48bb36dd02efe4e1d2eba93c7a095254404f (patch)
tree7958482bddf88b6e8be0ceabaf5a43139671e551 /protocols
parenta643cc7d504f7106c53ef9a6ade054742950be86 (diff)
Tox: fixed connect in tcp mode
git-svn-id: http://svn.miranda-ng.org/main/trunk@17289 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Tox/src/tox_network.cpp12
-rw-r--r--protocols/Tox/src/tox_proto.h2
2 files changed, 8 insertions, 6 deletions
diff --git a/protocols/Tox/src/tox_network.cpp b/protocols/Tox/src/tox_network.cpp
index 32a2d71298..7ae6d1613c 100644
--- a/protocols/Tox/src/tox_network.cpp
+++ b/protocols/Tox/src/tox_network.cpp
@@ -62,7 +62,7 @@ void CToxProto::BootstrapNodesFromDb(CToxThread *toxThread, bool isIPv6)
}
}
-void CToxProto::BootstrapNodesFromJson(CToxThread *toxThread, bool isUdp, bool isIPv6)
+void CToxProto::BootstrapNodesFromJson(CToxThread *toxThread, bool isIPv6)
{
ptrA json;
@@ -98,7 +98,7 @@ void CToxProto::BootstrapNodesFromJson(CToxThread *toxThread, bool isUdp, bool i
JSONNode address = node.at("ipv4");
JSONNode pubKey = node.at("public_key");
- if (isUdp)
+ if (node.at("status_udp").as_bool())
{
int port = node.at("port").as_int();
BootstrapUdpNode(toxThread, address.as_string().c_str(), port, pubKey.as_string().c_str());
@@ -108,9 +108,10 @@ void CToxProto::BootstrapNodesFromJson(CToxThread *toxThread, bool isUdp, bool i
BootstrapUdpNode(toxThread, address.as_string().c_str(), port, pubKey.as_string().c_str());
}
}
- else
+
+ if (node.at("status_tcp").as_bool())
{
- JSONNode tcpPorts = root.at("tcp_ports").as_array();
+ JSONNode tcpPorts = node.at("tcp_ports").as_array();
for (size_t i = 0; i < tcpPorts.size(); i++)
{
int port = tcpPorts[i].as_int();
@@ -133,7 +134,7 @@ void CToxProto::BootstrapNodes(CToxThread *toxThread)
bool isUdp = getBool("EnableUDP", 1);
bool isIPv6 = getBool("EnableIPv6", 0);
BootstrapNodesFromDb(toxThread, isIPv6);
- BootstrapNodesFromJson(toxThread, isUdp, isIPv6);
+ BootstrapNodesFromJson(toxThread, isIPv6);
}
void CToxProto::UpdateNodes()
@@ -264,6 +265,7 @@ void CToxProto::PollingThread(void*)
CToxThread toxThread(options, &error);
if (error != TOX_ERR_NEW_OK)
{
+ SetStatus(ID_STATUS_OFFLINE);
debugLogA(__FUNCTION__": failed to initialize tox core (%d)", error);
ShowNotification(ToxErrorToString(error), TranslateT("Unable to initialize Tox core"), MB_ICONERROR);
tox_options_free(options);
diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h
index 615e713532..4380c2d98d 100644
--- a/protocols/Tox/src/tox_proto.h
+++ b/protocols/Tox/src/tox_proto.h
@@ -96,7 +96,7 @@ private:
void BootstrapTcpRelay(CToxThread *toxThread, const char *address, int port, const char *pubKey);
void BootstrapNodesFromDb(CToxThread *toxThread, bool isIPv6);
- void BootstrapNodesFromJson(CToxThread *toxThread, bool isUdp, bool isIPv6);
+ void BootstrapNodesFromJson(CToxThread *toxThread, bool isIPv6);
void BootstrapNodes(CToxThread *toxThread);
void UpdateNodes();