From 340910bcc3aaea0fb48a8679cf93e855b413fdc9 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 21 Aug 2017 21:28:58 +0300 Subject: Tox: - fixes #898 (Tox: usability issues); - fixes #893 (Tox: failed to connect to DHT); - massive code cleaning; --- protocols/Tox/src/tox_core.cpp | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'protocols/Tox/src/tox_core.cpp') diff --git a/protocols/Tox/src/tox_core.cpp b/protocols/Tox/src/tox_core.cpp index c040fa3426..9a2abf7e0f 100644 --- a/protocols/Tox/src/tox_core.cpp +++ b/protocols/Tox/src/tox_core.cpp @@ -4,32 +4,27 @@ Tox_Options* CToxProto::GetToxOptions() { TOX_ERR_OPTIONS_NEW error; Tox_Options *options = tox_options_new(&error); - if (error != TOX_ERR_OPTIONS_NEW_OK) - { + if (error != TOX_ERR_OPTIONS_NEW_OK) { debugLogA(__FUNCTION__": failed to initialize tox options (%d)", error); - return NULL; + return nullptr; } options->udp_enabled = getBool("EnableUDP", 1); options->ipv6_enabled = getBool("EnableIPv6", 0); - if (m_hNetlibUser != NULL) - { + if (m_hNetlibUser != nullptr) { NETLIBUSERSETTINGS nlus = { sizeof(nlus) }; Netlib_GetUserSettings(m_hNetlibUser, &nlus); - if (nlus.useProxy) - { - if (nlus.proxyType == PROXYTYPE_HTTP || nlus.proxyType == PROXYTYPE_HTTPS) - { + if (nlus.useProxy) { + if (nlus.proxyType == PROXYTYPE_HTTP || nlus.proxyType == PROXYTYPE_HTTPS) { debugLogA(__FUNCTION__": setting http user proxy config"); options->proxy_type = TOX_PROXY_TYPE_HTTP; mir_strcpy((char*)&options->proxy_host[0], nlus.szProxyServer); options->proxy_port = nlus.wProxyPort; } - if (nlus.proxyType == PROXYTYPE_SOCKS4 || nlus.proxyType == PROXYTYPE_SOCKS5) - { + if (nlus.proxyType == PROXYTYPE_SOCKS4 || nlus.proxyType == PROXYTYPE_SOCKS5) { debugLogA(__FUNCTION__": setting socks user proxy config"); options->proxy_type = TOX_PROXY_TYPE_SOCKS5; mir_strcpy((char*)&options->proxy_host[0], nlus.szProxyServer); @@ -39,13 +34,10 @@ Tox_Options* CToxProto::GetToxOptions() } if (LoadToxProfile(options)) - { return options; - } - + tox_options_free(options); - - return NULL; + return nullptr; } void CToxProto::InitToxCore(Tox *tox) @@ -113,4 +105,4 @@ void CToxProto::UninitToxCore(Tox *tox) { CancelAllTransfers(tox); SaveToxProfile(tox); -} \ No newline at end of file +} -- cgit v1.2.3