diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-03-18 20:22:31 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-03-18 20:22:31 +0200 |
commit | 50b8af5b45e44f87362484d720abf3300ce3aa94 (patch) | |
tree | 701896339785cbb8e4235a26c4a55e0e5abd5933 /src/common | |
parent | Merge pull request #1869 (diff) | |
parent | wallet-rpc: enable openalias (diff) | |
download | monero-50b8af5b45e44f87362484d720abf3300ce3aa94.tar.xz |
Merge pull request #1874
250c4cb3 wallet-rpc: enable openalias (stoffu)
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/dns_utils.cpp | 8 | ||||
-rw-r--r-- | src/common/dns_utils.h | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/common/dns_utils.cpp b/src/common/dns_utils.cpp index 7faf74dd8..ab38cbbae 100644 --- a/src/common/dns_utils.cpp +++ b/src/common/dns_utils.cpp @@ -405,21 +405,23 @@ std::vector<std::string> addresses_from_url(const std::string& url, bool& dnssec return addresses; } -std::string get_account_address_as_str_from_url(const std::string& url, bool& dnssec_valid) +std::string get_account_address_as_str_from_url(const std::string& url, bool& dnssec_valid, bool cli_confirm) { // attempt to get address from dns query auto addresses = addresses_from_url(url, dnssec_valid); if (addresses.empty()) { - std::cout << tr("wrong address: ") << url; + LOG_ERROR("wrong address: " << url); return {}; } // for now, move on only if one address found if (addresses.size() > 1) { - std::cout << tr("not yet supported: Multiple Monero addresses found for given URL: ") << url; + LOG_ERROR("not yet supported: Multiple Monero addresses found for given URL: " << url); return {}; } + if (!cli_confirm) + return addresses[0]; // prompt user for confirmation. // inform user of DNSSEC validation status as well. std::string dnssec_str; diff --git a/src/common/dns_utils.h b/src/common/dns_utils.h index 6a7fc5628..53c0c1c7b 100644 --- a/src/common/dns_utils.h +++ b/src/common/dns_utils.h @@ -163,7 +163,7 @@ namespace dns_utils std::string address_from_txt_record(const std::string& s); std::vector<std::string> addresses_from_url(const std::string& url, bool& dnssec_valid); -std::string get_account_address_as_str_from_url(const std::string& url, bool& dnssec_valid); +std::string get_account_address_as_str_from_url(const std::string& url, bool& dnssec_valid, bool cli_confirm = true); bool load_txt_records_from_dns(std::vector<std::string> &records, const std::vector<std::string> &dns_urls); |