From 3b4539ee7e75779029fc77d66263c0ae164af396 Mon Sep 17 00:00:00 2001 From: Jaquee Date: Mon, 12 Dec 2016 21:39:29 +0100 Subject: addressbook updates --- src/wallet/wallet2.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/wallet/wallet2.cpp') diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 3dafa56f0..60fa1d266 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -1569,13 +1569,20 @@ bool wallet2::add_address_book_row(const cryptonote::account_public_address &add a.m_payment_id = payment_id; a.m_description = description; - int key = (m_address_book.empty())? 0 : m_address_book.rbegin()->first; - bool r = m_address_book.emplace(++key,a).second; - return r; + int old_size = m_address_book.size(); + m_address_book.push_back(a); + if(m_address_book.size() == old_size+1) + return true; + return false; } bool wallet2::delete_address_book_row(int row_id) { - return (m_address_book.erase(row_id) > 0); + if(m_address_book.size() <= row_id) + return false; + + m_address_book.erase(m_address_book.begin()+row_id); + + return true; } //---------------------------------------------------------------------------------------------------- -- cgit v1.2.3