simplewallet: add a welcome/disclaimer message command

I saw one when landing on www.tribler.org, and it seemed
like a good idea to have something similar, alongside some
more general "what is monero" text.
This commit is contained in:
moneromooo-monero 2019-04-01 23:11:56 +00:00
parent e03b9bcdfd
commit d843f20044
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
2 changed files with 34 additions and 0 deletions

View file

@ -244,6 +244,7 @@ namespace
const char* USAGE_THAW("thaw <key_image>");
const char* USAGE_FROZEN("frozen <key_image>");
const char* USAGE_NET_STATS("net_stats");
const char* USAGE_WELCOME("welcome");
const char* USAGE_VERSION("version");
const char* USAGE_HELP("help [<command>]");
@ -2139,6 +2140,24 @@ bool simple_wallet::net_stats(const std::vector<std::string> &args)
return true;
}
bool simple_wallet::welcome(const std::vector<std::string> &args)
{
message_writer() << tr("Welcome to Monero, the private cryptocurrency.");
message_writer() << "";
message_writer() << tr("Monero, like Bitcoin, is a cryptocurrency. That is, it is digital money.");
message_writer() << tr("Unlike Bitcoin, your Monero transactions and balance stay private, and not visible to the world by default.");
message_writer() << tr("However, you have the option of making those available to select parties, if you choose to.");
message_writer() << "";
message_writer() << tr("Monero protects your privacy on the blockchain, and while Monero strives to improve all the time,");
message_writer() << tr("no privacy technology can be 100% perfect, Monero included.");
message_writer() << tr("Monero cannot protect you from malware, and it may not be as effective as we hope against powerful adversaries.");
message_writer() << tr("Flaws in Monero may be discovered in the future, and attacks may be developed to peek under some");
message_writer() << tr("of the layers of privacy Monero provides. Be safe and practice defense in depth.");
message_writer() << "";
message_writer() << tr("Welcome to Monero and financial privacy. For more information, see https://getmonero.org/");
return true;
}
bool simple_wallet::version(const std::vector<std::string> &args)
{
message_writer() << "Monero '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")";
@ -3170,6 +3189,9 @@ simple_wallet::simple_wallet()
m_cmd_binder.set_handler("net_stats",
boost::bind(&simple_wallet::net_stats, this, _1),
tr(USAGE_NET_STATS),
m_cmd_binder.set_handler("welcome",
boost::bind(&simple_wallet::welcome, this, _1),
tr(USAGE_WELCOME),
tr("Prints simple network stats"));
m_cmd_binder.set_handler("version",
boost::bind(&simple_wallet::version, this, _1),
@ -3491,6 +3513,8 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
if (!handle_command_line(vm))
return false;
bool welcome = false;
if((!m_generate_new.empty()) + (!m_wallet_file.empty()) + (!m_generate_from_device.empty()) + (!m_generate_from_view_key.empty()) + (!m_generate_from_spend_key.empty()) + (!m_generate_from_keys.empty()) + (!m_generate_from_multisig_keys.empty()) + (!m_generate_from_json.empty()) > 1)
{
fail_msg_writer() << tr("can't specify more than one of --generate-new-wallet=\"wallet_name\", --wallet-file=\"wallet_name\", --generate-from-view-key=\"wallet_name\", --generate-from-spend-key=\"wallet_name\", --generate-from-keys=\"wallet_name\", --generate-from-multisig-keys=\"wallet_name\", --generate-from-json=\"jsonfilename\" and --generate-from-device=\"wallet_name\"");
@ -3648,6 +3672,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
auto r = new_wallet(vm, info.address, boost::none, viewkey);
CHECK_AND_ASSERT_MES(r, false, tr("account creation failed"));
password = *r;
welcome = true;
}
else if (!m_generate_from_spend_key.empty())
{
@ -3668,6 +3693,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
auto r = new_wallet(vm, m_recovery_key, true, false, "");
CHECK_AND_ASSERT_MES(r, false, tr("account creation failed"));
password = *r;
welcome = true;
}
else if (!m_generate_from_keys.empty())
{
@ -3745,6 +3771,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
auto r = new_wallet(vm, info.address, spendkey, viewkey);
CHECK_AND_ASSERT_MES(r, false, tr("account creation failed"));
password = *r;
welcome = true;
}
// Asks user for all the data required to merge secret keys from multisig wallets into one master wallet, which then gets full control of the multisig wallet. The resulting wallet will be the same as any other regular wallet.
@ -3878,6 +3905,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
auto r = new_wallet(vm, info.address, spendkey, viewkey);
CHECK_AND_ASSERT_MES(r, false, tr("account creation failed"));
password = *r;
welcome = true;
}
else if (!m_generate_from_json.empty())
@ -3904,6 +3932,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
auto r = new_wallet(vm);
CHECK_AND_ASSERT_MES(r, false, tr("account creation failed"));
password = *r;
welcome = true;
// if no block_height is specified, assume its a new account and start it "now"
if(m_wallet->get_refresh_from_block_height() == 0) {
{
@ -3935,6 +3964,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
r = new_wallet(vm, m_recovery_key, m_restore_deterministic_wallet, m_non_deterministic, old_language);
CHECK_AND_ASSERT_MES(r, false, tr("account creation failed"));
password = *r;
welcome = true;
}
if (m_restoring && m_generate_from_json.empty() && m_generate_from_device.empty())
@ -4058,6 +4088,9 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
check_background_mining(password);
if (welcome)
message_writer(console_color_yellow, true) << tr("If you are new to Monero, type \"welcome\" for a brief overview.");
return true;
}
//----------------------------------------------------------------------------------------------------

View file

@ -244,6 +244,7 @@ namespace cryptonote
bool thaw(const std::vector<std::string>& args);
bool frozen(const std::vector<std::string>& args);
bool net_stats(const std::vector<std::string>& args);
bool welcome(const std::vector<std::string>& args);
bool version(const std::vector<std::string>& args);
bool cold_sign_tx(const std::vector<tools::wallet2::pending_tx>& ptx_vector, tools::wallet2::signed_tx_set &exported_txs, std::vector<cryptonote::address_parse_info> &dsts_info, std::function<bool(const tools::wallet2::signed_tx_set &)> accept_func);