diff options
author | Wim <wim@42.be> | 2022-06-25 00:36:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-25 00:36:16 +0200 |
commit | 4649876956ab944d2a9ea8fc98c75dc8a9f5ef08 (patch) | |
tree | 0f32da8e492cabd8eca53de319e287e6c4791c5e /vendor/go.mau.fi/whatsmeow/message.go | |
parent | 5604d140e3bbf5c8f6c414b1427145a0c4e36bb4 (diff) | |
download | matterbridge-msglm-4649876956ab944d2a9ea8fc98c75dc8a9f5ef08.tar.gz matterbridge-msglm-4649876956ab944d2a9ea8fc98c75dc8a9f5ef08.tar.bz2 matterbridge-msglm-4649876956ab944d2a9ea8fc98c75dc8a9f5ef08.zip |
Update dependencies (#1851)
Diffstat (limited to 'vendor/go.mau.fi/whatsmeow/message.go')
-rw-r--r-- | vendor/go.mau.fi/whatsmeow/message.go | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/vendor/go.mau.fi/whatsmeow/message.go b/vendor/go.mau.fi/whatsmeow/message.go index 24c1c6c6..7df4bfbb 100644 --- a/vendor/go.mau.fi/whatsmeow/message.go +++ b/vendor/go.mau.fi/whatsmeow/message.go @@ -40,6 +40,9 @@ func (cli *Client) handleEncryptedMessage(node *waBinary.Node) { if err != nil { cli.Log.Warnf("Failed to parse message: %v", err) } else { + if info.VerifiedName != nil && len(info.VerifiedName.Details.GetVerifiedName()) > 0 { + go cli.updateBusinessName(info.Sender, info, info.VerifiedName.Details.GetVerifiedName()) + } if len(info.PushName) > 0 && info.PushName != "-" { go cli.updatePushName(info.Sender, info, info.PushName) } @@ -47,13 +50,17 @@ func (cli *Client) handleEncryptedMessage(node *waBinary.Node) { } } -func (cli *Client) parseMessageSource(node *waBinary.Node) (source types.MessageSource, err error) { +func (cli *Client) parseMessageSource(node *waBinary.Node, requireParticipant bool) (source types.MessageSource, err error) { ag := node.AttrGetter() from := ag.JID("from") if from.Server == types.GroupServer || from.Server == types.BroadcastServer { source.IsGroup = true source.Chat = from - source.Sender = ag.JID("participant") + if requireParticipant { + source.Sender = ag.JID("participant") + } else { + source.Sender = ag.OptionalJIDOrEmpty("participant") + } if source.Sender.User == cli.Store.ID.User { source.IsFromMe = true } @@ -80,7 +87,7 @@ func (cli *Client) parseMessageSource(node *waBinary.Node) (source types.Message func (cli *Client) parseMessageInfo(node *waBinary.Node) (*types.MessageInfo, error) { var info types.MessageInfo var err error - info.MessageSource, err = cli.parseMessageSource(node) + info.MessageSource, err = cli.parseMessageSource(node, true) if err != nil { return nil, err } @@ -96,6 +103,11 @@ func (cli *Client) parseMessageInfo(node *waBinary.Node) (*types.MessageInfo, er for _, child := range node.GetChildren() { if child.Tag == "multicast" { info.Multicast = true + } else if child.Tag == "verified_name" { + info.VerifiedName, err = parseVerifiedNameContent(child) + if err != nil { + cli.Log.Warnf("Failed to parse verified_name node in %s: %v", info.ID, err) + } } else if mediaType, ok := child.AttrGetter().GetString("mediatype", false); ok { info.MediaType = mediaType } |