Skip to content

Add: GMCP authenticate spec implementation#7152

Merged
vadi2 merged 37 commits intoMudlet:developmentfrom
vadi2:add-gmcp-authenticate
Apr 7, 2024
Merged

Add: GMCP authenticate spec implementation#7152
vadi2 merged 37 commits intoMudlet:developmentfrom
vadi2:add-gmcp-authenticate

Conversation

@vadi2
Copy link
Copy Markdown
Member

@vadi2 vadi2 commented Feb 17, 2024

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)

@vadi2 vadi2 requested a review from a team February 17, 2024 11:07
@vadi2 vadi2 requested a review from a team as a code owner February 17, 2024 11:07
@vadi2 vadi2 requested a review from a team February 17, 2024 11:07
@add-deployment-links
Copy link
Copy Markdown

add-deployment-links bot commented Feb 17, 2024

Hey there! Thanks for helping Mudlet improve. 🌟

Test versions

You can directly test the changes here:

No need to install anything - just unzip and run.
Let us know if it works well, and if it doesn't, please give details.

@vadi2 vadi2 changed the title Add: GMCP authenticate spec Add: GMCP authenticate spec implementation Feb 17, 2024
@mpconley
Copy link
Copy Markdown
Contributor

Please update this so it will produce a fresh Mac build, thanks!

@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented Feb 25, 2024

/refresh links

@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented Feb 25, 2024

@mpconley there you go.

@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented Mar 1, 2024

It's updated, could you force reload the page? Mediawiki caching is a bit weird.

I used Mermaid to put it together - see https://mermaid.live. Always been a plantuml fan, it's Java rendering engine doesn't make it suited for the web - and that's where mermaid steps in. Even GitHub can render mermaid diagrams native in markdown files.

Copy link
Copy Markdown
Member

@demonnic demonnic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing in the code stands out as a bad idea, though you may want to wait for at least one review from a more practiced C++ coder than myself. Mudlet's and my own tests pass though so I'm giving it my thumbs up. 👍🏻

Copy link
Copy Markdown
Member

@SlySven SlySven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've only looked through the code on a C++ basis - whether it works or not is not something I can judge. I am not offering anything in regards to UI or Infrastructure "approval"...

* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/

#pragma once
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That may be the way of things nowadays but since we have not adopted it elsewhere, why not stick with the existing include-guards methodology?

#include "post_guard.h"


class GMCPAuthenticator : public QObject
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Is this class doing anything that requires it to be derived from the QObject class?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, tr()

Copy link
Copy Markdown
Member

@SlySven SlySven Mar 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, in that case you should use Q_DECLARE_TR_FUNCTIONS(GMCPAuthenticator) (see Q_DECLARE_TR_FUNCTIONS) at the top of the class declaration in the header file instead of the Q_OBJECT macro. For example - as used in the TRoom class.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? this setup works.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternative I gave is a "lighter-weight" one - which we(I) have used elsewhere in the project.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is premature optimisation for a class that's instantiated one per host... https://users.ece.utexas.edu/~adnan/pike.html. I don't think this is something we should be spending energy on.

src/Host.cpp Outdated
#include "TLabel.h"
#include "TMap.h"
#include "TMedia.h"
#include "GMCPAuthenticator.h"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorted into the right place? Maybe not!

vadi2 and others added 3 commits March 25, 2024 21:34
Co-authored-by: Stephen Lyons <slysven@virginmedia.com>
Co-authored-by: Stephen Lyons <slysven@virginmedia.com>
@RahjIII
Copy link
Copy Markdown

RahjIII commented Mar 27, 2024

Mudlet 4.17.2-testing-pr7152-476efbbc seems to be working out just fine with GMCP Authentication. Its the fastest I've ever seen Mudlet log into anything. Very nice work! However...

I had originally set my game server to send a Char.Login.Result { "success": false, "message": "Bad GMCP Login Credentials." } message, and then "hang up" the connection, in the event of a good account name and bad password combination.

I had the "automatically reconnect" flag set in the profile... and Mudlet proceeded to repeatedly and rapidly reconnect and fail over and over again, at a rate of about seven attempts per second.

I think it would be a very good idea to have Mudlet break the "automatically reconnect" loop upon receipt of a Char.Login.Result failure message.

@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented Mar 29, 2024

We will consider such speed in Mudlets behalf to be good :)

I have adjusted it not to reconnect upon authentication failure.

@mfontani
Copy link
Copy Markdown
Contributor

We will consider such speed in Mudlets behalf to be good :)

Indeed!

I had the same problem, and had about 8.4 reconnections/s (on localhost) on password failure without this patch... but to test it I had to explicity tick the reconnection tickbox, which doesn't seem to be the default - phew!

I have adjusted it not to reconnect upon authentication failure.

Sounds very good, thanks!

FontManager.cpp
GifTracker.cpp
TrailingWhitespaceMarker.cpp
GMCPAuthenticator.cpp
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we doing away with the convention of putting a 'T' in front of our classes? Does it have a meaning?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the meaning I am not sure but the T prefix could stand for a "template" (but not a C++ template) for a class that isn't associated with a dialogue (those begin with dlg instead!) Incidentally when describing a container or method for an arbitrary class T on it's own is often used as the identifier of the class. E.g. (bool) QListIterator<T>::hasNext() to test to see whether an iterator into a QList<T> has a value it can get. So maybe appending things to that seemed logical, QListIterator<TMapLabel>::hasNext() when iterating though a QList<TMapLabel>?

Copy link
Copy Markdown
Member Author

@vadi2 vadi2 Apr 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a reason continue tbh. I don't see a meaning behind it other than a Template which we don't use often.

Copy link
Copy Markdown
Member

@SlySven SlySven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well the changes I've suggested have pretty much been applied - apart from the one about the (better IMHO) alternative to the QOBJECT macro... once that has been done I am happy to approve it from a C++ POV. @demonnic seems to be happy with it. I dunno whether @Kebap has anything to say but I think this is getting close to being ready to :shipit: ...

@mpconley
Copy link
Copy Markdown
Contributor

mpconley commented Apr 6, 2024

Thank you for the workaround for the booleans. This is working out as expected now.

@mpconley
Copy link
Copy Markdown
Contributor

mpconley commented Apr 7, 2024

Good to merge now? Let's do this? :)

-Tamarindo

@vadi2 vadi2 merged commit 0ac53a3 into Mudlet:development Apr 7, 2024
@vadi2 vadi2 deleted the add-gmcp-authenticate branch April 7, 2024 14:11
@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented Apr 7, 2024

Done ✅

SlySven added a commit to SlySven/Mudlet that referenced this pull request Sep 12, 2024
Extended the functions disabled by the login timeout to include the
`sendCharacterName()` function - and allow the timer that provides that
timeout to be stopped by the GMCP authenticator that Mudlet#7152 introduced. Such
a stop also immediately disables those functions so that it will neutralise
any scripts or triggers that would be using them.

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants