| 212 | } |
| 213 | |
| 214 | void PaymentServer::handleURIOrFile(const QString& s) |
| 215 | { |
| 216 | if (saveURIs) |
| 217 | { |
| 218 | savedPaymentRequests.insert(s); |
| 219 | return; |
| 220 | } |
| 221 | |
| 222 | if (s.startsWith("bitcoin://", Qt::CaseInsensitive)) |
| 223 | { |
| 224 | Q_EMIT message(tr("URI handling"), tr("'bitcoin://' is not a valid URI. Use 'bitcoin:' instead."), |
| 225 | CClientUIInterface::MSG_ERROR); |
| 226 | } |
| 227 | else if (s.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin: URI |
| 228 | { |
| 229 | QUrlQuery uri((QUrl(s))); |
| 230 | // normal URI |
| 231 | { |
| 232 | SendCoinsRecipient recipient; |
| 233 | if (GUIUtil::parseBitcoinURI(s, &recipient)) |
| 234 | { |
| 235 | std::string error_msg; |
| 236 | const CTxDestination dest = DecodeDestination(recipient.address.toStdString(), error_msg); |
| 237 | |
| 238 | if (!IsValidDestination(dest)) { |
| 239 | if (uri.hasQueryItem("r")) { // payment request |
| 240 | Q_EMIT message(tr("URI handling"), |
| 241 | tr("Cannot process payment request because BIP70 is not supported.\n" |
| 242 | "Due to widespread security flaws in BIP70 it's strongly recommended that any merchant instructions to switch wallets be ignored.\n" |
| 243 | "If you are receiving this error you should request the merchant provide a BIP21 compatible URI."), |
| 244 | CClientUIInterface::ICON_WARNING); |
| 245 | } |
| 246 | Q_EMIT message(tr("URI handling"), QString::fromStdString(error_msg), |
| 247 | CClientUIInterface::MSG_ERROR); |
| 248 | } |
| 249 | else |
| 250 | Q_EMIT receivedPaymentRequest(recipient); |
| 251 | } |
| 252 | else |
| 253 | Q_EMIT message(tr("URI handling"), |
| 254 | tr("URI cannot be parsed! This can be caused by an invalid address or malformed URI parameters."), |
| 255 | CClientUIInterface::ICON_WARNING); |
| 256 | |
| 257 | return; |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | if (QFile::exists(s)) // payment request file |
| 262 | { |
| 263 | Q_EMIT message(tr("Payment request file handling"), |
| 264 | tr("Cannot process payment request because BIP70 is not supported.\n" |
| 265 | "Due to widespread security flaws in BIP70 it's strongly recommended that any merchant instructions to switch wallets be ignored.\n" |
| 266 | "If you are receiving this error you should request the merchant provide a BIP21 compatible URI."), |
| 267 | CClientUIInterface::ICON_WARNING); |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | void PaymentServer::handleURIConnection() |
nothing calls this directly
no test coverage detected