MXP Self-Healing Recovery Mechanism

Summary

This PR implements an automatic detection and recovery system for malformed MXP (Mud eXtension Protocol) parsing issues that cause screen output to freeze, addressing GitHub issue #7896.

Problem

MUDs often send improperly formatted MXP tags with unescaped characters (<, >, &) that cause Mudlet’s MXP parser to get stuck in infinite loops, freezing screen output. This particularly affects new players connecting to MUDs with problematic MXP implementations.

Solution

Error Detection

  • Tracks consecutive failed MXP parsing attempts
  • Triggers recovery mechanism after 1000 failed attempts
  • Captures problematic content for user display

Self-Healing Dialog

  • User-friendly dialog explaining the issue
  • Shows sample of problematic content
  • Three recovery options:
    • Disable MXP (recommended) - Turns off MXP processing
    • Continue with MXP - Resets error state, keeps MXP enabled
    • Not Now - Dismisses dialog without changes

Automatic Recovery

  • Seamless fallback to text processing when MXP is disabled
  • Prevents screen output freezing
  • Maintains profile settings for future sessions

Technical Details

Error Detection Logic

if (!mMxpTagBuilder.accept(ch) && mMxpTagBuilder.isInsideTag() && !mMxpTagBuilder.hasTag()) {
mTagStuckCounter++;
mProblematicContent += ch;
if (mTagStuckCounter > 1000) {
// Trigger recovery mechanism
}
}

Recovery Integration

The recovery system integrates into the main MXP processing loop in TBuffer.cpp, checking for stuck parsing and presenting the recovery dialog when issues are detected.

Testing

Tested with various malformed MXP scenarios:

  • Unescaped < and > characters in ASCII art
  • Incomplete MXP tags (e.g., <font color=red without closing >)
  • Mixed problematic content with valid MXP
  • Recovery dialog functionality and user option handling

Benefits

  1. Prevents Screen Freezing - No more stuck MXP parsing blocking game output
  2. User-Friendly - Clear explanation and recovery options
  3. Backward Compatible - Existing MXP functionality unchanged
  4. Minimal Disruption - Users can choose their preferred recovery method
  5. Educational - Explains MXP issues to help user understanding

Screenshots

https://github.com/user-attachments/assets/d4a51836-0606-48b0-a228-a3a2f85a0969

Impact

This change particularly benefits new players who encounter MUDs with problematic MXP implementations, preventing the frustrating experience of frozen screen output that could drive them away from the game.

Related Issues

Fixes #7896 - Detect MXP issues and offer self-healing options

/claim #7896

Checklist

  • Code compiles without warnings
  • Functionality tested with various malformed MXP scenarios
  • Dialog interface tested and user-friendly
  • Backward compatibility maintained
  • No breaking changes to existing MXP functionality
  • Build system updated for new files

Claim

Total prize pool $200
Total paid $0
Status Pending
Submitted August 16, 2025
Last updated August 16, 2025

Contributors

RI

Rishi Mondal

@MAVRICK-1

100%

Sponsors

MU

Mudlet

@Mudlet

$200