# HG changeset patch # User Wuzzy # Date 1556226090 -7200 # Node ID b02581c5b0c5f11e3db27f0e4023b018e3c81eab # Parent e239378a94004b37b1cccefc6983533852ceff49# Parent bdb47255d7e4f6c487bd5413e90f08f3252de496 Merge diff -r e239378a9400 -r b02581c5b0c5 QTfrontend/hwform.cpp --- a/QTfrontend/hwform.cpp Thu Apr 25 23:01:05 2019 +0200 +++ b/QTfrontend/hwform.cpp Thu Apr 25 23:01:30 2019 +0200 @@ -1366,6 +1366,7 @@ GoToPage(ID_PAGE_CONNECTING); connect(hwnet, SIGNAL(AskForRunGame()), this, SLOT(CreateNetGame()), Qt::QueuedConnection); + connect(hwnet, SIGNAL(redirected(quint16)), this, SLOT(NetRedirected(quint16)), Qt::QueuedConnection); connect(hwnet, SIGNAL(connected()), this, SLOT(NetConnected()), Qt::QueuedConnection); connect(hwnet, SIGNAL(Error(const QString&)), this, SLOT(NetError(const QString&)), Qt::QueuedConnection); connect(hwnet, SIGNAL(Warning(const QString&)), this, SLOT(NetWarning(const QString&)), Qt::QueuedConnection); @@ -1715,6 +1716,23 @@ } } +void HWForm::NetRedirected(quint16 port) +{ + QMessageBox questionMsg(this); + questionMsg.setIcon(QMessageBox::Question); + questionMsg.setWindowTitle(QMessageBox::tr("Server redirection")); + questionMsg.setText(QMessageBox::tr("This server supports secure connections on port %1.\nWould you like to reconnect securely?").arg(port)); + questionMsg.setTextFormat(Qt::PlainText); + questionMsg.setWindowModality(Qt::WindowModal); + questionMsg.addButton(QMessageBox::Yes); + questionMsg.addButton(QMessageBox::No); + + if (questionMsg.exec() == QMessageBox::Yes) + { + + } +} + void HWForm::NetConnected() { GoToPage(ID_PAGE_ROOMSLIST); diff -r e239378a9400 -r b02581c5b0c5 QTfrontend/hwform.h --- a/QTfrontend/hwform.h Thu Apr 25 23:01:05 2019 +0200 +++ b/QTfrontend/hwform.h Thu Apr 25 23:01:30 2019 +0200 @@ -103,6 +103,7 @@ void NetConnectServer(const QString & host, quint16 port); void NetConnectOfficialServer(); void NetStartServer(); + void NetRedirected(quint16 port); void NetDisconnect(); void NetConnected(); void NetError(const QString & errmsg); diff -r e239378a9400 -r b02581c5b0c5 QTfrontend/net/newnetclient.cpp --- a/QTfrontend/net/newnetclient.cpp Thu Apr 25 23:01:05 2019 +0200 +++ b/QTfrontend/net/newnetclient.cpp Thu Apr 25 23:01:30 2019 +0200 @@ -296,6 +296,26 @@ return; } + if (lst[0] == "REDIRECT") + { + if (lst.size() < 2 || lst[1].toInt() == 0) + { + qWarning("Net: Malformed REDIRECT message"); + return; + } + + quint16 port = lst[1].toInt(); + if (port == 0) + { + qWarning() << "Invalid redirection port"; + } + else + { + emit redirected(port); + } + return; + } + if (lst[0] == "CONNECTED") { if(lst.size() < 3 || lst[2].toInt() < cMinServerVersion) diff -r e239378a9400 -r b02581c5b0c5 QTfrontend/net/newnetclient.h --- a/QTfrontend/net/newnetclient.h Thu Apr 25 23:01:05 2019 +0200 +++ b/QTfrontend/net/newnetclient.h Thu Apr 25 23:01:30 2019 +0200 @@ -98,6 +98,7 @@ void AskForRunGame(); void connected(); void disconnected(const QString & reason); + void redirected(quint16 port); void Error(const QString & errmsg); void Warning(const QString & wrnmsg); void NickRegistered(const QString & nick);