diff --git a/src/toxdns.cpp b/src/toxdns.cpp index cbfbe8e0b..1a5e3b0c5 100644 --- a/src/toxdns.cpp +++ b/src/toxdns.cpp @@ -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; } diff --git a/src/toxdns.h b/src/toxdns.h index 546ade72e..a7a644041 100644 --- a/src/toxdns.h +++ b/src/toxdns.h @@ -22,6 +22,9 @@ #include #include +/// 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);