Fix handling read receipts

This commit is contained in:
Tulir Asokan 2022-10-05 21:18:48 +03:00
parent bb9ac16cea
commit b826aa1bb7

View file

@ -263,6 +263,15 @@ type Portal struct {
relayUser *User relayUser *User
} }
var (
_ bridge.Portal = (*Portal)(nil)
_ bridge.ReadReceiptHandlingPortal = (*Portal)(nil)
_ bridge.MembershipHandlingPortal = (*Portal)(nil)
_ bridge.MetaHandlingPortal = (*Portal)(nil)
_ bridge.TypingPortal = (*Portal)(nil)
_ bridge.DisappearingPortal = (*Portal)(nil)
)
func (portal *Portal) handleMessageLoopItem(msg PortalMessage) { func (portal *Portal) handleMessageLoopItem(msg PortalMessage) {
if len(portal.MXID) == 0 { if len(portal.MXID) == 0 {
if msg.fake == nil && msg.undecryptable == nil && (msg.evt == nil || !containsSupportedMessage(msg.evt.Message)) { if msg.fake == nil && msg.undecryptable == nil && (msg.evt == nil || !containsSupportedMessage(msg.evt.Message)) {
@ -3563,8 +3572,8 @@ func (portal *Portal) HandleMatrixRedaction(sender *User, evt *event.Event) {
} }
} }
func (portal *Portal) HandleMatrixReadReceipt(sender bridge.User, eventID id.EventID, receiptTimestamp time.Time) { func (portal *Portal) HandleMatrixReadReceipt(sender bridge.User, eventID id.EventID, receipt event.ReadReceipt) {
portal.handleMatrixReadReceipt(sender.(*User), eventID, receiptTimestamp, true) portal.handleMatrixReadReceipt(sender.(*User), eventID, receipt.Timestamp, true)
} }
func (portal *Portal) handleMatrixReadReceipt(sender *User, eventID id.EventID, receiptTimestamp time.Time, isExplicit bool) { func (portal *Portal) handleMatrixReadReceipt(sender *User, eventID id.EventID, receiptTimestamp time.Time, isExplicit bool) {