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

Disable silently falling back to tox1 when tox3 fails

This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-11-10 23:55:13 +01:00
parent 1a8d77ccfa
commit 8ece7041fd
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
2 changed files with 12 additions and 3 deletions

View File

@ -217,7 +217,9 @@ QString ToxDNS::queryTox3(const tox3_server& server, const QString &record, bool
fallbackOnTox1:
if (tox_dns3)
tox_dns3_kill(tox_dns3);
queryTox1(record, silent);
#if TOX1_SILENT_FALLBACK
toxIdStr = queryTox1(record, silent);
#endif
return toxIdStr;
}
@ -254,7 +256,11 @@ ToxID ToxDNS::resolveToxAddress(const QString &address, bool silent)
}
else
{
#if TOX1_SILENT_FALLBACK
toxId = ToxID::fromString(queryTox1(address, silent));
#else
return toxId;
#endif
}
return toxId;
}

View File

@ -22,6 +22,9 @@
#include <QDnsLookup>
#include <QObject>
/// Tox1 is not encrypted, it's unsafe
#define TOX1_SILENT_FALLBACK 0
/// Handles tox1 and tox3 DNS queries
class ToxDNS : public QObject
{
@ -41,8 +44,8 @@ public:
/// Tries to map a text string to a ToxID struct, will query Tox DNS records if necessary
static ToxID resolveToxAddress(const QString& address, bool silent=true);
static QString queryTox1(const QString& record, bool silent=true); ///< Record should look like user@domain.tld
static QString queryTox3(const tox3_server& server, const QString& record, bool silent=true); ///< Record should look like user@domain.tld, may fallback on queryTox1
static QString queryTox1(const QString& record, bool silent=true); ///< Record should look like user@domain.tld. Do *NOT* use tox1 without a good reason, it's unsafe.
static QString queryTox3(const tox3_server& server, const QString& record, bool silent=true); ///< Record should look like user@domain.tld, will *NOT* fallback on queryTox1 anymore
protected:
static void showWarning(const QString& message);