diff options
Diffstat (limited to 'bridge/whatsappmulti/handlers.go')
-rw-r--r-- | bridge/whatsappmulti/handlers.go | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/bridge/whatsappmulti/handlers.go b/bridge/whatsappmulti/handlers.go index fd75be09..b8e78572 100644 --- a/bridge/whatsappmulti/handlers.go +++ b/bridge/whatsappmulti/handlers.go @@ -1,3 +1,4 @@ +//go:build whatsappmulti // +build whatsappmulti package bwhatsapp @@ -89,6 +90,12 @@ func (b *Bwhatsapp) handleTextMessage(messageInfo types.MessageInfo, msg *proto. } } + parentID := "" + if msg.GetExtendedTextMessage() != nil { + ci := msg.GetExtendedTextMessage().GetContextInfo() + parentID = getParentIdFromCtx(ci) + } + rmsg := config.Message{ UserID: senderJID.String(), Username: senderName, @@ -97,8 +104,8 @@ func (b *Bwhatsapp) handleTextMessage(messageInfo types.MessageInfo, msg *proto. Account: b.Account, Protocol: b.Protocol, Extra: make(map[string][]interface{}), - // ParentID: TODO, // TODO handle thread replies // map from Info.QuotedMessageID string - ID: messageInfo.ID, + ID: getMessageIdFormat(senderJID, messageInfo.ID), + ParentID: parentID, } if avatarURL, exists := b.userAvatars[senderJID.String()]; exists { @@ -130,7 +137,8 @@ func (b *Bwhatsapp) handleImageMessage(msg *events.Message) { Account: b.Account, Protocol: b.Protocol, Extra: make(map[string][]interface{}), - ID: msg.Info.ID, + ID: getMessageIdFormat(senderJID, msg.Info.ID), + ParentID: getParentIdFromCtx(ci), } if avatarURL, exists := b.userAvatars[senderJID.String()]; exists { @@ -193,7 +201,8 @@ func (b *Bwhatsapp) handleVideoMessage(msg *events.Message) { Account: b.Account, Protocol: b.Protocol, Extra: make(map[string][]interface{}), - ID: msg.Info.ID, + ID: getMessageIdFormat(senderJID, msg.Info.ID), + ParentID: getParentIdFromCtx(ci), } if avatarURL, exists := b.userAvatars[senderJID.String()]; exists { @@ -251,7 +260,6 @@ func (b *Bwhatsapp) handleAudioMessage(msg *events.Message) { if senderJID == (types.JID{}) && ci.Participant != nil { senderJID = types.NewJID(ci.GetParticipant(), types.DefaultUserServer) } - rmsg := config.Message{ UserID: senderJID.String(), Username: senderName, @@ -259,7 +267,8 @@ func (b *Bwhatsapp) handleAudioMessage(msg *events.Message) { Account: b.Account, Protocol: b.Protocol, Extra: make(map[string][]interface{}), - ID: msg.Info.ID, + ID: getMessageIdFormat(senderJID, msg.Info.ID), + ParentID: getParentIdFromCtx(ci), } if avatarURL, exists := b.userAvatars[senderJID.String()]; exists { @@ -316,7 +325,8 @@ func (b *Bwhatsapp) handleDocumentMessage(msg *events.Message) { Account: b.Account, Protocol: b.Protocol, Extra: make(map[string][]interface{}), - ID: msg.Info.ID, + ID: getMessageIdFormat(senderJID, msg.Info.ID), + ParentID: getParentIdFromCtx(ci), } if avatarURL, exists := b.userAvatars[senderJID.String()]; exists { |