aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-11-06 01:56:06 +0200
committerRiccardo Spagni <ric@spagni.net>2017-11-06 01:56:06 +0200
commit3dd31d33fa9a1b99aec80ffdd17c67d72d6db6d8 (patch)
tree938382ca6f100b685068d4b78da3e57be8dea003 /src/wallet/wallet2.cpp
parentMerge pull request #2595 (diff)
parentWallet: Descriptions through new commands 'set_description', 'get_description' (diff)
downloadmonero-3dd31d33fa9a1b99aec80ffdd17c67d72d6db6d8.tar.xz
Merge pull request #2605
b370ef54 Wallet: Descriptions through new commands 'set_description', 'get_description' (rbrunner7)
Diffstat (limited to '')
-rw-r--r--src/wallet/wallet2.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index adbe267eb..f0eaf2331 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -6257,6 +6257,29 @@ std::string wallet2::get_tx_note(const crypto::hash &txid) const
return i->second;
}
+void wallet2::set_attribute(const std::string &key, const std::string &value)
+{
+ m_attributes[key] = value;
+}
+
+std::string wallet2::get_attribute(const std::string &key) const
+{
+ std::unordered_map<std::string, std::string>::const_iterator i = m_attributes.find(key);
+ if (i == m_attributes.end())
+ return std::string();
+ return i->second;
+}
+
+void wallet2::set_description(const std::string &description)
+{
+ set_attribute(ATTRIBUTE_DESCRIPTION, description);
+}
+
+std::string wallet2::get_description() const
+{
+ return get_attribute(ATTRIBUTE_DESCRIPTION);
+}
+
std::string wallet2::sign(const std::string &data) const
{
crypto::hash hash;