Skip to content

feat: add nickname history feature (History button, searchable popup, Paste/Copy/Delete, XML persistence)#5065

Open
DateFTP wants to merge 8 commits into
multitheftauto:masterfrom
DateFTP:feature/nickname-history
Open

feat: add nickname history feature (History button, searchable popup, Paste/Copy/Delete, XML persistence)#5065
DateFTP wants to merge 8 commits into
multitheftauto:masterfrom
DateFTP:feature/nickname-history

Conversation

@DateFTP

@DateFTP DateFTP commented Jul 19, 2026

Copy link
Copy Markdown

Summary

This PR adds a Nickname History feature to the MTA client Settings window (Multiplayer tab). When a player changes their nickname, the previous nickname is automatically saved to mta/logs/nicknames.xml. The player can later browse, search, paste, copy, or delete entries from the history popup.


Changes

Client/core/CSettings.h

  • Added member variables for the Nickname History UI: button, popup window, grid, search field, action buttons
  • Added column handles (m_hNickHistoryColNick, m_hNickHistoryColDate)
  • Added cache (m_NickHistoryCache) for nickname entries
  • Added cached file path (m_strNicknamesFilePath)
  • Added friend callback declarations for the Delete/DeleteAll question box
  • Added method declarations: SaveNicknameToFile(), RewriteNickHistoryFileFromCache()

Client/core/CSettings.cpp

GUI creation (CreateGUI):

  • Added History button (60x26) to the right of the random-nick generator button
  • Created a popup window (600x460) titled "Nickname history" with:
    • Search field (filters by nickname or date in real-time)
    • Grid list with two columns: Nickname (65%) and Date (35%)
    • Paste to nick - copies selected nickname to the edit box
    • Copy - copies selected nickname to clipboard
    • Delete - removes selected entry (with confirmation)
    • Delete All - clears entire history (with confirmation)
    • Close - closes the popup

XML persistence:

  • SaveNicknameToFile() - loads existing entries from
    icknames.xml into the cache, appends the new nickname with a timestamp, then rewrites the file from the cache. This ensures old entries are never lost.
  • RewriteNickHistoryFileFromCache() - writes the entire cache back to XML. Uses MakeSureDirExists() before writing, so the file and/or logs/ directory are re-created automatically if deleted.
  • Constructor pre-creates
    icknames.xml with an empty root if the file is missing.

Question boxes:

  • "DELETE NICKNAME" confirmation with "Delete nickname "%s" from history?" message
  • "DELETE ALL" confirmation with "Delete all nicknames from history?" message

All UI strings are wrapped with _() for gettext localization.

Locale files (43 languages)

Added the following new translation entries to client.pot in every locale directory:

  • "History", "Nickname history", "Nickname", "Date"
  • "Paste to nick", "Copy", "Delete", "Delete All"
  • "DELETE NICKNAME", "Delete nickname "%s" from history?"
  • "DELETE ALL", "Delete all nicknames from history?"

How it works

  1. When the user clicks OK in the Settings window, if the nickname has changed, the previous nickname is written to mta/logs/nicknames.xml with a timestamp.
  2. The History button opens a popup showing all previously saved nicknames in a searchable grid.
  3. Paste to nick replaces the current edit-box nickname with the selected history entry.
  4. Copy copies the selected nickname to the system clipboard.
  5. Delete and Delete All show confirmation dialogs before removing entries.
  6. The XML file is rebuilt entirely from the in-memory cache on every modification, keeping it consistent and preventing data loss.
  7. If
    icknames.xml or the logs/ directory is deleted at runtime, the code recreates them automatically.

Testing notes

  • Build: Release Win32 (Client Core.vcxproj)
  • File path: Bin/MTA/logs/nicknames.xml
  • No new dependencies required
  • Compiles cleanly with 0 warnings and 0 errors

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

DateFTP added 5 commits July 19, 2026 00:38
Increase the settings window content size from 680x480 to 720x520
to prevent content clipping in the Advanced tab when using
non-English languages with longer translated labels.
- Compute fComboWidth dynamically based on remaining tab panel width
  instead of hardcoded 170px, clamped between 100-400px
- Fix description label width to use tabPanelSize.fX instead of hardcoded 500px
- Fix 'Check for update now' button position to clamp within tab bounds
- Add Nickname History button to Multiplayer settings tab
- Add popup window with searchable grid (Nickname + Date columns)
- Add Paste/Copy/Delete/Delete All/Close buttons
- Save nickname changes to mta/logs/nicknames.xml
- Auto-load existing entries on save to preserve history
- Re-create nicknames.xml if file or logs/ directory is deleted
- Add translation entries for all 43 locales (client.pot files)
- All UI strings wrapped with _() for localization support
@DateFTP

DateFTP commented Jul 19, 2026

Copy link
Copy Markdown
Author
image

@DateFTP

DateFTP commented Jul 19, 2026

Copy link
Copy Markdown
Author
image

@DateFTP

DateFTP commented Jul 19, 2026

Copy link
Copy Markdown
Author
image

@DateFTP

DateFTP commented Jul 19, 2026

Copy link
Copy Markdown
Author
image

DateFTP and others added 2 commits July 19, 2026 03:21
Re-add nickname history translation entries (12 msgid per file)
using proper UTF-8 encoding to avoid mojibake corruption.
Original commit had garbled non-ASCII characters in all translations.
@Lpsd

Lpsd commented Jul 19, 2026

Copy link
Copy Markdown
Member

I don't see the purpose of having a nickname history. This seems rather useless? In what realistic scenario would a user require this?

Also, please advise your LLM that translation files aren't created manually.

@DateFTP

DateFTP commented Jul 19, 2026

Copy link
Copy Markdown
Author

@Lpsd Some players will find the nickname history feature useful. As a player, I find this feature interesting. For example, if I change my nickname and forget my old nickname, I can go to the nickname history and retrieve my previous nickname.

@DateFTP

DateFTP commented Jul 19, 2026

Copy link
Copy Markdown
Author

@Lpsd I'll check if my language model has made any mistakes in the language and locale. I understand that this is not the correct way to load languages.

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.

2 participants