diff options
author | George Hazan <ghazan@miranda.im> | 2017-08-21 21:28:58 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-08-21 21:28:58 +0300 |
commit | 340910bcc3aaea0fb48a8679cf93e855b413fdc9 (patch) | |
tree | 552bfa28cf7ccc20573d0997f1e363daa541b5c0 /protocols/Tox/src/tox_core.cpp | |
parent | 43bc63255af474749234ee04dda76da8e136514b (diff) |
Tox:
- fixes #898 (Tox: usability issues);
- fixes #893 (Tox: failed to connect to DHT);
- massive code cleaning;
Diffstat (limited to 'protocols/Tox/src/tox_core.cpp')
-rw-r--r-- | protocols/Tox/src/tox_core.cpp | 26 |
1 files changed, 9 insertions, 17 deletions
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 +}
|