diff --git a/ChatTwo/AutoTellTabsService.cs b/ChatTwo/AutoTellTabsService.cs index 661d8bf..06454bf 100644 --- a/ChatTwo/AutoTellTabsService.cs +++ b/ChatTwo/AutoTellTabsService.cs @@ -257,12 +257,12 @@ internal sealed class AutoTellTabsService : IDisposable internal void MarkGreeted(Tab tab) { - // Stub — implemented in Task 12. + SetGreeted(tab, true); } internal void UnmarkGreeted(Tab tab) { - // Stub — implemented in Task 12. + SetGreeted(tab, false); } internal bool IsGreeted(Tab tab) @@ -270,6 +270,27 @@ internal sealed class AutoTellTabsService : IDisposable return tab.IsGreeted; } + private void SetGreeted(Tab tab, bool greeted) + { + if (tab == null) + { + return; + } + + lock (_tempTabsLock) + { + // Frame-race guard (E5): the sidebar might still render a tab + // that has already been removed by LRU drop or logout cleanup. + // Silently skip the toggle so we don't mutate stale state. + if (!Plugin.Config.Tabs.Contains(tab)) + { + return; + } + + tab.IsGreeted = greeted; + } + } + private void OnLogout(int type, int code) { lock (_tempTabsLock)