Thanks to visit codestin.com
Credit goes to github.com

Skip to content

add get/setProfileInformation() to modify profile information field#7511

Merged
vadi2 merged 3 commits intoMudlet:developmentfrom
ZookaOnGit:profile-notes-5333
Nov 3, 2024
Merged

add get/setProfileInformation() to modify profile information field#7511
vadi2 merged 3 commits intoMudlet:developmentfrom
ZookaOnGit:profile-notes-5333

Conversation

@ZookaOnGit
Copy link
Contributor

Brief overview of PR changes/additions

  1. Add getProfileInformation() and setProfileInformation(string) functions to Lua to read/write to the profile information displayed on the profile connection window.
  2. Changed profile connection window text from "Informational" to "Information" to match functions and read clearer.
  3. Fix bug where one could not modify default games information text. Now load user information first if present, fallback to default. Clearing user set information (ie. setProfileInformation("")) also reverts to default game information.

Motivation for adding to Mudlet

Gives the ability to add profile specific information via the Lua API which can then be seen on the profile connection window.

Other info (issues closed, discussion etc)

closes #5333

@ZookaOnGit ZookaOnGit requested a review from a team as a code owner October 31, 2024 00:15
@add-deployment-links
Copy link

add-deployment-links bot commented Oct 31, 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
Copy link
Member

vadi2 commented Oct 31, 2024

Great PR 👍

int TLuaInterpreter::setProfileInformation(lua_State* L)
{
Host& host = getHostFromLua(L);
const QString text = getVerifiedString(L, __func__, 1, "text");
Copy link
Member

Choose a reason for hiding this comment

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

💡 Might it be worth also accepting a nilas the argument - so that calling setProfileInformation() without ANY argument also does the clearing operation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added, also added that it revert to the default text immediately if nil or empty string supplied

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, missed this initially - but in Mudlet API design we use a 'clear*' function whenever we need to clear something instead of setting something to "" or nil. Or try to, anyway:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, I can add that
but setProfileInformation should only accept a string then and not the nil, correct?

Copy link
Member

Choose a reason for hiding this comment

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

Right

Copy link
Member

@SlySven SlySven Nov 2, 2024

Choose a reason for hiding this comment

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

ℹ️ There are 12 clear...(...) functions AND 8 reset...(...) ones but it is not so easy to determine how many of the 103 set...(...) functions might have a clear/reset functionality...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

implemented clearProfileInformation() function
setProfileInformation() now only accepts a string, return nil and error message if string is empty
updated Area 51

@vadi2 vadi2 merged commit 9eefc0a into Mudlet:development Nov 3, 2024
@ZookaOnGit ZookaOnGit deleted the profile-notes-5333 branch November 3, 2024 16:42
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.

A way to populate the profile informational properties programatically

3 participants