addressbook updates

This commit is contained in:
Jaquee
2016-12-12 21:39:29 +01:00
parent 5b7f1fc8e4
commit 3b4539ee7e
5 changed files with 40 additions and 25 deletions

View File

@@ -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;
}
//----------------------------------------------------------------------------------------------------