diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-11-28 12:38:58 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-11-28 12:41:06 +0000 |
commit | 62e49a5f02da0963fb0303383626b2c86443d405 (patch) | |
tree | f98be933b63426d26cd3b91be7cc0db8106467d5 /contrib/epee | |
parent | Merge pull request #501 (diff) | |
download | monero-62e49a5f02da0963fb0303383626b2c86443d405.tar.xz |
wallet: optional automatic refresh from the daemon
The daemon will be polled every 90 seconds for new blocks.
It is enabled by default, and can be turned on/off with
set auto-refresh 1 and set auto-refresh 0 in the wallet.
Diffstat (limited to 'contrib/epee')
-rw-r--r-- | contrib/epee/include/console_handler.h | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/contrib/epee/include/console_handler.h b/contrib/epee/include/console_handler.h index 0eff095e1..c6e7c857d 100644 --- a/contrib/epee/include/console_handler.h +++ b/contrib/epee/include/console_handler.h @@ -251,27 +251,33 @@ namespace epee m_stdin_reader.stop(); } + void print_prompt() + { + if (!m_prompt.empty()) + { + epee::log_space::set_console_color(epee::log_space::console_color_yellow, true); + std::cout << m_prompt; + if (' ' != m_prompt.back()) + std::cout << ' '; + epee::log_space::reset_console_color(); + std::cout.flush(); + } + } + private: template<typename t_cmd_handler> bool run(const std::string& prompt, const std::string& usage, const t_cmd_handler& cmd_handler, std::function<void(void)> exit_handler) { TRY_ENTRY(); bool continue_handle = true; + m_prompt = prompt; while(continue_handle) { if (!m_running) { break; } - if (!prompt.empty()) - { - epee::log_space::set_console_color(epee::log_space::console_color_yellow, true); - std::cout << prompt; - if (' ' != prompt.back()) - std::cout << ' '; - epee::log_space::reset_console_color(); - std::cout.flush(); - } + print_prompt(); std::string command; bool get_line_ret = m_stdin_reader.get_line(command); @@ -313,6 +319,7 @@ namespace epee private: async_stdin_reader m_stdin_reader; std::atomic<bool> m_running = {true}; + std::string m_prompt; }; @@ -447,6 +454,11 @@ namespace epee { return m_console_handler.run(boost::bind(&console_handlers_binder::process_command_str, this, _1), prompt, usage_string, exit_handler); } + + void print_prompt() + { + m_console_handler.print_prompt(); + } }; ///* work around because of broken boost bind */ |