From 35d1269faca070e1ec8906d0683896f937685b97 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Fri, 13 Apr 2018 18:12:17 +0100 Subject: [PATCH 1/2] daemon: add a version command --- src/daemon/command_parser_executor.cpp | 7 +++++++ src/daemon/command_parser_executor.h | 2 ++ src/daemon/command_server.cpp | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/src/daemon/command_parser_executor.cpp b/src/daemon/command_parser_executor.cpp index 7a89ebc0c..28a7f1366 100644 --- a/src/daemon/command_parser_executor.cpp +++ b/src/daemon/command_parser_executor.cpp @@ -27,6 +27,7 @@ // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "common/dns_utils.h" +#include "version.h" #include "daemon/command_parser_executor.h" #undef MONERO_DEFAULT_LOG_CATEGORY @@ -664,4 +665,10 @@ bool t_command_parser_executor::sync_info(const std::vector& args) return m_executor.sync_info(); } +bool t_command_parser_executor::version(const std::vector& args) +{ + std::cout << "Monero '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")" << std::endl; + return true; +} + } // namespace daemonize diff --git a/src/daemon/command_parser_executor.h b/src/daemon/command_parser_executor.h index 2c09a4748..a70070171 100644 --- a/src/daemon/command_parser_executor.h +++ b/src/daemon/command_parser_executor.h @@ -138,6 +138,8 @@ public: bool relay_tx(const std::vector& args); bool sync_info(const std::vector& args); + + bool version(const std::vector& args); }; } // namespace daemonize diff --git a/src/daemon/command_server.cpp b/src/daemon/command_server.cpp index a50dbea69..144603597 100644 --- a/src/daemon/command_server.cpp +++ b/src/daemon/command_server.cpp @@ -280,6 +280,11 @@ t_command_server::t_command_server( , std::bind(&t_command_parser_executor::sync_info, &m_parser, p::_1) , "Print information about the blockchain sync state." ); + m_command_lookup.set_handler( + "version" + , std::bind(&t_command_parser_executor::version, &m_parser, p::_1) + , "Print version information." + ); } bool t_command_server::process_command_str(const std::string& cmd) From 51b511be4c584ee4e5222bd3c4f4e08f36519082 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Fri, 13 Apr 2018 18:45:10 +0100 Subject: [PATCH 2/2] simplewallet: add version command --- src/simplewallet/simplewallet.cpp | 11 +++++++++++ src/simplewallet/simplewallet.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 33615ffe2..f5a075f54 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -62,6 +62,7 @@ #include "ringct/rctSigs.h" #include "multisig/multisig.h" #include "wallet/wallet_args.h" +#include "version.h" #include #ifdef WIN32 @@ -1584,6 +1585,12 @@ bool simple_wallet::save_known_rings(const std::vector &args) return true; } +bool simple_wallet::version(const std::vector &args) +{ + message_writer() << "Monero '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")"; + return true; +} + bool simple_wallet::set_always_confirm_transfers(const std::vector &args/* = std::vector()*/) { const auto pwd_container = get_and_verify_password(); @@ -2335,6 +2342,10 @@ simple_wallet::simple_wallet() boost::bind(&simple_wallet::blackballed, this, _1), tr("blackballed "), tr("Checks whether an output is blackballed")); + m_cmd_binder.set_handler("version", + boost::bind(&simple_wallet::version, this, _1), + tr("version"), + tr("Returns version information")); m_cmd_binder.set_handler("help", boost::bind(&simple_wallet::help, this, _1), tr("help []"), diff --git a/src/simplewallet/simplewallet.h b/src/simplewallet/simplewallet.h index f26f69353..39a91c5f5 100644 --- a/src/simplewallet/simplewallet.h +++ b/src/simplewallet/simplewallet.h @@ -218,6 +218,7 @@ namespace cryptonote bool blackball(const std::vector& args); bool unblackball(const std::vector& args); bool blackballed(const std::vector& args); + bool version(const std::vector& args); uint64_t get_daemon_blockchain_height(std::string& err); bool try_connect_to_daemon(bool silent = false, uint32_t* version = nullptr);