1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Re-apply toxcore tox_new compat patch

This commit is contained in:
tux3 2015-05-29 17:29:25 +02:00
parent 998a9e2e99
commit 6409b273a4
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -153,6 +153,10 @@ void Core::make_tox(QByteArray savedata)
toxOptions.proxy_host = nullptr; toxOptions.proxy_host = nullptr;
toxOptions.proxy_port = 0; toxOptions.proxy_port = 0;
toxOptions.savedata_type = (!savedata.isNull() ? TOX_SAVEDATA_TYPE_TOX_SAVE : TOX_SAVEDATA_TYPE_NONE);
toxOptions.savedata_data = (uint8_t*)savedata.data();
toxOptions.savedata_length = savedata.size();
if (proxyType != ProxyType::ptNone) if (proxyType != ProxyType::ptNone)
{ {
QString proxyAddr = Settings::getInstance().getProxyAddr(); QString proxyAddr = Settings::getInstance().getProxyAddr();
@ -181,7 +185,7 @@ void Core::make_tox(QByteArray savedata)
} }
TOX_ERR_NEW tox_err; TOX_ERR_NEW tox_err;
tox = tox_new(&toxOptions, (uint8_t*)savedata.data(), savedata.size(), &tox_err); tox = tox_new(&toxOptions, &tox_err);
switch (tox_err) switch (tox_err)
{ {
@ -191,7 +195,7 @@ void Core::make_tox(QByteArray savedata)
if (enableIPv6) if (enableIPv6)
{ {
toxOptions.ipv6_enabled = false; toxOptions.ipv6_enabled = false;
tox = tox_new(&toxOptions, (uint8_t*)savedata.data(), savedata.size(), &tox_err); tox = tox_new(&toxOptions, &tox_err);
if (tox_err == TOX_ERR_NEW_OK) if (tox_err == TOX_ERR_NEW_OK)
{ {
qWarning() << "Core failed to start with IPv6, falling back to IPv4. LAN discovery may not work properly."; qWarning() << "Core failed to start with IPv6, falling back to IPv4. LAN discovery may not work properly.";