Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core] Construct ForwardEntity with a single sequence #737

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Lagrange.Core/Message/Entity/ForwardEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ public ForwardEntity()
Elements = new List<Elem>();
}

public ForwardEntity(uint sequence)
{
Sequence = sequence;
Uid = null;
Elements = new List<Elem>();
}

public ForwardEntity(MessageChain chain)
{
Time = chain.Time;
Expand Down
12 changes: 12 additions & 0 deletions Lagrange.Core/Message/MessageBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,18 @@ public MessageBuilder Forward(MessageChain target)

return this;
}

/// <summary>
/// Add a forward entity to the specified message sequence number
/// </summary>
/// <param name="sequence">The sequence number of the message to be forwarded</param>
public MessageBuilder Forward(uint sequence)
{
var forwardEntity = new ForwardEntity(sequence);
_chain.Add(forwardEntity);

return this;
}

/// <summary>
/// Add a multimsg entity to the message chain (multi message)
Expand Down
Loading