diff --git a/tools/chatgui/src/mainwindow.cpp b/tools/chatgui/src/mainwindow.cpp index 183037dd..292aa7c3 100644 --- a/tools/chatgui/src/mainwindow.cpp +++ b/tools/chatgui/src/mainwindow.cpp @@ -14,6 +14,7 @@ #include "dminvitedialog.h" #include "debug_ui.h" #include "inviteby.h" +#include #include "joindialog.h" #include "settingsdialog.h" #include "channelsettingsdialog.h" @@ -1156,6 +1157,19 @@ void MainWindow::onMessageLinkActivated(const QString& link) { "The core is not running.")); return; } const QString channelId = QString::number(invite.channelId); + if (invite.kind == INVITE_KIND_SERVER) { + QStringList ids, labels; + for (const auto& channel : m_db->getChannels()) { + if (!m_db->isChannelMember(channel.channelId, m_db->myNodeId())) continue; + ids.append(channel.channelId); labels.append(channel.name + " (" + channel.channelId + ")"); + } + bool accepted = false; + const QString selected = QInputDialog::getItem(this, QCoreApplication::translate("ChatGui", "Add server to channel"), + QCoreApplication::translate("ChatGui", "Channel:"), labels, qMax(0, ids.indexOf(m_currentChannelId)), false, &accepted); + int index = labels.indexOf(selected); + if (!accepted || index < 0) return; + InviteByLinkDialog dialog(ids[index], m_node, this, link); dialog.exec(); return; + } for (const auto& channel : m_db->getChannels()) { if (channel.channelId == channelId && m_db->isChannelMember(channelId, m_db->myNodeId())) { GUI_INFO("invite link: opening existing group ch=%s", qPrintable(channelId)); @@ -1322,6 +1336,9 @@ void MainWindow::showJoinDialog() { autoLink = selText; } + if (!autoLink.isEmpty() && decodeInviteLink(autoLink).kind == INVITE_KIND_SERVER) { + onMessageLinkActivated(autoLink); return; + } QPointer dialog = new JoinDialog(m_node, m_db, this, autoLink); auto release = qScopeGuard([&] { delete dialog.data(); }); dialog->exec(); } diff --git a/tools/chatgui/translations/chatgui_en.ts b/tools/chatgui/translations/chatgui_en.ts index 77268593..aa4d169c 100644 --- a/tools/chatgui/translations/chatgui_en.ts +++ b/tools/chatgui/translations/chatgui_en.ts @@ -3,6 +3,22 @@ ChatGui + + The server access key is invalid or has changed. + The server access key is invalid or has changed. + + + Select a channel and use Invite by link to add this server. + Select a channel and use Invite by link to add this server. + + + Add server to channel + Add server to channel + + + Channel: + Channel: + Could not complete the request.Could not complete the request. Invalid request or chat service unavailable.Invalid request or chat service unavailable. The request timed out.The request timed out. diff --git a/tools/chatgui/translations/chatgui_ru.ts b/tools/chatgui/translations/chatgui_ru.ts index c61a058b..02455435 100644 --- a/tools/chatgui/translations/chatgui_ru.ts +++ b/tools/chatgui/translations/chatgui_ru.ts @@ -3,6 +3,22 @@ ChatGui + + The server access key is invalid or has changed. + Ключ доступа к серверу неверен или был изменён. + + + Select a channel and use Invite by link to add this server. + Выберите канал и используйте «Пригласить по ссылке», чтобы добавить сервер. + + + Add server to channel + Добавить сервер в канал + + + Channel: + Канал: + Could not complete the request.Не удалось выполнить запрос. Invalid request or chat service unavailable.Некорректный запрос или сервис чата недоступен. The request timed out.Истекло время ожидания запроса.