From 26a3dec125620d5dea8a78544c776e201bc65ce2 Mon Sep 17 00:00:00 2001 From: Yoni Revah Date: Mon, 11 Mar 2024 22:55:02 -0400 Subject: [PATCH] edge case for read receipts (#201) Co-authored-by: Donovon Simpson <66212896+trek-boldly-go@users.noreply.github.com> --- imessage/bluebubbles/api.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/imessage/bluebubbles/api.go b/imessage/bluebubbles/api.go index fbf5182..721f94c 100644 --- a/imessage/bluebubbles/api.go +++ b/imessage/bluebubbles/api.go @@ -295,7 +295,22 @@ func (bb *blueBubbles) handleNewMessage(rawMessage json.RawMessage) (err error) default: bb.log.Warn().Msg("Incoming message buffer is full") } - + if !message.ReadAt.IsZero() && data.DateRetracted == 0 && data.DateEdited == 0 { + senderGUID := data.Chats[0].GUID + var receipt = imessage.ReadReceipt{ + SenderGUID: senderGUID, + IsFromMe: false, + ChatGUID: message.ChatGUID, + ReadUpTo: message.GUID, + ReadAt: message.ReadAt, + JSONUnixReadAt: message.JSONUnixReadAt, + } + select { + case bb.receiptChan <- &receipt: + default: + bb.log.Warn().Msg("Incoming message buffer is full") + } + } return nil }