aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/api/address_book.cpp
diff options
context:
space:
mode:
authordsc <dsc@xmr.pm>2020-09-19 18:29:46 +0200
committerselsta <selsta@sent.at>2021-04-22 04:31:36 +0200
commit22bb6a654da23e8aa56d26b25e4299c0ed5c43df (patch)
tree2a736784fadc2c1c8202c35a2ce68962f4d4027c /src/wallet/api/address_book.cpp
parentMerge pull request #7655 (diff)
downloadmonero-22bb6a654da23e8aa56d26b25e4299c0ed5c43df.tar.xz
Allow AddressBook description edits via wallet/api interface
Diffstat (limited to 'src/wallet/api/address_book.cpp')
-rw-r--r--src/wallet/api/address_book.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/wallet/api/address_book.cpp b/src/wallet/api/address_book.cpp
index f69a69ca3..96090d9f5 100644
--- a/src/wallet/api/address_book.cpp
+++ b/src/wallet/api/address_book.cpp
@@ -70,6 +70,25 @@ bool AddressBookImpl::addRow(const std::string &dst_addr , const std::string &pa
return r;
}
+bool AddressBookImpl::setDescription(std::size_t index, const std::string &description)
+{
+ clearStatus();
+
+ const auto ab = m_wallet->m_wallet->get_address_book();
+ if (index >= ab.size()){
+ return false;
+ }
+
+ tools::wallet2::address_book_row entry = ab[index];
+ entry.m_description = description;
+ bool r = m_wallet->m_wallet->set_address_book_row(index, entry.m_address, NULL, entry.m_description, entry.m_is_subaddress);
+ if (r)
+ refresh();
+ else
+ m_errorCode = General_Error;
+ return r;
+}
+
void AddressBookImpl::refresh()
{
LOG_PRINT_L2("Refreshing addressbook");