diff --git a/ChatTwo/Configuration.cs b/ChatTwo/Configuration.cs index 91ecc9e..121345e 100755 --- a/ChatTwo/Configuration.cs +++ b/ChatTwo/Configuration.cs @@ -73,6 +73,7 @@ internal class Configuration : IPluginConfiguration public bool FilterIncludePreviousSessions; public bool SortAutoTranslate; public bool CollapseDuplicateMessages; + public bool CollapseKeepUniqueLinks; public bool PlaySounds = true; public bool KeepInputFocus = true; public int MaxLinesToRender = 10_000; // 1-10000 @@ -163,6 +164,7 @@ internal class Configuration : IPluginConfiguration FilterIncludePreviousSessions = other.FilterIncludePreviousSessions; SortAutoTranslate = other.SortAutoTranslate; CollapseDuplicateMessages = other.CollapseDuplicateMessages; + CollapseKeepUniqueLinks = other.CollapseKeepUniqueLinks; PlaySounds = other.PlaySounds; KeepInputFocus = other.KeepInputFocus; MaxLinesToRender = other.MaxLinesToRender; diff --git a/ChatTwo/Message.cs b/ChatTwo/Message.cs index dfbeffa..8da3dcc 100755 --- a/ChatTwo/Message.cs +++ b/ChatTwo/Message.cs @@ -137,10 +137,19 @@ internal partial class Message private int GenerateHash() { - return SortCode.GetHashCode() - ^ ExtraChatChannel.GetHashCode() - ^ string.Join("", Sender.Select(c => c.StringValue())).GetHashCode() - ^ string.Join("", Content.Select(c => c.StringValue())).GetHashCode(); + var hash = SortCode.GetHashCode() + ^ ExtraChatChannel.GetHashCode() + ^ string.Join("", Sender.Select(c => c.StringValue())).GetHashCode() + ^ string.Join("", Content.Select(c => c.StringValue())).GetHashCode(); + + if (Plugin.Config.CollapseKeepUniqueLinks) + { + // Hash the link too for something like DeathRecap where the message is the same + // but the link is different + hash ^= string.Join("", Content.Select(c => c.Link?.GetHashCode())).GetHashCode(); + } + + return hash; } private static Guid ExtractExtraChatChannel(SeString contentSource) diff --git a/ChatTwo/Resources/Language.Designer.cs b/ChatTwo/Resources/Language.Designer.cs index 227769a..b3ebd9f 100755 --- a/ChatTwo/Resources/Language.Designer.cs +++ b/ChatTwo/Resources/Language.Designer.cs @@ -2075,6 +2075,24 @@ namespace ChatTwo.Resources { } } + /// + /// Looks up a localized string similar to Don't collapse messages if they link to different things with the same text. + /// + internal static string Options_CollapseDuplicateMsgUniqueLink_Description { + get { + return ResourceManager.GetString("Options_CollapseDuplicateMsgUniqueLink_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Keep unique links seperate + /// + internal static string Options_CollapseDuplicateMsgUniqueLink_Name { + get { + return ResourceManager.GetString("Options_CollapseDuplicateMsgUniqueLink_Name", resourceCulture); + } + } + /// /// Looks up a localized string similar to The side of {0} to display help for commands on.. /// @@ -3867,3 +3885,4 @@ namespace ChatTwo.Resources { } } } + diff --git a/ChatTwo/Resources/Language.de.resx b/ChatTwo/Resources/Language.de.resx index f0f3afa..1167350 100644 --- a/ChatTwo/Resources/Language.de.resx +++ b/ChatTwo/Resources/Language.de.resx @@ -950,6 +950,12 @@ Sie wurden gewarnt. Ersetzt sich wiederholende Nachrichten mit einem Zähler, der der originalen Nachricht angehängt wird. + + Trenne seperate Verlinkungen + + + Trenne Nachrichten die den gleichen text mit verschieden Verlinkungen haben. + ExtraChat-Kanäle diff --git a/ChatTwo/Resources/Language.resx b/ChatTwo/Resources/Language.resx index b1bc373..e41cc51 100644 --- a/ChatTwo/Resources/Language.resx +++ b/ChatTwo/Resources/Language.resx @@ -961,6 +961,12 @@ Replace consecutive duplicate messages with a counter appended to the first instance of the message. + + Keep unique links seperate + + + Don't collapse messages if they link to different things with the same text. + ExtraChat channels diff --git a/ChatTwo/Ui/SettingsTabs/Display.cs b/ChatTwo/Ui/SettingsTabs/Display.cs index b0fe899..72f41c6 100755 --- a/ChatTwo/Ui/SettingsTabs/Display.cs +++ b/ChatTwo/Ui/SettingsTabs/Display.cs @@ -109,6 +109,11 @@ internal sealed class Display : ISettingsTab ImGui.Spacing(); ImGuiUtil.OptionCheckbox(ref Mutable.CollapseDuplicateMessages, Language.Options_CollapseDuplicateMessages_Name, Language.Options_CollapseDuplicateMessages_Description); + if (Mutable.CollapseDuplicateMessages) + { + using var _ = ImRaii.PushIndent(); + ImGuiUtil.OptionCheckbox(ref Mutable.CollapseKeepUniqueLinks, Language.Options_CollapseDuplicateMsgUniqueLink_Name, Language.Options_CollapseDuplicateMsgUniqueLink_Description); + } ImGui.Spacing(); } }