From 72285b2659a31ebd52c91799c17105d81d996f40 Mon Sep 17 00:00:00 2001 From: kegsay Date: Wed, 19 Apr 2023 15:50:33 +0100 Subject: refactor: update GMSL (#3058) Sister PR to https://github.com/matrix-org/gomatrixserverlib/pull/364 Read this commit by commit to avoid going insane. --- appservice/appservice.go | 5 ++--- appservice/appservice_test.go | 6 +++--- appservice/consumers/roomserver.go | 7 ++++--- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'appservice') diff --git a/appservice/appservice.go b/appservice/appservice.go index 1f6037ee..d94a483e 100644 --- a/appservice/appservice.go +++ b/appservice/appservice.go @@ -20,10 +20,9 @@ import ( "github.com/matrix-org/dendrite/setup/jetstream" "github.com/matrix-org/dendrite/setup/process" + "github.com/matrix-org/gomatrixserverlib/spec" "github.com/sirupsen/logrus" - "github.com/matrix-org/gomatrixserverlib" - appserviceAPI "github.com/matrix-org/dendrite/appservice/api" "github.com/matrix-org/dendrite/appservice/consumers" "github.com/matrix-org/dendrite/appservice/query" @@ -86,7 +85,7 @@ func NewInternalAPI( func generateAppServiceAccount( userAPI userapi.AppserviceUserAPI, as config.ApplicationService, - serverName gomatrixserverlib.ServerName, + serverName spec.ServerName, ) error { var accRes userapi.PerformAccountCreationResponse err := userAPI.PerformAccountCreation(context.Background(), &userapi.PerformAccountCreationRequest{ diff --git a/appservice/appservice_test.go b/appservice/appservice_test.go index 282c6312..878ca566 100644 --- a/appservice/appservice_test.go +++ b/appservice/appservice_test.go @@ -27,7 +27,7 @@ import ( "github.com/matrix-org/dendrite/setup/jetstream" "github.com/matrix-org/dendrite/test" "github.com/matrix-org/dendrite/userapi" - "github.com/matrix-org/gomatrixserverlib" + "github.com/matrix-org/gomatrixserverlib/spec" "github.com/matrix-org/dendrite/test/testrig" ) @@ -326,7 +326,7 @@ func TestRoomserverConsumerOneInvite(t *testing.T) { room := test.NewRoom(t, alice) // Invite Bob - room.CreateAndInsert(t, alice, gomatrixserverlib.MRoomMember, map[string]interface{}{ + room.CreateAndInsert(t, alice, spec.MRoomMember, map[string]interface{}{ "membership": "invite", }, test.WithStateKey(bob.ID)) @@ -345,7 +345,7 @@ func TestRoomserverConsumerOneInvite(t *testing.T) { t.Fatal(err) } for _, ev := range txn.Events { - if ev.Type != gomatrixserverlib.MRoomMember { + if ev.Type != spec.MRoomMember { continue } // Usually we would check the event content for the membership, but since diff --git a/appservice/consumers/roomserver.go b/appservice/consumers/roomserver.go index 586ca33a..8ca8220d 100644 --- a/appservice/consumers/roomserver.go +++ b/appservice/consumers/roomserver.go @@ -26,6 +26,7 @@ import ( "time" "github.com/matrix-org/gomatrixserverlib" + "github.com/matrix-org/gomatrixserverlib/spec" "github.com/nats-io/nats.go" "github.com/matrix-org/dendrite/roomserver/api" @@ -240,7 +241,7 @@ func (s *OutputRoomEventConsumer) appserviceIsInterestedInEvent(ctx context.Cont return true } - if event.Type() == gomatrixserverlib.MRoomMember && event.StateKey() != nil { + if event.Type() == spec.MRoomMember && event.StateKey() != nil { if appservice.IsInterestedInUserID(*event.StateKey()) { return true } @@ -286,7 +287,7 @@ func (s *OutputRoomEventConsumer) appserviceJoinedAtEvent(ctx context.Context, e switch { case ev.StateKey == nil: continue - case ev.Type != gomatrixserverlib.MRoomMember: + case ev.Type != spec.MRoomMember: continue } var membership gomatrixserverlib.MemberContent @@ -294,7 +295,7 @@ func (s *OutputRoomEventConsumer) appserviceJoinedAtEvent(ctx context.Context, e switch { case err != nil: continue - case membership.Membership == gomatrixserverlib.Join: + case membership.Membership == spec.Join: if appservice.IsInterestedInUserID(*ev.StateKey) { return true } -- cgit v1.2.3