aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authorJaquee <jaquee.monero@gmail.com>2016-12-12 21:39:29 +0100
committerJaquee <jaquee.monero@gmail.com>2016-12-12 21:50:50 +0100
commit3b4539ee7e75779029fc77d66263c0ae164af396 (patch)
tree8b340ead05c950767ba6f8776a864eff2afced39 /src/wallet/wallet2.cpp
parentMerge pull request #1424 (diff)
downloadmonero-3b4539ee7e75779029fc77d66263c0ae164af396.tar.xz
addressbook updates
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r--src/wallet/wallet2.cpp15
1 files changed, 11 insertions, 4 deletions
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;
}
//----------------------------------------------------------------------------------------------------