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:
parent
1a8d77ccfa
commit
8ece7041fd
|
@ -217,7 +217,9 @@ QString ToxDNS::queryTox3(const tox3_server& server, const QString &record, bool
|
||||||
fallbackOnTox1:
|
fallbackOnTox1:
|
||||||
if (tox_dns3)
|
if (tox_dns3)
|
||||||
tox_dns3_kill(tox_dns3);
|
tox_dns3_kill(tox_dns3);
|
||||||
queryTox1(record, silent);
|
#if TOX1_SILENT_FALLBACK
|
||||||
|
toxIdStr = queryTox1(record, silent);
|
||||||
|
#endif
|
||||||
return toxIdStr;
|
return toxIdStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +256,11 @@ ToxID ToxDNS::resolveToxAddress(const QString &address, bool silent)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if TOX1_SILENT_FALLBACK
|
||||||
toxId = ToxID::fromString(queryTox1(address, silent));
|
toxId = ToxID::fromString(queryTox1(address, silent));
|
||||||
|
#else
|
||||||
|
return toxId;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return toxId;
|
return toxId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
#include <QDnsLookup>
|
#include <QDnsLookup>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
/// Tox1 is not encrypted, it's unsafe
|
||||||
|
#define TOX1_SILENT_FALLBACK 0
|
||||||
|
|
||||||
/// Handles tox1 and tox3 DNS queries
|
/// Handles tox1 and tox3 DNS queries
|
||||||
class ToxDNS : public QObject
|
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
|
/// 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 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 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, may fallback on queryTox1
|
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:
|
protected:
|
||||||
static void showWarning(const QString& message);
|
static void showWarning(const QString& message);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user