Skip to content

Commit

Permalink
Fix: remove spaces from reply to MXP version tag. (Mudlet#7144)
Browse files Browse the repository at this point in the history
<!-- Keep the title short & concise so anyone non-technical can
understand it,
     the title appears in PTB changelogs -->
#### Brief overview of PR changes/additions
Removes spaces from the version string returned by MXP to avoid parsing
issues in the mud. Also, like other MXP clients, mudlet will now report
the version nummer without prefixing the client name (which is reported
in a separate field).
#### Motivation for adding to Mudlet
Improve MXP compatibility
#### Other info (issues closed, discussion etc)
This is meant as a fix to issue Mudlet#7140 which popped up in recent PTB
versions when the format of the internal version string was changed.
  • Loading branch information
eowmob authored Sep 21, 2024
1 parent 2e795f8 commit 23c98fe
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/TMxpVersionTagHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,16 @@ TMxpTagHandlerResult TMxpVersionTagHandler::handleStartTag(TMxpContext& ctx, TMx
return MXP_TAG_HANDLED;
}

QString payload = scmVersionString.arg(version);
// version (aka client.getVersion()) starts with the client name 'mudlet' which
// is already in scmVersionString as the CLIENT attribute. We just need the version
// number here which follows after a space in version.
//
// As an attribute/version number with spaces probably should be quoted following
// MXP/XML syntax we just take everything after the last space to be on the safe side.

QString payload = scmVersionString.arg(version.section(' ', -1));

// Add the style, if it had been set
if (!client.getStyle().isNull()) {
payload.replace(qsl(">"), qsl(" STYLE=%1>").arg(client.getStyle()));
}
Expand Down

0 comments on commit 23c98fe

Please sign in to comment.