Changeset View
Changeset View
Standalone View
Standalone View
src/qt/paymentserver.cpp
Show First 20 Lines • Show All 349 Lines • ▼ Show 20 Lines | if (startLocalServer) { | ||||
uriServer = new QLocalServer(this); | uriServer = new QLocalServer(this); | ||||
if (!uriServer->listen(name)) { | if (!uriServer->listen(name)) { | ||||
// constructor is called early in init, so don't use "Q_EMIT | // constructor is called early in init, so don't use "Q_EMIT | ||||
// message()" here | // message()" here | ||||
QMessageBox::critical(0, tr("Payment request error"), | QMessageBox::critical(0, tr("Payment request error"), | ||||
tr("Cannot start click-to-pay handler")); | tr("Cannot start click-to-pay handler")); | ||||
} else { | } else { | ||||
connect(uriServer, SIGNAL(newConnection()), this, | connect(uriServer, &QLocalServer::newConnection, this, | ||||
SLOT(handleURIConnection())); | &PaymentServer::handleURIConnection); | ||||
connect(this, SIGNAL(receivedPaymentACK(QString)), this, | connect(this, &PaymentServer::receivedPaymentACK, this, | ||||
SLOT(handlePaymentACK(QString))); | &PaymentServer::handlePaymentACK); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
PaymentServer::~PaymentServer() { | PaymentServer::~PaymentServer() { | ||||
google::protobuf::ShutdownProtobufLibrary(); | google::protobuf::ShutdownProtobufLibrary(); | ||||
} | } | ||||
Show All 36 Lines | if (optionsModel->getProxySettings(proxy)) { | ||||
qDebug() << "PaymentServer::initNetManager: Using SOCKS5 proxy" | qDebug() << "PaymentServer::initNetManager: Using SOCKS5 proxy" | ||||
<< proxy.hostName() << ":" << proxy.port(); | << proxy.hostName() << ":" << proxy.port(); | ||||
} else { | } else { | ||||
qDebug() | qDebug() | ||||
<< "PaymentServer::initNetManager: No active proxy server found."; | << "PaymentServer::initNetManager: No active proxy server found."; | ||||
} | } | ||||
connect(netManager, SIGNAL(finished(QNetworkReply *)), this, | connect(netManager, &QNetworkAccessManager::finished, this, | ||||
SLOT(netRequestFinished(QNetworkReply *))); | &PaymentServer::netRequestFinished); | ||||
connect(netManager, | connect(netManager, &QNetworkAccessManager::sslErrors, this, | ||||
SIGNAL(sslErrors(QNetworkReply *, const QList<QSslError> &)), this, | &PaymentServer::reportSslErrors); | ||||
SLOT(reportSslErrors(QNetworkReply *, const QList<QSslError> &))); | |||||
} | } | ||||
void PaymentServer::uiReady() { | void PaymentServer::uiReady() { | ||||
initNetManager(); | initNetManager(); | ||||
saveURIs = false; | saveURIs = false; | ||||
for (const QString &s : savedPaymentRequests) { | for (const QString &s : savedPaymentRequests) { | ||||
handleURIOrFile(s); | handleURIOrFile(s); | ||||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | |||||
void PaymentServer::handleURIConnection() { | void PaymentServer::handleURIConnection() { | ||||
QLocalSocket *clientConnection = uriServer->nextPendingConnection(); | QLocalSocket *clientConnection = uriServer->nextPendingConnection(); | ||||
while (clientConnection->bytesAvailable() < (int)sizeof(quint32)) { | while (clientConnection->bytesAvailable() < (int)sizeof(quint32)) { | ||||
clientConnection->waitForReadyRead(); | clientConnection->waitForReadyRead(); | ||||
} | } | ||||
connect(clientConnection, SIGNAL(disconnected()), clientConnection, | connect(clientConnection, &QLocalSocket::disconnected, clientConnection, | ||||
SLOT(deleteLater())); | &QLocalSocket::deleteLater); | ||||
QDataStream in(clientConnection); | QDataStream in(clientConnection); | ||||
in.setVersion(QDataStream::Qt_4_0); | in.setVersion(QDataStream::Qt_4_0); | ||||
if (clientConnection->bytesAvailable() < (int)sizeof(quint16)) { | if (clientConnection->bytesAvailable() < (int)sizeof(quint16)) { | ||||
return; | return; | ||||
} | } | ||||
QString msg; | QString msg; | ||||
in >> msg; | in >> msg; | ||||
▲ Show 20 Lines • Show All 351 Lines • Show Last 20 Lines |