Skip to content

Commit

Permalink
Adapt to Rust SDK api changes introduced in matrix-org/matrix-rust-sd…
Browse files Browse the repository at this point in the history
  • Loading branch information
bnjbvr committed Jun 12, 2024
1 parent fecb025 commit d0f10b2
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions internal/api/rust/rust.go
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,18 @@ func (c *RustClient) ensureListening(t ct.TestLike, roomID string) {
c.logToFile(t, "[%s]_______ APPEND %+v\n", c.userID, ev)
newEvents = append(newEvents, ev)
}
case matrix_sdk_ffi.TimelineChangeReset:
resetItems := d.Reset()
if resetItems == nil {
continue
}
timeline = make([]*api.Event, len(*resetItems))
for i, item := range *resetItems {
ev := timelineItemToEvent(item)
timeline[i] = ev
c.logToFile(t, "[%s]_______ RESET %+v\n", c.userID, ev)
newEvents = append(newEvents, ev)
}
case matrix_sdk_ffi.TimelineChangePushBack: // append but 1 element
pbData := d.PushBack()
if pbData == nil {
Expand Down Expand Up @@ -708,17 +720,10 @@ func (c *RustClient) ensureListening(t ct.TestLike, roomID string) {
c.Logf(t, "[%s]TimelineDiff change: %+v", c.userID, e)
}
}})
events := make([]*api.Event, len(result.Items))
for i := range result.Items {
events[i] = timelineItemToEvent(result.Items[i])
}
c.rooms[roomID].stream = result.ItemsStream
c.rooms[roomID].timeline = events
c.Logf(t, "[%s]AddTimelineListener[%s] result.Items len=%d", c.userID, roomID, len(result.Items))
c.rooms[roomID].stream = result
c.rooms[roomID].timeline = make([]*api.Event, 0)
c.Logf(t, "[%s]AddTimelineListener[%s] set up", c.userID, roomID)
waiter.Finish()
if len(events) > 0 {
c.roomsListener.BroadcastUpdateForRoom(roomID)
}
}

type timelineWaiter struct {
Expand Down

0 comments on commit d0f10b2

Please sign in to comment.