diff --git a/ChatTwo/AutoTellTabsService.cs b/ChatTwo/AutoTellTabsService.cs index 497ca57..35ca374 100644 --- a/ChatTwo/AutoTellTabsService.cs +++ b/ChatTwo/AutoTellTabsService.cs @@ -3,7 +3,10 @@ using System.Collections.Generic; using System.Linq; using ChatTwo.Code; using ChatTwo.GameFunctions.Types; +using ChatTwo.Resources; using ChatTwo.Util; +using Dalamud.Game.Text; +using Dalamud.Game.Text.SeStringHandling; namespace ChatTwo; @@ -251,6 +254,14 @@ internal sealed class AutoTellTabsService : IDisposable senderWorld, preloadCount); + if (history.Count == 0) + { + // No prior tells with this player — leave the tab to start + // empty so the user does not see a "history loaded" marker + // sitting alone above the very first message. + return; + } + // The history list is already oldest-first, so a plain AddPrune // loop produces the chronological order the user expects to see // when the tab opens. @@ -258,16 +269,34 @@ internal sealed class AutoTellTabsService : IDisposable { tab.Messages.AddPrune(message, MessageManager.MessageDisplayLimit); } + + // Visible separator between the loaded history and the live + // tell that triggered this spawn. Goes in last so it sorts + // after the historical messages but before the current one. + tab.Messages.AddPrune( + MakeSystemMarker(HellionStrings.AutoTellTabs_HistorySeparator), + MessageManager.MessageDisplayLimit); } catch (Exception ex) { - // Non-fatal: the tab still spawns, the user just sees only the - // current message. The error logs once with full stack trace - // for diagnosis. + // Non-fatal: the tab still spawns, but the user gets a visible + // notice instead of silently missing history. The error logs + // once with full stack trace for diagnosis. Plugin.Log.Error(ex, "[AutoTellTabs] History preload failed"); + tab.Messages.AddPrune( + MakeSystemMarker(HellionStrings.AutoTellTabs_HistoryLoadError), + MessageManager.MessageDisplayLimit); } } + private static Message MakeSystemMarker(string text) + { + var seString = new SeStringBuilder().AddText(text).Build(); + var chunks = ChunkUtil.ToChunks(seString, ChunkSource.Content, ChatType.System).ToList(); + var code = new ChatCode((XivChatType)ChatType.System, 0, 0); + return Message.FakeMessage(chunks, code); + } + internal void MarkGreeted(Tab tab) { SetGreeted(tab, true); diff --git a/ChatTwo/Plugin.cs b/ChatTwo/Plugin.cs index d60ed3a..63b101e 100755 --- a/ChatTwo/Plugin.cs +++ b/ChatTwo/Plugin.cs @@ -184,11 +184,10 @@ public sealed class Plugin : IDalamudPlugin Config.Version = 9; SaveConfig(); - // TODO Task 14: replace with HellionStrings.AutoTellTabs_Migration_Title / _Content Notification.AddNotification(new Dalamud.Interface.ImGuiNotification.Notification { - Title = "Auto-Tell-Tabs", - Content = "Auto-Tell-Tabs sind ab Version 0.4.0 standardmäßig aktiv. Du kannst sie im Chat-Tab deaktivieren oder anpassen.", + Title = HellionStrings.AutoTellTabs_Migration_Title, + Content = HellionStrings.AutoTellTabs_Migration_Content, Type = Dalamud.Interface.ImGuiNotification.NotificationType.Info, InitialDuration = TimeSpan.FromSeconds(20), }); diff --git a/ChatTwo/Resources/HellionStrings.Designer.cs b/ChatTwo/Resources/HellionStrings.Designer.cs index 02e9289..86bc5c9 100644 --- a/ChatTwo/Resources/HellionStrings.Designer.cs +++ b/ChatTwo/Resources/HellionStrings.Designer.cs @@ -164,4 +164,29 @@ internal class HellionStrings internal static string About_Localization_P1 => Get(nameof(About_Localization_P1)); internal static string About_Localization_P2 => Get(nameof(About_Localization_P2)); internal static string About_Translators_TreeNode => Get(nameof(About_Translators_TreeNode)); + + // Hellion Chat — Auto-Tell-Tabs runtime strings + internal static string AutoTellTabs_Migration_Title => Get(nameof(AutoTellTabs_Migration_Title)); + internal static string AutoTellTabs_Migration_Content => Get(nameof(AutoTellTabs_Migration_Content)); + internal static string AutoTellTabs_SectionHeader => Get(nameof(AutoTellTabs_SectionHeader)); + internal static string AutoTellTabs_HistorySeparator => Get(nameof(AutoTellTabs_HistorySeparator)); + internal static string AutoTellTabs_HistoryLoadError => Get(nameof(AutoTellTabs_HistoryLoadError)); + internal static string AutoTellTabs_GreetedTooltip => Get(nameof(AutoTellTabs_GreetedTooltip)); + internal static string AutoTellTabs_UnGreetedTooltip => Get(nameof(AutoTellTabs_UnGreetedTooltip)); + + // Hellion Chat — Auto-Tell-Tabs Chat settings tab + internal static string ChatLog_AutoTellTabs_Section_Title => Get(nameof(ChatLog_AutoTellTabs_Section_Title)); + internal static string ChatLog_AutoTellTabs_Enable_Name => Get(nameof(ChatLog_AutoTellTabs_Enable_Name)); + internal static string ChatLog_AutoTellTabs_Enable_Description => Get(nameof(ChatLog_AutoTellTabs_Enable_Description)); + internal static string ChatLog_AutoTellTabs_Limit_Name => Get(nameof(ChatLog_AutoTellTabs_Limit_Name)); + internal static string ChatLog_AutoTellTabs_Limit_Description => Get(nameof(ChatLog_AutoTellTabs_Limit_Description)); + internal static string ChatLog_AutoTellTabs_Compact_Name => Get(nameof(ChatLog_AutoTellTabs_Compact_Name)); + internal static string ChatLog_AutoTellTabs_Compact_Description => Get(nameof(ChatLog_AutoTellTabs_Compact_Description)); + internal static string ChatLog_AutoTellTabs_PreloadHint => Get(nameof(ChatLog_AutoTellTabs_PreloadHint)); + + // Hellion Chat — Auto-Tell-Tabs Privacy settings tab + internal static string Privacy_AutoTellTabs_Section_Title => Get(nameof(Privacy_AutoTellTabs_Section_Title)); + internal static string Privacy_AutoTellTabs_Preload_Name => Get(nameof(Privacy_AutoTellTabs_Preload_Name)); + internal static string Privacy_AutoTellTabs_Preload_Description => Get(nameof(Privacy_AutoTellTabs_Preload_Description)); + internal static string Privacy_AutoTellTabs_Preload_Hint => Get(nameof(Privacy_AutoTellTabs_Preload_Hint)); } diff --git a/ChatTwo/Resources/HellionStrings.de.resx b/ChatTwo/Resources/HellionStrings.de.resx index d13339b..6e82d8a 100644 --- a/ChatTwo/Resources/HellionStrings.de.resx +++ b/ChatTwo/Resources/HellionStrings.de.resx @@ -366,4 +366,67 @@ Chat-2-Community-Übersetzer (Upstream) + + + + Auto-Tell-Tabs + + + Auto-Tell-Tabs sind ab Version 0.4.0 standardmäßig aktiv. Du kannst sie im Chat-Tab deaktivieren oder anpassen. + + + Aktive Tells + + + — Frühere Unterhaltungen — + + + Verlauf konnte nicht geladen werden. + + + Als begrüßt markiert. Klicken um die Markierung zu entfernen. + + + Als begrüßt markieren. + + + + + Auto-Tell-Tabs + + + Bei jedem /tell automatisch einen Tab pro Gesprächspartner öffnen + + + Sobald du einen /tell empfängst oder sendest, wird automatisch ein temporärer Tab für diesen Spieler geöffnet. Die Tabs verschwinden beim Logout. + + + Maximale Anzahl der Auto-Tell-Tabs + + + Beim Erreichen werden begrüßte Tabs mit der ältesten Aktivität zuerst geschlossen. Änderungen greifen beim nächsten /tell. + + + Kompakte Anzeige + + + Zeigt nur einen dünnen Separator zwischen normalen Tabs und Auto-Tell-Tabs, ohne Sektions-Header. + + + Die Anzahl der vorgeladenen Tells lässt sich im Datenschutz-Tab einstellen. + + + + + Tell-Verlauf in Auto-Tabs + + + Anzahl der vorgeladenen Tells + + + Wie viele frühere Tell-Nachrichten beim Öffnen eines Auto-Tell-Tabs aus der Datenbank geladen werden. 0 deaktiviert die Vorladung. + + + Greift nur, wenn Auto-Tell-Tabs im Chat-Tab aktiviert sind. + diff --git a/ChatTwo/Resources/HellionStrings.resx b/ChatTwo/Resources/HellionStrings.resx index 52c1d43..58fc3bc 100644 --- a/ChatTwo/Resources/HellionStrings.resx +++ b/ChatTwo/Resources/HellionStrings.resx @@ -366,4 +366,67 @@ Chat 2 community translators (upstream) + + + + Auto-Tell-Tabs + + + Auto-Tell-Tabs are enabled by default starting with version 0.4.0. You can disable or fine-tune them in the Chat tab. + + + Active Tells + + + — Earlier conversations — + + + History could not be loaded. + + + Marked as greeted. Click to remove the marker. + + + Mark as greeted. + + + + + Auto-Tell-Tabs + + + Open a tab automatically for each tell partner + + + When you receive or send a /tell, a temporary tab dedicated to that player is opened automatically. Tabs vanish on logout. + + + Maximum number of auto tell tabs + + + When the limit is reached, greeted tabs with the oldest activity are dropped first. The change applies on the next /tell. + + + Compact display + + + Show only a thin separator between persistent tabs and auto tell tabs, without the section header. + + + The number of preloaded tells is configured in the Privacy tab. + + + + + Tell history in auto tabs + + + Number of preloaded tells + + + How many earlier tell messages are loaded from the database when an auto tell tab is opened. 0 disables the preload. + + + Only takes effect when auto tell tabs are enabled in the Chat tab. +