aboutsummaryrefslogtreecommitdiff
path: root/src/qt/walletmodel.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-01-22 08:07:19 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2014-01-22 08:07:56 +0100
commitceab53b41da4e812a63a7a7d6d05e9ed246a5cd5 (patch)
treefafe0f2960aff0fa77f2a30c5aadc436a76b7f01 /src/qt/walletmodel.cpp
parent6586bc3b51ac0a3891ff6297e1aea791ff331cd3 (diff)
parent4d901023b732efb492d89cebd8555c689ab7663e (diff)
Merge pull request #3521
4d90102 [Qt] Add sorting feature to the requested payments table (Cozz Lovan) 8476d5d [Qt] Permanently store requested payments in wallet (Cozz Lovan) b10e147 wallet: add interface for storing generic data on destinations (Wladimir J. van der Laan)
Diffstat (limited to 'src/qt/walletmodel.cpp')
-rw-r--r--src/qt/walletmodel.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp
index 14f29c933b..01f5a304a9 100644
--- a/src/qt/walletmodel.cpp
+++ b/src/qt/walletmodel.cpp
@@ -554,3 +554,27 @@ void WalletModel::listLockedCoins(std::vector<COutPoint>& vOutpts)
LOCK(wallet->cs_wallet);
wallet->ListLockedCoins(vOutpts);
}
+
+void WalletModel::loadReceiveRequests(std::vector<std::string>& vReceiveRequests)
+{
+ LOCK(wallet->cs_wallet);
+ BOOST_FOREACH(const PAIRTYPE(CTxDestination, CAddressBookData)& item, wallet->mapAddressBook)
+ BOOST_FOREACH(const PAIRTYPE(std::string, std::string)& item2, item.second.destdata)
+ if (item2.first.size() > 2 && item2.first.substr(0,2) == "rr") // receive request
+ vReceiveRequests.push_back(item2.second);
+}
+
+bool WalletModel::saveReceiveRequest(const std::string &sAddress, const int64_t nId, const std::string &sRequest)
+{
+ CTxDestination dest = CBitcoinAddress(sAddress).Get();
+
+ std::stringstream ss;
+ ss << nId;
+ std::string key = "rr" + ss.str(); // "rr" prefix = "receive request" in destdata
+
+ LOCK(wallet->cs_wallet);
+ if (sRequest.empty())
+ return wallet->EraseDestData(dest, key);
+ else
+ return wallet->AddDestData(dest, key, sRequest);
+}