diff --git a/backfillqueue.go b/backfillqueue.go index b63ca134..be08851c 100644 --- a/backfillqueue.go +++ b/backfillqueue.go @@ -71,25 +71,14 @@ func (user *User) HandleBackfillRequestsLoop(backfillTypes []database.BackfillTy req := user.BackfillQueue.GetNextBackfill(user.MXID, backfillTypes, waitForBackfillTypes, reCheckChannel) user.log.Infofln("Handling backfill request %s", req) - conv := user.bridge.DB.HistorySync.GetConversation(user.MXID, *req.Portal) + conv := user.bridge.DB.HistorySync.GetConversation(user.MXID, req.PortalGUID) if conv == nil { - user.log.Debugfln("Could not find history sync conversation data for %s", req.Portal.String()) + user.log.Debugfln("Could not find history sync conversation data for %s", req.PortalGUID) req.MarkDone() continue } portal := user.GetPortalByJID(conv.PortalKey.JID) - // Update the client store with basic chat settings. - if conv.MuteEndTime.After(time.Now()) { - user.Client.Store.ChatSettings.PutMutedUntil(conv.PortalKey.JID, conv.MuteEndTime) - } - if conv.Archived { - user.Client.Store.ChatSettings.PutArchived(conv.PortalKey.JID, true) - } - if conv.Pinned > 0 { - user.Client.Store.ChatSettings.PutPinned(conv.PortalKey.JID, true) - } - if conv.EphemeralExpiration != nil && portal.ExpirationTime != *conv.EphemeralExpiration { portal.ExpirationTime = *conv.EphemeralExpiration portal.Update(nil) diff --git a/config/bridge.go b/config/bridge.go index b40a1639..d4895d6d 100644 --- a/config/bridge.go +++ b/config/bridge.go @@ -99,7 +99,7 @@ type BridgeConfig struct { } func (bc BridgeConfig) GetResendBridgeInfo() bool { - return false + return true } func (bc BridgeConfig) GetManagementRoomTexts() bridgeconfig.ManagementRoomTexts { diff --git a/main.go b/main.go index e4c31c1c..476ee165 100644 --- a/main.go +++ b/main.go @@ -479,11 +479,12 @@ func (br *IMBridge) Start() { br.ZLog.Fatal().Err(err).Msg("Error getting chats from database") } - chatInfos := make([]ChatInfo, len(chats)) + chatInfos := make([]*imessage.ChatInfo, len(chats)) for i, chat := range chats { - chatInfos[i] = ChatInfo{ - GUID: chat.ChatGUID, - ThreadID: chat.ThreadID, + chatInfos[i], err = br.IM.GetChatInfo(chat.ChatGUID, chat.ThreadID) + if err != nil { + // TODO do something intelligent here + br.ZLog.Fatal().Err(err).Msg("Error getting chat info from database") } } @@ -504,11 +505,13 @@ func (br *IMBridge) Start() { // Create all of the portals locally portals := []*Portal{} txn, err := br.DB.Begin() - for guid, roomID := range resp { + for guid, roomInfo := range resp { portal := br.GetPortalByGUID(guid) - portal.MXID = roomID + portal.MXID = roomInfo.RoomID portal.Update(txn) portals = append(portals, portal) + // Add backfill for this user + // use roomInfo.EarliestBridgedTimestamp } if err = txn.Commit(); err != nil { // TODO do something intelligent here diff --git a/user.go b/user.go index 336a5588..f9b8f0e3 100644 --- a/user.go +++ b/user.go @@ -48,7 +48,7 @@ type User struct { spaceMembershipChecked bool - BackfillQueue *BackfillQueue + BackfillQueue *BackfillQueue } var _ bridge.User = (*User)(nil)