Bound local discovery traffic and validate invitations
This commit is contained in:
1 parent
80b23997c0
commit
4c62f45984
8 files changed
+383
-23
No files matched your search
@@ -449,10 +449,14 @@ void MainWindow::setupBridgeCallbacks() {
|
||||
QString name = QString::fromUtf8((const char*)data + 9, data[8]);
|
||||
QString link = QString::fromUtf8((const char*)data + 9 + data[8], len - 9 - data[8]);
|
||||
auto* window = s_mainWindow;
|
||||
if (window->findChildren<QMessageBox*>(QStringLiteral("localInvitePrompt")).size() >= 8) {
|
||||
DEBUG_WARN(DEBUG_CATEGORY_DISCOVERY, "incoming local invitation prompt limit reached"); return;
|
||||
}
|
||||
auto* prompt = new QMessageBox(QMessageBox::Question, QCoreApplication::translate("ChatGui", "Invitation"),
|
||||
QCoreApplication::translate("ChatGui", "%1 sent an invitation over the local network. Connect?").arg(name),
|
||||
QMessageBox::Yes | QMessageBox::No, window);
|
||||
prompt->setTextFormat(Qt::PlainText); prompt->setAttribute(Qt::WA_DeleteOnClose);
|
||||
prompt->setObjectName(QStringLiteral("localInvitePrompt"));
|
||||
QObject::connect(prompt, &QMessageBox::finished, window, [window, link](int result) {
|
||||
if (result == QMessageBox::Yes) window->onMessageLinkActivated(link);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user