GUI: If BIP70 is disabled, attempt to fall back to BIP21 parsing

This commit is contained in:
Luke Dashjr 2018-12-30 10:06:53 +00:00
parent 1bc149d05b
commit 9975282fa8

View file

@ -292,9 +292,9 @@ void PaymentServer::handleURIOrFile(const QString& s)
else if (s.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin: URI else if (s.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin: URI
{ {
QUrlQuery uri((QUrl(s))); QUrlQuery uri((QUrl(s)));
#ifdef ENABLE_BIP70
if (uri.hasQueryItem("r")) // payment request URI if (uri.hasQueryItem("r")) // payment request URI
{ {
#ifdef ENABLE_BIP70
Q_EMIT message(tr("URI handling"), Q_EMIT message(tr("URI handling"),
tr("You are using a BIP70 URL which will be unsupported in the future."), tr("You are using a BIP70 URL which will be unsupported in the future."),
CClientUIInterface::ICON_WARNING); CClientUIInterface::ICON_WARNING);
@ -315,19 +315,23 @@ void PaymentServer::handleURIOrFile(const QString& s)
tr("Payment request fetch URL is invalid: %1").arg(fetchUrl.toString()), tr("Payment request fetch URL is invalid: %1").arg(fetchUrl.toString()),
CClientUIInterface::ICON_WARNING); CClientUIInterface::ICON_WARNING);
} }
#else
Q_EMIT message(tr("URI handling"),
tr("Cannot process payment request because BIP70 support was not compiled in."),
CClientUIInterface::ICON_WARNING);
#endif
return; return;
} }
else // normal URI else
#endif
// normal URI
{ {
SendCoinsRecipient recipient; SendCoinsRecipient recipient;
if (GUIUtil::parseBitcoinURI(s, &recipient)) if (GUIUtil::parseBitcoinURI(s, &recipient))
{ {
if (!IsValidDestinationString(recipient.address.toStdString())) { if (!IsValidDestinationString(recipient.address.toStdString())) {
#ifndef ENABLE_BIP70
if (uri.hasQueryItem("r")) { // payment request
Q_EMIT message(tr("URI handling"),
tr("Cannot process payment request because BIP70 support was not compiled in."),
CClientUIInterface::ICON_WARNING);
}
#endif
Q_EMIT message(tr("URI handling"), tr("Invalid payment address %1").arg(recipient.address), Q_EMIT message(tr("URI handling"), tr("Invalid payment address %1").arg(recipient.address),
CClientUIInterface::MSG_ERROR); CClientUIInterface::MSG_ERROR);
} }