diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-11-06 01:56:06 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-11-06 01:56:06 +0200 |
commit | 3dd31d33fa9a1b99aec80ffdd17c67d72d6db6d8 (patch) | |
tree | 938382ca6f100b685068d4b78da3e57be8dea003 /src/wallet/wallet_rpc_server.cpp | |
parent | Merge pull request #2595 (diff) | |
parent | Wallet: Descriptions through new commands 'set_description', 'get_description' (diff) | |
download | monero-3dd31d33fa9a1b99aec80ffdd17c67d72d6db6d8.tar.xz |
Merge pull request #2605
b370ef54 Wallet: Descriptions through new commands 'set_description', 'get_description' (rbrunner7)
Diffstat (limited to 'src/wallet/wallet_rpc_server.cpp')
-rwxr-xr-x | src/wallet/wallet_rpc_server.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp index acd5357ed..9e6a97bdc 100755 --- a/src/wallet/wallet_rpc_server.cpp +++ b/src/wallet/wallet_rpc_server.cpp @@ -1273,6 +1273,35 @@ namespace tools return true; } //------------------------------------------------------------------------------------------------------------------------------ + bool wallet_rpc_server::on_set_attribute(const wallet_rpc::COMMAND_RPC_SET_ATTRIBUTE::request& req, wallet_rpc::COMMAND_RPC_SET_ATTRIBUTE::response& res, epee::json_rpc::error& er) + { + if (!m_wallet) return not_open(er); + if (m_wallet->restricted()) + { + er.code = WALLET_RPC_ERROR_CODE_DENIED; + er.message = "Command unavailable in restricted mode."; + return false; + } + + m_wallet->set_attribute(req.key, req.value); + + return true; + } + //------------------------------------------------------------------------------------------------------------------------------ + bool wallet_rpc_server::on_get_attribute(const wallet_rpc::COMMAND_RPC_GET_ATTRIBUTE::request& req, wallet_rpc::COMMAND_RPC_GET_ATTRIBUTE::response& res, epee::json_rpc::error& er) + { + if (!m_wallet) return not_open(er); + if (m_wallet->restricted()) + { + er.code = WALLET_RPC_ERROR_CODE_DENIED; + er.message = "Command unavailable in restricted mode."; + return false; + } + + res.value = m_wallet->get_attribute(req.key); + return true; + } + //------------------------------------------------------------------------------------------------------------------------------ bool wallet_rpc_server::on_get_transfers(const wallet_rpc::COMMAND_RPC_GET_TRANSFERS::request& req, wallet_rpc::COMMAND_RPC_GET_TRANSFERS::response& res, epee::json_rpc::error& er) { if (!m_wallet) return not_open(er); |