Skip to content

Commit

Permalink
[Core] Better filtering rules and mimicry for ForwardEntity x2
Browse files Browse the repository at this point in the history
  • Loading branch information
pk5ls20 committed Oct 1, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 9c3c7cd commit 39f281c
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Lagrange.Core/Message/Entity/ForwardEntity.cs
Original file line number Diff line number Diff line change
@@ -97,7 +97,8 @@ IEnumerable<Elem> IMessageEntity.PackElement()
Time = DateTimeOffset.FromUnixTimeSeconds(srcMsg.Time ?? 0).LocalDateTime,
Sequence = reserve.FriendSequence ?? srcMsg.OrigSeqs?[0] ?? 0,
TargetUin = (uint)srcMsg.SenderUin,
MessageId = reserve.MessageId
MessageId = reserve.MessageId,
ClientSequence = reserve.FriendSequence.HasValue ? (srcMsg.OrigSeqs?[0] ?? 0) : 0
};
}

2 changes: 1 addition & 1 deletion Lagrange.Core/Message/MessageFilter.cs
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ static MessageFilter()
{
FilterRules.Add(chain =>
{
var forwardIndex = chain.FindIndex(entity => entity is ForwardEntity);
var forwardIndex = chain.FindIndex(entity => entity is ForwardEntity {ClientSequence: 0});

if (forwardIndex != -1 && chain.Count > forwardIndex + 2 &&
chain[forwardIndex + 1] is MentionEntity { Name: not null } &&

0 comments on commit 39f281c

Please sign in to comment.