aboutsummaryrefslogtreecommitdiff
path: root/src/qt/guiutil.cpp
diff options
context:
space:
mode:
authorMatt Corallo <matt@bluematt.me>2012-02-07 13:46:53 -0500
committerMatt Corallo <matt@bluematt.me>2012-02-10 17:44:52 -0500
commitcce89ead184c6b61a3361e598cc7553512730a72 (patch)
tree5b6cb9a420aafd41cc73951624f6b73030a449aa /src/qt/guiutil.cpp
parent328b26d40b2ea046144a487a6b4927a630e91fb9 (diff)
Add -req prefixes to comply with BIP21.
Diffstat (limited to 'src/qt/guiutil.cpp')
-rw-r--r--src/qt/guiutil.cpp37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index 22d9cc7384..29ef554ac3 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -56,19 +56,36 @@ bool GUIUtil::parseBitcoinURL(const QUrl *url, SendCoinsRecipient *out)
SendCoinsRecipient rv;
rv.address = url->path();
- rv.label = url->queryItemValue("label");
-
- QString amount = url->queryItemValue("amount");
- if(amount.isEmpty())
- {
- rv.amount = 0;
- }
- else // Amount is non-empty
+ rv.amount = 0;
+ QList<QPair<QString, QString> > items = url->queryItems();
+ for (QList<QPair<QString, QString> >::iterator i = items.begin(); i != items.end(); i++)
{
- if(!BitcoinUnits::parse(BitcoinUnits::BTC, amount, &rv.amount))
+ bool fShouldReturnFalse = false;
+ if (i->first.startsWith("req-"))
{
- return false;
+ i->first.remove(0, 4);
+ fShouldReturnFalse = true;
}
+
+ if (i->first == "label")
+ {
+ rv.label = i->second;
+ fShouldReturnFalse = false;
+ }
+ else if (i->first == "amount")
+ {
+ if(!i->second.isEmpty())
+ {
+ if(!BitcoinUnits::parse(BitcoinUnits::BTC, i->second, &rv.amount))
+ {
+ return false;
+ }
+ }
+ fShouldReturnFalse = false;
+ }
+
+ if (fShouldReturnFalse)
+ return false;
}
if(out)
{