diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-08-15 20:46:31 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-08-15 20:46:31 +0200 |
commit | 6f60613ffb345e3af25b0ddf70499d015379e11c (patch) | |
tree | d6b69c6e1b09275af71b4290f6077e9eb89d313a /src/simplewallet | |
parent | Merge pull request #2238 (diff) | |
parent | simplewallet: add (out of sync) or (no daemon) markers in the prompt (diff) | |
download | monero-6f60613ffb345e3af25b0ddf70499d015379e11c.tar.xz |
Merge pull request #2240
b7d6ec83 simplewallet: add (out of sync) or (no daemon) markers in the prompt (moneromooo-monero)
fa23a500 wallet2: add a is_synced function (moneromooo-monero)
f1307bbd node_rpc_proxy: add a proxy for target height (moneromooo-monero)
Diffstat (limited to 'src/simplewallet')
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 16 | ||||
-rw-r--r-- | src/simplewallet/simplewallet.h | 1 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 940007635..4dc34d6e6 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -4191,6 +4191,19 @@ void simple_wallet::wallet_idle_thread() } } //---------------------------------------------------------------------------------------------------- +std::string simple_wallet::get_prompt() const +{ + std::string addr_start = m_wallet->get_account().get_public_address_str(m_wallet->testnet()).substr(0, 6); + std::string prompt = std::string("[") + tr("wallet") + " " + addr_start; + uint32_t version; + if (!m_wallet->check_connection(&version)) + prompt += tr(" (no daemon)"); + else if (!m_wallet->is_synced()) + prompt += tr(" (out of sync)"); + prompt += "]: "; + return prompt; +} +//---------------------------------------------------------------------------------------------------- bool simple_wallet::run() { // check and display warning, but go on anyway @@ -4201,9 +4214,8 @@ bool simple_wallet::run() m_auto_refresh_enabled = m_wallet->auto_refresh(); m_idle_thread = boost::thread([&]{wallet_idle_thread();}); - std::string addr_start = m_wallet->get_account().get_public_address_str(m_wallet->testnet()).substr(0, 6); message_writer(console_color_green, false) << "Background refresh thread started"; - return m_cmd_binder.run_handling(std::string("[") + tr("wallet") + " " + addr_start + "]: ", ""); + return m_cmd_binder.run_handling([this](){return get_prompt();}, ""); } //---------------------------------------------------------------------------------------------------- void simple_wallet::stop() diff --git a/src/simplewallet/simplewallet.h b/src/simplewallet/simplewallet.h index 1fb85a3c7..cca5d4928 100644 --- a/src/simplewallet/simplewallet.h +++ b/src/simplewallet/simplewallet.h @@ -182,6 +182,7 @@ namespace cryptonote bool accept_loaded_tx(const tools::wallet2::unsigned_tx_set &txs); bool accept_loaded_tx(const tools::wallet2::signed_tx_set &txs); bool print_ring_members(const std::vector<tools::wallet2::pending_tx>& ptx_vector, std::ostream& ostr); + std::string get_prompt() const; /*! * \brief Prints the seed with a nice message |