diff --git a/message.go b/message.go index 5aef10e8..23eefbfe 100644 --- a/message.go +++ b/message.go @@ -134,6 +134,26 @@ func (cli *Client) parseMsgMetaInfo(node waBinary.Node) (metaInfo types.MsgMetaI return } +func (cli *Client) parseMessageParticipant(node *waBinary.Node) (participant types.JID, err error) { + ag := node.AttrGetter() + participant = ag.JID("jid") + err = ag.Error() + return +} + +func (cli *Client) parseMessageParticipants(node *waBinary.Node) (participants []types.JID, err error) { + children := node.GetChildren() + participants = make([]types.JID, 0, len(children)) + for _, child := range children { + participant, err := cli.parseMessageParticipant(&child) + if err != nil { + return nil, err + } + participants = append(participants, participant) + } + return +} + func (cli *Client) parseMessageInfo(node *waBinary.Node) (*types.MessageInfo, error) { var info types.MessageInfo var err error @@ -174,6 +194,11 @@ func (cli *Client) parseMessageInfo(node *waBinary.Node) (*types.MessageInfo, er // TODO case "trace": // TODO + case "participants": + info.Participants, err = cli.parseMessageParticipants(&child) + if err != nil { + cli.Log.Warnf("Failed to parse node in %s: %v", info.ID, err) + } default: if mediaType, ok := child.AttrGetter().GetString("mediatype", false); ok { info.MediaType = mediaType diff --git a/types/message.go b/types/message.go index ff13f79c..09f822d9 100644 --- a/types/message.go +++ b/types/message.go @@ -86,6 +86,8 @@ type MessageInfo struct { VerifiedName *VerifiedName DeviceSentMeta *DeviceSentMeta // Metadata for direct messages sent from another one of the user's own devices. + + Participants []JID } // SourceString returns a log-friendly representation of who sent the message and where.