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

Update mautrix #458

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Update mautrix #458

wants to merge 14 commits into from

Conversation

symmmys
Copy link

@symmmys symmmys commented May 5, 2024

Updated all the dependencies to their most recent versions, and then made the necessary changes for the client to run stably. Newly-introduced bugs may be expected at this moment.

ui/commands.go Outdated Show resolved Hide resolved
ui/commands.go Outdated
Comment on lines 370 to 371
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem like the right place to have timeouts

ui/room-view.go Outdated
@@ -754,7 +760,7 @@ func (view *RoomView) SendReaction(eventID id.EventID, reaction string) {
if !view.config.Preferences.DisableEmojis {
reaction = emoji.Sprint(reaction)
}
reaction = variationselector.Add(strings.TrimSpace(reaction))
reaction = strings.TrimSpace(reaction)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this removed? Variation selectors are required

matrix/sync.go Outdated
listeners, exists := s.listeners[evt.Type]
if !exists {
return
}
for _, fn := range listeners {
fn(source, evt)
fn(nil, evt)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing explicit nils to a listener sounds wrong

matrix/sync.go Outdated
Comment on lines 125 to 126
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This timeout also looks wrong

//TODO: symys changed the following to == nil, it was != nil
//requesting review, since this fixed the bug where random rooms showed up under historical,
//but idk if it might have unintended consequences
} else if room.SessionMember == nil && room.SessionMember.Membership != event.MembershipJoin {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a nil pointer dereference

matrix/sync.go Outdated
@@ -204,13 +224,13 @@ func (s *GomuksSyncer) OnSync(callback mautrix.SyncHandler) {
s.globalListeners = append(s.globalListeners, callback)
}

func (s *GomuksSyncer) notifyListeners(source mautrix.EventSource, evt *event.Event) {
func (s *GomuksSyncer) notifyListeners(source event.Source, evt *event.Event) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general the event source doesn't need to be passed to handlers anymore as it can be embedded in the event, but contexts should be used

@n-peugnet
Copy link
Contributor

I don't get how you test this, it is not compiling at all on my end:

# maunium.net/go/gomuks/ui
ui/verification-modal.go:39:14: undefined: crypto.SASData
ui/verification-modal.go:70:17: undefined: crypto.DeviceIdentity
ui/verification-modal.go:88:62: undefined: crypto.DeviceIdentity
ui/verification-modal.go:149:61: undefined: crypto.VerificationMethod
ui/verification-modal.go:153:60: undefined: crypto.DeviceIdentity
ui/verification-modal.go:153:88: undefined: crypto.SASData
ui/crypto-commands.go:52:10: impossible type assertion: cmd.Matrix.Crypto().(*crypto.OlmMachine)
	*"maunium.net/go/mautrix/crypto".OlmMachine does not implement ifc.Crypto (wrong type for method DecryptMegolmEvent)
		have DecryptMegolmEvent(context.Context, *event.Event) (*event.Event, error)
		want DecryptMegolmEvent(*event.Event) (*event.Event, error)
ui/crypto-commands.go:101:38: undefined: crypto.DeviceIdentity
ui/crypto-commands.go:115:45: undefined: crypto.DeviceIdentity
ui/crypto-commands.go:177:51: undefined: crypto.DeviceIdentity
ui/crypto-commands.go:52:10: too many errors
# maunium.net/go/gomuks/matrix
matrix/crypto.go:64:29: undefined: crypto.NewGobStore
matrix/crypto.go:76:106: too many arguments in call to crypto.NewSQLCryptoStore
	have (*sql.DB, string, string, id.DeviceID, []byte, cryptoLogger)
	want (*dbutil.Database, dbutil.DatabaseLogger, string, id.DeviceID, []byte)
matrix/crypto.go:77:18: sqlStore.CreateTables undefined (type *"maunium.net/go/mautrix/crypto".SQLCryptoStore has no field or method CreateTables)
matrix/crypto.go:83:42: cannot use cryptoLogger{…} (value of type cryptoLogger) as *zerolog.Logger value in argument to crypto.NewOlmMachine
matrix/crypto.go:83:79: cannot use c.config.Rooms (variable of type *rooms.RoomCache) as "maunium.net/go/mautrix/crypto".StateStore value in argument to crypto.NewOlmMachine: *rooms.RoomCache does not implement "maunium.net/go/mautrix/crypto".StateStore (wrong type for method FindSharedRooms)
		have FindSharedRooms(id.UserID) ([]id.RoomID)
		want FindSharedRooms(context.Context, id.UserID) ([]id.RoomID, error)
matrix/crypto.go:84:8: crypt.AllowUnverifiedDevices undefined (type *"maunium.net/go/mautrix/crypto".OlmMachine has no field or method AllowUnverifiedDevices)
matrix/crypto.go:85:13: cannot use crypt (variable of type *"maunium.net/go/mautrix/crypto".OlmMachine) as ifc.Crypto value in assignment: *"maunium.net/go/mautrix/crypto".OlmMachine does not implement ifc.Crypto (wrong type for method DecryptMegolmEvent)
		have DecryptMegolmEvent(context.Context, *event.Event) (*event.Event, error)
		want DecryptMegolmEvent(*event.Event) (*event.Event, error)
matrix/crypto.go:94:18: impossible type assertion: c.crypto.(*crypto.OlmMachine)
	*"maunium.net/go/mautrix/crypto".OlmMachine does not implement ifc.Crypto (wrong type for method DecryptMegolmEvent)
		have DecryptMegolmEvent(context.Context, *event.Event) (*event.Event, error)
		want DecryptMegolmEvent(*event.Event) (*event.Event, error)

It seems you didn't update matrix/crypto.go, I had some things to change to make it compile with mautrix v0.14, same for ui/crypto-commands.go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants