Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt the rust.go code to the changes in FFI bindings #137

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions internal/api/rust/rust.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@
if err != nil {
ct.Fatalf(t, "MustGetEvent(rust) %s (%s, %s): %s", c.userID, roomID, eventID, err)
}
ev := eventTimelineItemToEvent(timelineItem)

Check failure on line 310 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests

cannot use timelineItem (variable of type *matrix_sdk_ffi.EventTimelineItem) as matrix_sdk_ffi.EventTimelineItem value in argument to eventTimelineItemToEvent

Check failure on line 310 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests (Rust only, latest) / tests

cannot use timelineItem (variable of type *matrix_sdk_ffi.EventTimelineItem) as matrix_sdk_ffi.EventTimelineItem value in argument to eventTimelineItemToEvent

Check failure on line 310 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests (Rust only, latest) / tests

cannot use timelineItem (variable of type *matrix_sdk_ffi.EventTimelineItem) as matrix_sdk_ffi.EventTimelineItem value in argument to eventTimelineItemToEvent

Check failure on line 310 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests

cannot use timelineItem (variable of type *matrix_sdk_ffi.EventTimelineItem) as matrix_sdk_ffi.EventTimelineItem value in argument to eventTimelineItemToEvent
if ev == nil {
ct.Fatalf(t, "MustGetEvent(rust) %s (%s, %s): found timeline item but failed to convert it to an Event", c.userID, roomID, eventID)
}
Expand Down Expand Up @@ -906,23 +906,20 @@
if ev == nil { // e.g day divider
return nil
}
return eventTimelineItemToEvent(*ev)

Check failure on line 909 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests

cannot use *ev (variable of type *matrix_sdk_ffi.EventTimelineItem) as matrix_sdk_ffi.EventTimelineItem value in argument to eventTimelineItemToEvent

Check failure on line 909 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests (Rust only, latest) / tests

cannot use *ev (variable of type *matrix_sdk_ffi.EventTimelineItem) as matrix_sdk_ffi.EventTimelineItem value in argument to eventTimelineItemToEvent

Check failure on line 909 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests (Rust only, latest) / tests

cannot use *ev (variable of type *matrix_sdk_ffi.EventTimelineItem) as matrix_sdk_ffi.EventTimelineItem value in argument to eventTimelineItemToEvent

Check failure on line 909 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests

cannot use *ev (variable of type *matrix_sdk_ffi.EventTimelineItem) as matrix_sdk_ffi.EventTimelineItem value in argument to eventTimelineItemToEvent
}

func eventTimelineItemToEvent(item *matrix_sdk_ffi.EventTimelineItem) *api.Event {
if item == nil {
return nil
}
func eventTimelineItemToEvent(item matrix_sdk_ffi.EventTimelineItem) *api.Event {
eventID := ""
if item.EventId() != nil {
eventID = *item.EventId()
if item.EventId != nil {

Check failure on line 914 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests (Rust only, latest) / tests

item.EventId undefined (type matrix_sdk_ffi.EventTimelineItem has no field or method EventId)

Check failure on line 914 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests

item.EventId undefined (type matrix_sdk_ffi.EventTimelineItem has no field or method EventId)
eventID = *item.EventId

Check failure on line 915 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests

invalid operation: cannot indirect item.EventId (value of type func() *string)

Check failure on line 915 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests (Rust only, latest) / tests

invalid operation: cannot indirect item.EventId (value of type func() *string)

Check failure on line 915 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests (Rust only, latest) / tests

invalid operation: cannot indirect item.EventId (value of type func() *string)

Check failure on line 915 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests

invalid operation: cannot indirect item.EventId (value of type func() *string)

Check failure on line 915 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests (Rust only, latest) / tests

item.EventId undefined (type matrix_sdk_ffi.EventTimelineItem has no field or method EventId)

Check failure on line 915 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests

item.EventId undefined (type matrix_sdk_ffi.EventTimelineItem has no field or method EventId)
}
complementEvent := api.Event{
ID: eventID,
Sender: item.Sender(),
Sender: item.Sender,

Check failure on line 919 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests

cannot use item.Sender (value of type func() string) as string value in struct literal

Check failure on line 919 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests (Rust only, latest) / tests

cannot use item.Sender (value of type func() string) as string value in struct literal

Check failure on line 919 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests (Rust only, latest) / tests

cannot use item.Sender (value of type func() string) as string value in struct literal

Check failure on line 919 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests

cannot use item.Sender (value of type func() string) as string value in struct literal
}
switch k := item.Content().Kind().(type) {
case matrix_sdk_ffi.TimelineItemContentKindRoomMembership:
switch k := item.Content.(type) {

Check failure on line 921 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests

item.Content (value of type func() *matrix_sdk_ffi.TimelineItemContent) is not an interface

Check failure on line 921 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests (Rust only, latest) / tests

item.Content (value of type func() *matrix_sdk_ffi.TimelineItemContent) is not an interface

Check failure on line 921 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests (Rust only, latest) / tests

item.Content (value of type func() *matrix_sdk_ffi.TimelineItemContent) is not an interface

Check failure on line 921 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests

item.Content (value of type func() *matrix_sdk_ffi.TimelineItemContent) is not an interface
case matrix_sdk_ffi.TimelineItemContentRoomMembership:

Check failure on line 922 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests

undefined: matrix_sdk_ffi.TimelineItemContentRoomMembership

Check failure on line 922 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests (Rust only, latest) / tests

undefined: matrix_sdk_ffi.TimelineItemContentRoomMembership

Check failure on line 922 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests (Rust only, latest) / tests

undefined: matrix_sdk_ffi.TimelineItemContentRoomMembership

Check failure on line 922 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests

undefined: matrix_sdk_ffi.TimelineItemContentRoomMembership
complementEvent.Target = k.UserId
change := *k.Change
switch change {
Expand All @@ -949,16 +946,16 @@
default:
fmt.Printf("%s unhandled membership %d\n", k.UserId, change)
}
case matrix_sdk_ffi.TimelineItemContentKindUnableToDecrypt:
case matrix_sdk_ffi.TimelineItemContentUnableToDecrypt:

Check failure on line 949 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests

undefined: matrix_sdk_ffi.TimelineItemContentUnableToDecrypt

Check failure on line 949 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests (Rust only, latest) / tests

undefined: matrix_sdk_ffi.TimelineItemContentUnableToDecrypt

Check failure on line 949 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests (Rust only, latest) / tests

undefined: matrix_sdk_ffi.TimelineItemContentUnableToDecrypt

Check failure on line 949 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests

undefined: matrix_sdk_ffi.TimelineItemContentUnableToDecrypt
complementEvent.FailedToDecrypt = true
}

content := item.Content()
content := item.Content
if content != nil {
msg := content.AsMessage()
if msg != nil {
msgg := *msg
complementEvent.Text = msgg.Body()
switch msg := content.(type) {

Check failure on line 955 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests

content (variable of type func() *matrix_sdk_ffi.TimelineItemContent) is not an interface

Check failure on line 955 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests (Rust only, latest) / tests

content (variable of type func() *matrix_sdk_ffi.TimelineItemContent) is not an interface

Check failure on line 955 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests (Rust only, latest) / tests

content (variable of type func() *matrix_sdk_ffi.TimelineItemContent) is not an interface

Check failure on line 955 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests

content (variable of type func() *matrix_sdk_ffi.TimelineItemContent) is not an interface
case matrix_sdk_ffi.TimelineItemContentMessage:

Check failure on line 956 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests

undefined: matrix_sdk_ffi.TimelineItemContentMessage

Check failure on line 956 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests (Rust only, latest) / tests

undefined: matrix_sdk_ffi.TimelineItemContentMessage

Check failure on line 956 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests (Rust only, latest) / tests

undefined: matrix_sdk_ffi.TimelineItemContentMessage

Check failure on line 956 in internal/api/rust/rust.go

View workflow job for this annotation

GitHub Actions / Tests

undefined: matrix_sdk_ffi.TimelineItemContentMessage

complementEvent.Text = msg.Content.Body
}
}
return &complementEvent
Expand Down
Loading