From 97ac27cd540b952d1098fbc36edcb1ae5415cfec Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 22 Mar 2024 17:41:19 +0100 Subject: [PATCH 1/5] Infrastructure: Bump ZedThree/clang-tidy-review from 0.17.1 to 0.17.2 (#7192) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [ZedThree/clang-tidy-review](https://github.com/zedthree/clang-tidy-review) from 0.17.1 to 0.17.2.
Release notes

Sourced from ZedThree/clang-tidy-review's releases.

v0.17.2

What's Changed

Full Changelog: https://github.com/ZedThree/clang-tidy-review/compare/v0.17.1...v0.17.2

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=ZedThree/clang-tidy-review&package-manager=github_actions&previous-version=0.17.1&new-version=0.17.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/clangtidy-diff-analysis.yml | 4 ++-- .github/workflows/clangtidy-post-comments.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/clangtidy-diff-analysis.yml b/.github/workflows/clangtidy-diff-analysis.yml index 2ca9c68a124..e6d8a2d91aa 100644 --- a/.github/workflows/clangtidy-diff-analysis.yml +++ b/.github/workflows/clangtidy-diff-analysis.yml @@ -122,7 +122,7 @@ jobs: --target autogen - name: Check C++ changes against style guide - uses: ZedThree/clang-tidy-review@v0.17.1 + uses: ZedThree/clang-tidy-review@v0.17.2 id: static_analysis with: build_dir: 'b/ninja' # path is relative to checkout directory @@ -133,4 +133,4 @@ jobs: split_workflow: true - name: Upload check results - uses: ZedThree/clang-tidy-review/upload@v0.17.1 + uses: ZedThree/clang-tidy-review/upload@v0.17.2 diff --git a/.github/workflows/clangtidy-post-comments.yml b/.github/workflows/clangtidy-post-comments.yml index fc6a97070c4..545a9d97c7c 100644 --- a/.github/workflows/clangtidy-post-comments.yml +++ b/.github/workflows/clangtidy-post-comments.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: ZedThree/clang-tidy-review/post@v0.17.1 + - uses: ZedThree/clang-tidy-review/post@v0.17.2 with: # don't post any comments if the PR is fine lgtm_comment_body: '' From 1d50752b4bd76afdf7d077bcade33569270efbbc Mon Sep 17 00:00:00 2001 From: Zooka <136661366+ZookaOnGit@users.noreply.github.com> Date: Sat, 30 Mar 2024 00:07:50 +1000 Subject: [PATCH 2/5] Fix map.renameArea function calls. (#7174) Calling setAreaName() before the echo resulted in the wrong area name being sent to the user. Call setAreaName() after instead. #### Brief overview of PR changes/additions Using 'area rename' command would show `> area rename New Area Name` `(mapper): Renamed New Area Name to New Area Name (5).` now displays correctly `(mapper): Renamed Old Area Name to New Area Name (5).` #### Motivation for adding to Mudlet Improve user experience. #### Other info (issues closed, discussion etc) Fix will apply to IRE mapping script as well. --- src/mudlet-lua/lua/generic-mapper/generic_mapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mudlet-lua/lua/generic-mapper/generic_mapper.xml b/src/mudlet-lua/lua/generic-mapper/generic_mapper.xml index 6523d7b69bf..97d03a96b8f 100644 --- a/src/mudlet-lua/lua/generic-mapper/generic_mapper.xml +++ b/src/mudlet-lua/lua/generic-mapper/generic_mapper.xml @@ -5150,7 +5150,6 @@ function map.renameArea(name, exact) if not (map.currentroom or getRoomArea(map.currentRoom)) then map.echo("Don't know what area are we in at the moment, to rename it.") else - setAreaName(getRoomArea(map.currentRoom), name) map.echo( string.format( "Renamed %s to %s (%d).", @@ -5159,6 +5158,7 @@ function map.renameArea(name, exact) getRoomArea(map.currentRoom) ) ) + setAreaName(getRoomArea(map.currentRoom), name) centerview(map.currentRoom) end end From 598ec5a9209e77df3def0d22bac55efb4e374001 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 29 Mar 2024 17:17:35 +0000 Subject: [PATCH 3/5] Infrastructure: Bump ZedThree/clang-tidy-review from 0.17.2 to 0.18.0 (#7196) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [ZedThree/clang-tidy-review](https://github.com/zedthree/clang-tidy-review) from 0.17.2 to 0.18.0.
Release notes

Sourced from ZedThree/clang-tidy-review's releases.

v0.18.0

What's Changed

Full Changelog: https://github.com/ZedThree/clang-tidy-review/compare/v0.17.3...v0.18.0

v0.17.3

What's Changed

Full Changelog: https://github.com/ZedThree/clang-tidy-review/compare/v0.17.2...v0.17.3

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=ZedThree/clang-tidy-review&package-manager=github_actions&previous-version=0.17.2&new-version=0.18.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/clangtidy-diff-analysis.yml | 4 ++-- .github/workflows/clangtidy-post-comments.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/clangtidy-diff-analysis.yml b/.github/workflows/clangtidy-diff-analysis.yml index e6d8a2d91aa..186d8b49a65 100644 --- a/.github/workflows/clangtidy-diff-analysis.yml +++ b/.github/workflows/clangtidy-diff-analysis.yml @@ -122,7 +122,7 @@ jobs: --target autogen - name: Check C++ changes against style guide - uses: ZedThree/clang-tidy-review@v0.17.2 + uses: ZedThree/clang-tidy-review@v0.18.0 id: static_analysis with: build_dir: 'b/ninja' # path is relative to checkout directory @@ -133,4 +133,4 @@ jobs: split_workflow: true - name: Upload check results - uses: ZedThree/clang-tidy-review/upload@v0.17.2 + uses: ZedThree/clang-tidy-review/upload@v0.18.0 diff --git a/.github/workflows/clangtidy-post-comments.yml b/.github/workflows/clangtidy-post-comments.yml index 545a9d97c7c..a2f53dd8495 100644 --- a/.github/workflows/clangtidy-post-comments.yml +++ b/.github/workflows/clangtidy-post-comments.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: ZedThree/clang-tidy-review/post@v0.17.2 + - uses: ZedThree/clang-tidy-review/post@v0.18.0 with: # don't post any comments if the PR is fine lgtm_comment_body: '' From 0ac53a35c6c2f6604465bbfd2c7ed9950796015f Mon Sep 17 00:00:00 2001 From: Vadim Peretokin Date: Sun, 7 Apr 2024 16:11:27 +0200 Subject: [PATCH 4/5] Add: GMCP authenticate spec implementation (#7152) #### Brief overview of PR changes/additions Add the GMCP authenticate spec and client credentials: https://wiki.mudlet.org/w/Standards:GMCP_Authentication #### Motivation for adding to Mudlet To solve the issues we have in trying to login to games - not every game accepts "character\npassword" kind of login - while not getting into a security quagmire that comes with exposing passwords to the Lua subsystem. #### Other info (issues closed, discussion etc) --------- Co-authored-by: Vadim Peretokin Co-authored-by: Marco Fontani Co-authored-by: Stephen Lyons --- src/CMakeLists.txt | 47 +++++++------- src/GMCPAuthenticator.cpp | 129 ++++++++++++++++++++++++++++++++++++++ src/GMCPAuthenticator.h | 54 ++++++++++++++++ src/Host.cpp | 23 +++---- src/Host.h | 3 + src/ctelnet.cpp | 18 +++++- src/ctelnet.h | 3 + src/mudlet.pro | 2 + 8 files changed, 246 insertions(+), 33 deletions(-) create mode 100644 src/GMCPAuthenticator.cpp create mode 100644 src/GMCPAuthenticator.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c8dee0b2e0d..4b99993225f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -67,8 +67,8 @@ set(mudlet_SRCS dlgConnectionProfiles.cpp dlgIRC.cpp dlgKeysMainArea.cpp - dlgMapper.cpp dlgMapLabel.cpp + dlgMapper.cpp dlgModuleManager.cpp dlgNotepad.cpp dlgPackageExporter.cpp @@ -87,10 +87,10 @@ set(mudlet_SRCS dlgVarsMainArea.cpp EAction.cpp exitstreewidget.cpp - FontManager.cpp FileOpenHandler.cpp + FontManager.cpp GifTracker.cpp - TrailingWhitespaceMarker.cpp + GMCPAuthenticator.cpp Host.cpp HostManager.cpp ircmessageformatter.cpp @@ -100,8 +100,9 @@ set(mudlet_SRCS mapInfoContributorManager.cpp mudlet.cpp MudletInstanceCoordinator.cpp - ShortcutsManager.cpp + MxpTag.cpp ScriptUnit.cpp + ShortcutsManager.cpp T2DMap.cpp TAccessibleTextEdit.cpp TAction.cpp @@ -121,7 +122,6 @@ set(mudlet_SRCS TimerUnit.cpp TKey.cpp TLabel.cpp - TScrollBox.cpp TLinkStore.cpp TLuaInterpreter.cpp @@ -142,26 +142,30 @@ set(mudlet_SRCS TMxpBRTagHandler.cpp TMxpColorTagHandler.cpp TMxpCustomElementTagHandler.cpp + TMxpElementDefinitionHandler.cpp + TMxpElementRegistry.cpp TMxpEntityTagHandler.cpp TMxpFontTagHandler.cpp + TMxpFormattingTagsHandler.cpp TMxpLinkTagHandler.cpp + TMxpMudlet.cpp TMxpMusicTagHandler.cpp TMxpNodeBuilder.cpp - TMxpMudlet.cpp TMxpProcessor.cpp TMxpSendTagHandler.cpp TMxpSoundTagHandler.cpp TMxpSupportTagHandler.cpp - MxpTag.cpp TMxpTagHandler.cpp TMxpTagParser.cpp TMxpTagProcessor.cpp TMxpVarTagHandler.cpp TMxpVersionTagHandler.cpp + TrailingWhitespaceMarker.cpp TriggerUnit.cpp TRoom.cpp TRoomDB.cpp TScript.cpp + TScrollBox.cpp TSplitter.cpp TSplitterHandle.cpp TStringUtils.cpp @@ -218,9 +222,9 @@ set(mudlet_UIS set(mudlet_HDRS ActionUnit.h - Announcer.h AliasUnit.h AltFocusMenuBarDisable.h + Announcer.h ctelnet.h DarkTheme.h discord.h @@ -255,7 +259,7 @@ set(mudlet_HDRS FileOpenHandler.h FontManager.h GifTracker.h - TrailingWhitespaceMarker.h + GMCPAuthenticator.h Host.h HostManager.h ircmessageformatter.h @@ -264,10 +268,11 @@ set(mudlet_HDRS mapInfoContributorManager.h mudlet.h MudletInstanceCoordinator.h + MxpTag.h post_guard.h pre_guard.h - ShortcutsManager.h ScriptUnit.h + ShortcutsManager.h T2DMap.h TAccessibleConsole.h TAccessibleTextEdit.h @@ -286,12 +291,11 @@ set(mudlet_HDRS TEntityResolver.h testdbg.h TEvent.h - TForkedProcess.h TFlipButton.h + TForkedProcess.h TimerUnit.h TKey.h TLabel.h - TScrollBox.h TLinkStore.h TLuaInterpreter.h TMainConsole.h @@ -302,32 +306,33 @@ set(mudlet_HDRS TMxpBRTagHandler.h TMxpClient.h TMxpColorTagHandler.h + TMxpContext.h TMxpCustomElementTagHandler.h - TMxpEntityTagHandler.h - TMxpFontTagHandler.h - TMxpLinkTagHandler.h - TMxpMusicTagHandler.h - TMxpSoundTagHandler.h TMxpElementDefinitionHandler.h TMxpElementRegistry.h - TMxpContext.h + TMxpEntityTagHandler.h + TMxpFontTagHandler.h TMxpFormattingTagsHandler.h + TMxpLinkTagHandler.h TMxpMudlet.h + TMxpMusicTagHandler.h TMxpNodeBuilder.h TMxpProcessor.h TMxpSendTagHandler.h - MxpTag.h + TMxpSoundTagHandler.h + TMxpSupportTagHandler.cpp TMxpTagHandler.h TMxpTagParser.h TMxpTagProcessor.h - TMxpSupportTagHandler.cpp TMxpVarTagHandler.h TMxpVersionTagHandler.h + TrailingWhitespaceMarker.h Tree.h TriggerUnit.h TRoom.h TRoomDB.h TScript.h + TScrollBox.h TSplitter.h TSplitterHandle.h TStringUtils.h @@ -339,8 +344,8 @@ set(mudlet_HDRS TTreeWidget.h TTrigger.h TVar.h - VarUnit.h utils.h + VarUnit.h widechar_width.h XMLexport.h XMLimport.h) diff --git a/src/GMCPAuthenticator.cpp b/src/GMCPAuthenticator.cpp new file mode 100644 index 00000000000..6e2f7d3da1c --- /dev/null +++ b/src/GMCPAuthenticator.cpp @@ -0,0 +1,129 @@ +/*************************************************************************** + * Copyright (C) 2024 by Vadim Peretokin - vperetokin@gmail.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "GMCPAuthenticator.h" + +#include "Host.h" +#include "ctelnet.h" +#include + +GMCPAuthenticator::GMCPAuthenticator(Host* pHost) +: mpHost(pHost) +{} + +void GMCPAuthenticator::saveSupportsSet(const QString& data) +{ + auto jsonDoc = QJsonDocument::fromJson(data.toUtf8()); + auto jsonObj = jsonDoc.object(); + + if (jsonObj.contains("type")) { + QJsonArray typesArray = jsonObj["type"].toArray(); + for (const auto& type : typesArray) { + mSupportedAuthTypes.append(type.toString()); + } + } + +#if defined(DEBUG_GMCP_AUTHENTICATION) + qDebug() << "Supported auth types:" << mSupportedAuthTypes; +#endif +} + +void GMCPAuthenticator::sendCredentials() +{ + auto character = mpHost->getLogin(); + auto password = mpHost->getPass(); + QJsonObject credentials; + if (!character.isEmpty() && !password.isEmpty()) { + credentials["account"] = character; + credentials["password"] = password; + } + QJsonDocument doc(credentials); + QString gmcpMessage = doc.toJson(QJsonDocument::Compact); + + std::string output; + output += TN_IAC; + output += TN_SB; + output += OPT_GMCP; + output += "Char.Login.Credentials "; + output += mpHost->mTelnet.encodeAndCookBytes(gmcpMessage.toStdString()); + output += TN_IAC; + output += TN_SE; + + // Send credentials to server + mpHost->mTelnet.socketOutRaw(output); +#if defined(DEBUG_GMCP_AUTHENTICATION) + qDebug() << "Sent GMCP credentials"; +#endif +} + + +void GMCPAuthenticator::handleAuthResult(const QString& data) +{ + auto doc = QJsonDocument::fromJson(data.toUtf8()); + auto obj = doc.object(); + + // some game drivers can parse JSON for true or false, but may not be able to write booleans back + auto result = obj[qsl("success")]; + bool success = (result.isBool() && result.toBool()) || (result.isString() && result.toString() == "true"); + auto message = obj[qsl("message")].toString(); + + if (success) { +#if defined(DEBUG_GMCP_AUTHENTICATION) + qDebug() << "GMCP login successful"; +#endif + } else { +#if defined(DEBUG_GMCP_AUTHENTICATION) + qDebug() << "GMCP login failed:" << message; +#endif + mpHost->mTelnet.setDontReconnect(true); + if (message.isEmpty()) { + mpHost->postMessage(tr("[ WARN ] - Could not log in to the game, is the login information correct?")); + } else { + mpHost->postMessage(tr("[ WARN ] - Could not log in to the game: %1").arg(message)); + } + + } +} + +// controller for GMCP authentication +void GMCPAuthenticator::handleAuthGMCP(const QString& packageMessage, const QString& data) +{ + if (packageMessage == qsl("Char.Login.Default")) { + saveSupportsSet(data); + + if (mSupportedAuthTypes.contains(qsl("password-credentials"))) { + mpHost->mTelnet.cancelLoginTimers(); + sendCredentials(); + } else { +#if defined(DEBUG_GMCP_AUTHENTICATION) + qDebug() << "Server does not support credentials authentication and we don't support any other"; +#endif + } + return; + } + + if (packageMessage == qsl("Char.Login.Result")) { + handleAuthResult(data); + return; + } + +#if defined(DEBUG_GMCP_AUTHENTICATION) + qDebug() << "Unknown GMCP auth package:" << packageMessage; +#endif +} diff --git a/src/GMCPAuthenticator.h b/src/GMCPAuthenticator.h new file mode 100644 index 00000000000..65e87398d2b --- /dev/null +++ b/src/GMCPAuthenticator.h @@ -0,0 +1,54 @@ +#ifndef MUDLET_AUTHENTICATOR_H +#define MUDLET_AUTHENTICATOR_H + +/*************************************************************************** + * Copyright (C) 2024 by Vadim Peretokin - vperetokin@gmail.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "Host.h" +#include "utils.h" + +#include "pre_guard.h" +#include +#include +#include +#include +#include +#include "post_guard.h" + + +class GMCPAuthenticator +{ + Q_DECLARE_TR_FUNCTIONS(GMCPAuthenticator) + +public: + + explicit GMCPAuthenticator(Host* pHost); + ~GMCPAuthenticator() = default; + + void saveSupportsSet(const QString& data); + void sendCredentials(); + void handleAuthResult(const QString& data); + void handleAuthGMCP(const QString& packageMessage, const QString& data); + +private: + Host* mpHost; + QStringList mSupportedAuthTypes; +}; + +#endif // MUDLET_AUTHENTICATOR_H diff --git a/src/Host.cpp b/src/Host.cpp index 7790fdafe38..1c8a1ea1275 100644 --- a/src/Host.cpp +++ b/src/Host.cpp @@ -25,16 +25,24 @@ #include "Host.h" - +#include "dlgIRC.h" +#include "dlgMapper.h" +#include "dlgModuleManager.h" +#include "dlgNotepad.h" +#include "dlgPackageManager.h" +#include "dlgProfilePreferences.h" +#include "GifTracker.h" +#include "GMCPAuthenticator.h" #include "LuaInterface.h" +#include "mudlet.h" +#include "TCommandLine.h" #include "TConsole.h" #include "TDebug.h" -#include "TMainConsole.h" -#include "TCommandLine.h" #include "TDebug.h" #include "TDockWidget.h" #include "TEvent.h" #include "TLabel.h" +#include "TMainConsole.h" #include "TMap.h" #include "TMedia.h" #include "TRoomDB.h" @@ -42,15 +50,7 @@ #include "TTextEdit.h" #include "TToolBar.h" #include "VarUnit.h" -#include "GifTracker.h" #include "XMLimport.h" -#include "dlgMapper.h" -#include "dlgModuleManager.h" -#include "dlgNotepad.h" -#include "dlgPackageManager.h" -#include "dlgProfilePreferences.h" -#include "dlgIRC.h" -#include "mudlet.h" #include "pre_guard.h" #include @@ -242,6 +242,7 @@ Host::Host(int port, const QString& hostname, const QString& login, const QStrin , mpEditorDialog(nullptr) , mpMap(new TMap(this, hostname)) , mpMedia(new TMedia(this, hostname)) +, mpAuth(new GMCPAuthenticator(this)) , mpNotePad(nullptr) , mPrintCommand(true) , mIsRemoteEchoingActive(false) diff --git a/src/Host.h b/src/Host.h index ed68a20ffc5..cd909cea9a4 100644 --- a/src/Host.h +++ b/src/Host.h @@ -63,6 +63,7 @@ class TEvent; class TArea; class LuaInterface; class TMedia; +class GMCPAuthenticator; class TRoom; class TConsole; class TMainConsole; @@ -72,6 +73,7 @@ class dlgIRC; class dlgPackageManager; class dlgModuleManager; class dlgProfilePreferences; +class cTelnet; class stopWatch { friend class XMLimport; @@ -484,6 +486,7 @@ class Host : public QObject dlgTriggerEditor* mpEditorDialog; QScopedPointer mpMap; QScopedPointer mpMedia; + QScopedPointer mpAuth; dlgNotepad* mpNotePad; // This is set when we want commands we typed to be shown on the main diff --git a/src/ctelnet.cpp b/src/ctelnet.cpp index 129cd3472a6..d785d0e6c8f 100644 --- a/src/ctelnet.cpp +++ b/src/ctelnet.cpp @@ -37,6 +37,7 @@ #include "TMainConsole.h" #include "TMap.h" #include "TMedia.h" +#include "GMCPAuthenticator.h" #include "TTextCodec.h" #include "dlgComposer.h" #include "dlgMapper.h" @@ -185,6 +186,17 @@ cTelnet::~cTelnet() socket.deleteLater(); } +void cTelnet::cancelLoginTimers() +{ + if (mTimerLogin) { + mTimerLogin->stop(); + } + + if (mTimerPass) { + mTimerPass->stop(); + } +} + // This configures two out of three of the QTextCodec used by this profile: // 1) A single or multi-byte encoder for all outgoing data // 2) A single or multi-byte encoder for incoming OutOfBand data @@ -1774,7 +1786,7 @@ void cTelnet::processTelnetCommand(const std::string& telnetCommand) output = TN_IAC; output += TN_SB; output += OPT_GMCP; - output += R"(Core.Supports.Set [ "Char 1", "Char.Skills 1", "Char.Items 1", "Room 1", "IRE.Rift 1", "IRE.Composer 1", "External.Discord 1", "Client.Media 1"])"; + output += R"(Core.Supports.Set [ "Char 1", "Char.Skills 1", "Char.Items 1", "Room 1", "IRE.Rift 1", "IRE.Composer 1", "External.Discord 1", "Client.Media 1", "Char.Login 1"])"; output += TN_IAC; output += TN_SE; socketOutRaw(output); @@ -2829,6 +2841,10 @@ void cTelnet::setGMCPVariables(const QByteArray& msg) mpHost->mpMedia->parseGMCP(packageMessage, data); } + if (packageMessage.startsWith(qsl("Char.Login"), Qt::CaseInsensitive)) { + mpHost->mpAuth->handleAuthGMCP(packageMessage, data); + } + mpHost->mLuaInterpreter.setGMCPTable(packageMessage, data); } diff --git a/src/ctelnet.h b/src/ctelnet.h index 69d22456668..399f48a151d 100644 --- a/src/ctelnet.h +++ b/src/ctelnet.h @@ -194,6 +194,7 @@ class cTelnet : public QObject void setAutoReconnect(bool status); void encodingChanged(const QByteArray&); void set_USE_IRE_DRIVER_BUGFIX(bool b) { mUSE_IRE_DRIVER_BUGFIX = b; } + void setDontReconnect(bool b) { mDontReconnect = b; } void recordReplay(); bool loadReplay(const QString&, QString* pErrMsg = nullptr); void loadReplayChunk(); @@ -227,6 +228,7 @@ class cTelnet : public QObject void setPostingTimeout(const int); int getPostingTimeout() const { return mTimeOut; } void loopbackTest(QByteArray& data) { processSocketData(data.data(), data.size(), true); } + void cancelLoginTimers(); QMap supportedTelnetOptions; @@ -275,6 +277,7 @@ public slots: void initStreamDecompressor(); int decompressBuffer(char*& in_buffer, int& length, char* out_buffer); void reset(); + void sendLoginAndPass(); QByteArray prepareNewEnvironData(const QString&); QString getNewEnvironValueUser(); diff --git a/src/mudlet.pro b/src/mudlet.pro index 25de9c05ff3..86c51cb1c23 100644 --- a/src/mudlet.pro +++ b/src/mudlet.pro @@ -623,6 +623,7 @@ SOURCES += \ FontManager.cpp \ FileOpenHandler.cpp \ GifTracker.cpp \ + GMCPAuthenticator.cpp \ TrailingWhitespaceMarker.cpp \ Host.cpp \ HostManager.cpp \ @@ -749,6 +750,7 @@ HEADERS += \ exitstreewidget.h \ FileOpenHandler.h \ GifTracker.h \ + GMCPAuthenticator.h \ TrailingWhitespaceMarker.h \ Host.h \ HostManager.h \ From 9b362cff2567921dee16e67d0183553fa4a98d85 Mon Sep 17 00:00:00 2001 From: Tim Johnson <29287358+atari2600tim@users.noreply.github.com> Date: Fri, 12 Apr 2024 12:25:45 -0400 Subject: [PATCH 5/5] Infra: update mirror URL for file hosted by osdn (#7200) #### Brief overview of PR changes/additions Change the URL of file mentioned at https://osdn.net/projects/mingw/downloads/68260/mingw-get-0.6.3-mingw32-pre-20170905-1-bin.zip/ #### Motivation for adding to Mudlet Builds were failing, but not every time, like https://ci.appveyor.com/project/Mudlet/mudlet/builds/49542655 Last lines were ``` ==== compiling and installing mingw-get ==== ---- Downloading ---- Exception calling "DownloadFile" with "2" argument(s): "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel." ``` I looked in the script files and found URL associated with mingw-get and downloaded it myself a few times. It uses a 302 Location redirect going to 2 different URLs, sometimes working and others with an expired certificate. Then I found the link above which is similar URL but different `m=`. Looks like `m` is for mirror, and the old one is name of a German university that maybe is no longer mirroring for them or something. #### Other info (issues closed, discussion etc) Discussion started with https://discord.com/channels/283581582550237184/283582439002210305/1225440152621551698 --- .github/CONTRIBUTING.md | 2 +- CI/appveyor.functions.ps1 | 2 +- src/discord.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 6ec38a6a0c6..56a81a502b9 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -31,7 +31,7 @@ Don't: * translate the Mudlet API: functions, events, error messages or constants (e.g. `main` console) * use numbers in the API - English words are preferred instead * try to assemble a sentence on the fly - English grammar does not translate into other languages. Present the full sentence to translators instead -* assume English-centric plural forms, other languages do not necessarily have the simple add an "s"/"es" for more/less then the singular case. +* assume English-centric plural forms, other languages do not necessarily have the simple add an "s"/"es" for more/less than the singular case. * assume universal quote and number punctuation formats. There are languages that use « and » instead of " for "quoting" words or phrases. Qt can provide Locale specific displays of numbers/dates/times. # Tooltip tips: diff --git a/CI/appveyor.functions.ps1 b/CI/appveyor.functions.ps1 index ca5dedf74fd..e19caba4444 100644 --- a/CI/appveyor.functions.ps1 +++ b/CI/appveyor.functions.ps1 @@ -196,7 +196,7 @@ function InstallCmake() { } function InstallMingwGet() { - DownloadFile "https://osdn.net/frs/redir.php?m=rwthaachen&f=mingw%2F68260%2Fmingw-get-0.6.3-mingw32-pre-20170905-1-bin.zip" "mingw-get.zip" + DownloadFile "https://osdn.net/frs/redir.php?m=ipconnect&f=mingw%2F68260%2Fmingw-get-0.6.3-mingw32-pre-20170905-1-bin.zip" "mingw-get.zip" if (!(Test-Path -Path "C:\MinGW" -PathType Container)) { Step "Creating MinGW path" New-Item -Path "C:\MinGW" -ItemType "directory" >> "$logFile" 2>&1 diff --git a/src/discord.cpp b/src/discord.cpp index 22a5e25bb75..db99e37d863 100644 --- a/src/discord.cpp +++ b/src/discord.cpp @@ -535,7 +535,7 @@ QString Discord::deduceGameName(const QString& address) } // Returns true in First if this is a MUD we know about (and have an Icon for in -// on the Mudlet Discord erver!) and the deduced name in Second - if the +// on the Mudlet Discord server!) and the deduced name in Second - if the // first is true. QPair Discord::gameIntegrationSupported(const QString& address) {