From 500cb0cd7c3a0f8413c55a6be4132025a4bb2bd1 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 23 Jan 2021 18:09:58 +0200 Subject: [PATCH] Improve logging when fetching backfill messages --- portal.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/portal.go b/portal.go index f092212..e0369e8 100644 --- a/portal.go +++ b/portal.go @@ -711,13 +711,14 @@ func (portal *Portal) BackfillHistory(user *User, lastMessageTime uint64) error lastMessageFromMe := lastMessage.Sender == user.JID portal.log.Infoln("Backfilling history since", lastMessageID, "for", user.MXID) for len(lastMessageID) > 0 { - portal.log.Debugln("Backfilling history: 50 messages after", lastMessageID) + portal.log.Debugln("Fetching 50 messages of history after", lastMessageID) resp, err := user.Conn.LoadMessagesAfter(portal.Key.JID, lastMessageID, lastMessageFromMe, 50) if err != nil { return err } messages, ok := resp.Content.([]interface{}) if !ok || len(messages) == 0 { + portal.log.Debugfln("Didn't get more messages to backfill (resp.Content is %T)", resp.Content) break } @@ -859,7 +860,7 @@ func (portal *Portal) handleHistory(user *User, messages []interface{}) { continue } data := whatsapp.ParseProtoMessage(message) - if data == nil { + if data == nil || data == whatsapp.ErrMessageTypeNotImplemented { st := message.GetMessageStubType() // Ignore some types that are known to fail if st == waProto.WebMessageInfo_CALL_MISSED_VOICE || st == waProto.WebMessageInfo_CALL_MISSED_VIDEO ||