Skip to content

Commit

Permalink
receipt: include original message sender in receipt events
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Sep 27, 2024
1 parent d5cecea commit 62cd884
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions receipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func (cli *Client) parseReceipt(node *waBinary.Node) (*events.Receipt, error) {
MessageSource: source,
Timestamp: ag.UnixTime("t"),
Type: types.ReceiptType(ag.OptionalString("type")),
MessageSender: ag.OptionalJIDOrEmpty("recipient"),
}
if source.IsGroup && source.Sender.IsEmpty() {
participantTags := node.GetChildrenByTag("participants")
Expand Down
4 changes: 4 additions & 0 deletions types/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,10 @@ type Receipt struct {
MessageIDs []types.MessageID
Timestamp time.Time
Type types.ReceiptType

// When you read the message of another user in a group, this field contains the sender of the message.
// For receipts from other users, the message sender is always you.
MessageSender types.JID
}

// ChatPresence is emitted when a chat state update (also known as typing notification) is received.
Expand Down

0 comments on commit 62cd884

Please sign in to comment.