Commit graph

5 commits

Author SHA1 Message Date
Mike Conley
d0250979ce
Fix: MXP EXPIRE tag support and custom element attribute handling (#8431)
#### Brief overview of PR changes/additions

* **Add MXP EXPIRE tag support**: Implements the EXPIRE attribute for
MXP SEND tags, allowing servers to expire groups of links by name
* **Tooltip fix**: Fixed MXP link tooltips displaying "HREF" instead of
the actual link command when the EXPIRE attribute appears before the
HREF attribute in SEND tags
* **Custom element fix**: Fixed custom MXP elements to properly pass
through ALL attributes (EXPIRE, HREF, HINT, etc.) to their expanded tag
definitions

#### Motivation for adding to Mudlet

**EXPIRE tag support**: The MXP specification defines an EXPIRE
attribute that allows servers to tag groups of links and expire them all
at once (e.g., `<EXPIRE Exits>` expires all links tagged with
`EXPIRE="Exits"`). This is essential for dynamic content like room exits
that change as players move around.

**Tooltip fix**: Addresses reviewer feedback in PR #8383. When games
send MXP links like `<SEND EXPIRE="Exits" HREF="east">East</SEND>`, the
tooltip was incorrectly showing the literal text "HREF" instead of
"east" (the command that would be executed), making links confusing for
users.

**Custom element fix**: When servers define custom elements like
`<!ELEMENT Ex '<SEND>'>` and use them with attributes like `<Ex
EXPIRE="Exits" HREF="north">North</Ex>`, those attributes weren't being
passed through to the expanded SEND tag. This made custom elements less
functional than regular tags. Now all attributes are properly inherited.

#### Other info (issues closed, discussion etc)

- Related to PR #8383 (initial EXPIRE tag implementation discussion)
- Addresses @mfontani's comment about custom elements not passing
through EXPIRE attributes
- Added comprehensive unit tests:
  - Tooltip attribute ordering tests in `TMxpSendTagHandlerTest`
- Custom element attribute pass-through test in
`TMxpCustomElementTagHandlerTest`
- All existing MXP tests continue to pass (100% success rate)
- Changes summary: 5 files changed, 101 insertions(+), 2 deletions(-)
2025-10-26 20:48:42 +01:00
Stephen Lyons
ee1cc2e373
Infrastructure: purge trailing whitespace (#7949)
#### Brief overview of PR changes/additions
Use a ` +$` search-and-replace to remove trailing spaces in `.cpp` and
`.h` source code files to remove unwanted trailing whitespace that has
crept into a number of files.

#### Motivation for adding to Mudlet
To clean up files as `git` notices such white-space and objects in some
circumstances - and such spaces are redundant in the source code.

#### Other info (issues closed, discussion etc)

Signed-off-by: Stephen Lyons <slysven@virginmedia.com>
2025-07-13 14:29:14 +01:00
eowmob
beb6d70324
Fix: Tooltip hints for MXP hints no longer forced to uppercase (#6878)
<!-- Keep the title short & concise so anyone non-technical can
understand it,
     the title appears in PTB changelogs -->
#### Brief overview of PR changes/additions
In some, but not all, occasions the tooltip hints of MXP hints were
forced to all upper case by Mudlet
#### Motivation for adding to Mudlet
Improvement of MXP compatibility, more uniform menu appearance.
#### Other info (issues closed, discussion etc)
Mudlet forced HINT attributes used in custom elements to upper case, but
only there. Note that entities were interpolated afterwards, hence not
forced to uppercase. I think the behaviour is inconsistent and not
'logically' comprehensible for a user.
Afaik, if the mud specifies a HINT text it should be display as such. If
the game wants it to show up in UPPERCASE the game should just say so.
**However,** in difference to my other MXP patches, it will change the
look of the GUI for games that somehow depend on it.
So.. it can be argued.

It does change the non uniform display of hints like those two from the
unfixed version:

![send_b4](https://github.com/Mudlet/Mudlet/assets/72653851/71507e6e-6ae7-437b-87bc-d0ddbaf00eea)
and

![sendprompt_b4](https://github.com/Mudlet/Mudlet/assets/72653851/1dfd75be-9ba8-4dac-83d6-0883cb3c8bf5)
to 

![send_after](https://github.com/Mudlet/Mudlet/assets/72653851/2fc2e4f3-c21c-411a-bc92-d6325077fccb)

![sendprompt_after](https://github.com/Mudlet/Mudlet/assets/72653851/fb2e5c0b-8574-4a72-8366-f733a6bd8bd0)

Also, it used to deal with HINTs only prior to entity resolution, so
without the fix it looked like

![mixedmenu_b4](https://github.com/Mudlet/Mudlet/assets/72653851/3f824de0-7245-4ead-8b4f-f25c561d603e)
rather than 

![mixedmenu_after](https://github.com/Mudlet/Mudlet/assets/72653851/97e23ee2-6c50-4c49-9be7-561402ef1573)

And the only difference between these two menus (both from the unfixed
version)

![send_plain](https://github.com/Mudlet/Mudlet/assets/72653851/5acf8ea3-6134-4b4d-93b1-6ac6ded77944)

![send_custom_element](https://github.com/Mudlet/Mudlet/assets/72653851/cfb47c73-0118-4f7d-acf8-cef2f43bc896)
is that the first uses a plain `<send>` while the second uses a custom
element.

Again, you can see this in action by connecting to aldebaran-mud.de 2000
, login as guest (y to confirm) and with 'set mxp test 4'.
2023-06-11 16:45:58 +02:00
eowmob
8a82cf2666
Improvement: MXP text effects: bold, underline, italics, strikethrough (#6802)
<!-- Keep the title short & concise so anyone non-technical can
understand it,
     the title appears in PTB changelogs -->
#### Brief overview of PR changes/additions
MXP text effects (incl. all aliases) are now rendered.
Colour and text effects in open mode auto-close at end of line 
#### Motivation for adding to Mudlet
Improve MXP compliance
#### Other info (issues closed, discussion etc)
[MXP enhancements, was PR
#4200](https://forums.mudlet.org/viewtopic.php?f=7&t=23206)
2023-05-31 19:44:48 +02:00
eowmob
f0c6968230
Improvement: Custom MXP elements now support default values for arguments (#6853)
<!-- Keep the title short & concise so anyone non-technical can
understand it,
     the title appears in PTB changelogs -->
#### Brief overview of PR changes/additions
Custom Element Definition and Handler are changed to handle default
values by ATT="EntityName=DefaultValue" as specified in the MXP protocol
definition.
#### Motivation for adding to Mudlet
Improve MXP compliance.
#### Other info (issues closed, discussion etc)
To see this issue (in addition to reviewing the test code coming with
this PR):

connect to aldebaran-mud.de port 2000
login as guest
y     (confirm you want to login as a guest)

Now do:
who

Notice the mouse-over hint on your (or another players) name in the who
output.

Right click and try some commands. Admittedly guest has no finger info,
and the game does not allow you to tell to yourself (and you have to
wait for a few minutes for your mana to build up for tell), so you can't
really do much.

Alternatively, you can just login with another guest character (but
mudlet needs a second game profile for this) and "look". The issue is
the same with the short description of the other guest character. But
here you can also select "whisper" from the menu, which will work
nicely.

BTW, all commands are just copied in the input line, even for "finger
guest" you have to hit enter. This is by design / limitation of the MXP
SEND command (you cannot choose 'PROMPT' per menu entry, only globally).

With the current mudlet version this does not work. This is due to the
definition:
&lt;!EL PL '&lt;SEND "tell &amp;NAME; |finger &amp;NAME; " HINT="tell
&amp;NAME;|finger &amp;NAME;" PROMPT>' ATT='NAME=someone'>

Mudlet misinterpretes 'NAME=someone' as the whole name of the entity,
not just NAME.

The effect of the default value 'someone' is not easy to demonstrate,
except when you can find an invisible wizard and convince him to to
interact with you. However, you can do:

say ^&lt;PL player_id>Test1&lt;/PL>

and

say ^&lt;PL>Test2&lt;/PL>

and see/use the menus created by/in Mudlet for the echo of Test1 and
Test2. You'll see how it refers to player_id or someone.

Note that Mudlet should actually not evaluate the PL tag in the say
command, as it is a secure MXP tag and the session is in open mode at
this time. However, Mudlet does not honor this security measure as of
now, which is another, unrelated, issue.
2023-05-30 19:16:10 +02:00