Skip to content

Nicknames: source-picker favourites + B.net cross-session fix#137

Open
Maelareth wants to merge 4 commits into
DanderBot:mainfrom
Maelareth:feature/picker-favorites
Open

Nicknames: source-picker favourites + B.net cross-session fix#137
Maelareth wants to merge 4 commits into
DanderBot:mainfrom
Maelareth:feature/picker-favorites

Conversation

@Maelareth

Copy link
Copy Markdown

Summary

Two things, both in the Nicknames feature:

  1. Source-picker favourites — a quality-of-life upgrade to the "Add from" pickers.
  2. A B.net rules bug fix — Battle.net nickname rules were silently breaking across sessions.

Favourites (feature)

  • Star any group / guild / friend / Battle.net member in the "Add from" picker to pin them to the top.
  • Each list sorts into tiers — favourites → online → offline (A–Z within each) — with a divider between the favourites and the rest.
  • Stored account-wide. Characters share one favourites list across the group/guild/friends pickers; Battle.net is keyed by BattleTag.

B.net cross-session fix (bug)

  • B.net rules previously stored the session-only bnetAccountID, so after a full relog the id changed and the rule silently stopped applying — the rule stayed in the list but the nickname vanished. Confirmed against the API docs (bnetAccountID is documented as a temporary, session-scoped id) and a code review.
  • Rules now key off the stable BattleTag. Existing rules are migrated where possible (via the still-valid session id, or by matching the stored label to an account name / BattleTag); any that can't be resolved are flagged in the list ("needs re-link") so they can be re-added rather than silently lost.

Also included

  • Perf: a per-GUID resolve cache (wiped in RefreshAllFrames) removes repeated string work on the name path.
  • Hardening: the self-broadcast name is built with GetNormalizedRealmName() for realm-spelling parity with the addon-message sender string; the received-nickname short-name key no longer collides across realms.

Testing

  • Favourites: starring/un-starring, the 3-tier sort, the divider, and the shared list across friends/guild verified in-game across all four pickers.
  • B.net: adding friends (now stores BattleTag) and the migration path verified; no Lua errors.
  • Existing nickname behaviour regression-checked.

Maelareth added 4 commits June 8, 2026 17:31
- Favourites: star any group/guild/friend/B.net member to pin them to the
  top of the "Add from" picker. Each list now sorts into tiers (favourites,
  then online, then offline; A-Z within) with a divider between the
  favourites and the rest. Stored account-wide; characters share one list
  across the group/guild/friends pickers, B.net is keyed by BattleTag.
- B.net rules now key off the stable BattleTag instead of the session-only
  bnetAccountID, fixing rules that silently stopped applying after a full
  relog. Existing rules are migrated where possible; any that can't be
  matched are flagged in the list so they can be re-added.
- Add a per-GUID resolve cache (wiped in RefreshAllFrames) to drop the
  repeated string work on the name path.
- Guard the received-nickname short-name key against cross-realm collisions.
Use GetNormalizedRealmName() for the player's own name so the self-message guard matches the realm spelling the server puts on our own broadcasts; space-stripping GetRealmName() can diverge on some realms.
C_BattleNet.GetFriendAccountInfo().accountName is a session-scoped |K...|k name token that renders as a different friend after a relog, so it must not be persisted. Derive the rule's display label from the stable BattleTag instead, repair labels already saved as a token on load, and stop the legacy migration from matching a token pattern (which could mis-assign a different friend).
@Maelareth

Copy link
Copy Markdown
Author

Pushed one more commit (b1a36b2) after testing the B.net path across a full relog.

What it fixes: a B.net rule's display label was being saved from C_BattleNet.GetFriendAccountInfo().accountName, which is a session-scoped |K…|k Battle.net name token rather than plain text. It renders to the friend's current name client-side, and the index inside it is reassigned each login — so after a relog the Saved-nicknames list showed a different friend's name for the rule (e.g. PinkusRakbladeT), even though the rule still matched the correct account.

The BattleTag-based matching was already correct (nicknames applied to the right people); only the persisted label drifted. The commit:

  • derives the rule's display label from the stable BattleTag (name part), never from accountName;
  • adds a one-time repair that rewrites any label already saved as a |K…|k token on load;
  • stops the legacy migration from matching a token pattern (which could otherwise mis-assign a different friend).

Worth noting both this and the original cross-session matching bug exist in the current alpha, so this PR fixes two real B.net issues alongside the favourites feature.

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.

1 participant