Merge pull request #150

* Hash message links so messages with different links aren't considered…

* Add option to toggle if links should be considered for the message ha…
This commit is contained in:
Simon Schürrle
2025-06-22 20:17:19 +02:00
committed by GitHub
parent 34c4d87a33
commit 0d075ca060
6 changed files with 51 additions and 4 deletions
+13 -4
View File
@@ -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)