1
0
Fork 0
forked from lthn/blockchain

simplewallet: on_message implemented for urgent messages from wallet2

This commit is contained in:
sowle 2020-05-26 13:25:03 +03:00
parent 76f3318555
commit c1ba75db3f
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC
2 changed files with 14 additions and 1 deletions

View file

@ -463,7 +463,7 @@ bool simple_wallet::open_wallet(const string &wallet_file, const std::string& pa
try
{
m_wallet->load(epee::string_encoding::utf8_to_wstring(m_wallet_file), password);
message_writer(epee::log_space::console_color_white, true) << "Opened" << (m_wallet->is_watch_only() ? " watch-only" : "") << " wallet: " << m_wallet->get_account().get_public_address_str();
message_writer(epee::log_space::console_color_white, true) << "Opened" << (m_wallet->is_auditable() ? " auditable" : "") << (m_wallet->is_watch_only() ? " watch-only" : "") << " wallet: " << m_wallet->get_account().get_public_address_str();
if (m_print_brain_wallet)
std::cout << "Brain wallet: " << m_wallet->get_account().get_restore_braindata() << std::endl << std::flush;
@ -604,6 +604,17 @@ void simple_wallet::on_transfer2(const tools::wallet_public::wallet_transfer_inf
m_refresh_progress_reporter.update(wti.height, true);
}
//----------------------------------------------------------------------------------------------------
void simple_wallet::on_message(i_wallet2_callback::message_severity severity, const std::string& m)
{
epee::log_space::console_colors color = epee::log_space::console_color_white;
if (severity == i_wallet2_callback::ms_red)
color = epee::log_space::console_color_red;
else if (severity == i_wallet2_callback::ms_yellow)
color = epee::log_space::console_color_yellow;
message_writer(color, true, std::string()) << m;
}
//----------------------------------------------------------------------------------------------------
bool simple_wallet::refresh(const std::vector<std::string>& args)
{
if (m_offline_mode)

View file

@ -95,6 +95,8 @@ namespace currency
//----------------- i_wallet2_callback ---------------------
virtual void on_new_block(uint64_t height, const currency::block& block) override;
virtual void on_transfer2(const tools::wallet_public::wallet_transfer_info& wti, uint64_t balance, uint64_t unlocked_balance, uint64_t total_mined) override;
virtual void on_message(i_wallet2_callback::message_severity severity, const std::string& m) override;
//----------------------------------------------------------
friend class refresh_progress_reporter_t;