diff --git a/src/github.com/matrix-org/dendrite/clientapi/routing/joinroom.go b/src/github.com/matrix-org/dendrite/clientapi/routing/joinroom.go index 890d6f1a2ff7cb2760bea168ef0c94cb8469e974..73a751acff6e769d4aea0e03a89392675955843b 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/routing/joinroom.go +++ b/src/github.com/matrix-org/dendrite/clientapi/routing/joinroom.go @@ -22,10 +22,10 @@ import ( "github.com/matrix-org/dendrite/clientapi/auth/authtypes" "github.com/matrix-org/dendrite/clientapi/auth/storage/accounts" - "github.com/matrix-org/dendrite/clientapi/events" "github.com/matrix-org/dendrite/clientapi/httputil" "github.com/matrix-org/dendrite/clientapi/jsonerror" "github.com/matrix-org/dendrite/clientapi/producers" + "github.com/matrix-org/dendrite/common" "github.com/matrix-org/dendrite/common/config" "github.com/matrix-org/dendrite/roomserver/api" "github.com/matrix-org/gomatrix" @@ -215,7 +215,7 @@ func (r joinRoomReq) joinRoomUsingServers( } var queryRes api.QueryLatestEventsAndStateResponse - event, err := events.BuildEvent(r.req.Context(), &eb, r.cfg, r.queryAPI, &queryRes) + event, err := common.BuildEvent(r.req.Context(), &eb, r.cfg, r.queryAPI, &queryRes) if err == nil { if err = r.producer.SendEvents(r.req.Context(), []gomatrixserverlib.Event{*event}, r.cfg.Matrix.ServerName); err != nil { return httputil.LogThenError(r.req, err) @@ -227,7 +227,7 @@ func (r joinRoomReq) joinRoomUsingServers( }{roomID}, } } - if err != events.ErrRoomNoExists { + if err != common.ErrRoomNoExists { return httputil.LogThenError(r.req, err) } diff --git a/src/github.com/matrix-org/dendrite/clientapi/routing/membership.go b/src/github.com/matrix-org/dendrite/clientapi/routing/membership.go index fec27ae76deb68eb1dbbe8a39dfb66e1f1d1134a..e94fbde7d88d5fa173d629c8212928cc3690ca4e 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/routing/membership.go +++ b/src/github.com/matrix-org/dendrite/clientapi/routing/membership.go @@ -21,7 +21,6 @@ import ( "github.com/matrix-org/dendrite/clientapi/auth/authtypes" "github.com/matrix-org/dendrite/clientapi/auth/storage/accounts" - "github.com/matrix-org/dendrite/clientapi/events" "github.com/matrix-org/dendrite/clientapi/httputil" "github.com/matrix-org/dendrite/clientapi/jsonerror" "github.com/matrix-org/dendrite/clientapi/producers" @@ -62,7 +61,7 @@ func SendMembership( Code: 400, JSON: jsonerror.NotTrusted(body.IDServer), } - } else if err == events.ErrRoomNoExists { + } else if err == common.ErrRoomNoExists { return util.JSONResponse{ Code: 404, JSON: jsonerror.NotFound(err.Error()), @@ -89,7 +88,7 @@ func SendMembership( Code: 400, JSON: jsonerror.BadJSON(err.Error()), } - } else if err == events.ErrRoomNoExists { + } else if err == common.ErrRoomNoExists { return util.JSONResponse{ Code: 404, JSON: jsonerror.NotFound(err.Error()), @@ -149,7 +148,7 @@ func buildMembershipEvent( return nil, err } - return events.BuildEvent(ctx, &builder, cfg, queryAPI, nil) + return common.BuildEvent(ctx, &builder, cfg, queryAPI, nil) } // loadProfile lookups the profile of a given user from the database and returns diff --git a/src/github.com/matrix-org/dendrite/clientapi/routing/profile.go b/src/github.com/matrix-org/dendrite/clientapi/routing/profile.go index 918292e59b9511ef0f75967ada103bc35aab00d5..da47451fad1bfbacede47c6ba29ac2ccb63cee83 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/routing/profile.go +++ b/src/github.com/matrix-org/dendrite/clientapi/routing/profile.go @@ -20,7 +20,6 @@ import ( "github.com/matrix-org/dendrite/clientapi/auth/authtypes" "github.com/matrix-org/dendrite/clientapi/auth/storage/accounts" - "github.com/matrix-org/dendrite/clientapi/events" "github.com/matrix-org/dendrite/clientapi/httputil" "github.com/matrix-org/dendrite/clientapi/jsonerror" "github.com/matrix-org/dendrite/clientapi/producers" @@ -285,7 +284,7 @@ func buildMembershipEvents( return nil, err } - event, err := events.BuildEvent(ctx, &builder, *cfg, queryAPI, nil) + event, err := common.BuildEvent(ctx, &builder, *cfg, queryAPI, nil) if err != nil { return nil, err } diff --git a/src/github.com/matrix-org/dendrite/clientapi/routing/sendevent.go b/src/github.com/matrix-org/dendrite/clientapi/routing/sendevent.go index d912f10ba55cc5bd7fd912a080a1e9472a1bde7a..dc2f58f6aa6f77a3a99e3c5bc5a68e6ffdb3efa8 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/routing/sendevent.go +++ b/src/github.com/matrix-org/dendrite/clientapi/routing/sendevent.go @@ -18,10 +18,10 @@ import ( "net/http" "github.com/matrix-org/dendrite/clientapi/auth/authtypes" - "github.com/matrix-org/dendrite/clientapi/events" "github.com/matrix-org/dendrite/clientapi/httputil" "github.com/matrix-org/dendrite/clientapi/jsonerror" "github.com/matrix-org/dendrite/clientapi/producers" + "github.com/matrix-org/dendrite/common" "github.com/matrix-org/dendrite/common/config" "github.com/matrix-org/dendrite/roomserver/api" "github.com/matrix-org/gomatrixserverlib" @@ -67,8 +67,8 @@ func SendEvent( } var queryRes api.QueryLatestEventsAndStateResponse - e, err := events.BuildEvent(req.Context(), &builder, cfg, queryAPI, &queryRes) - if err == events.ErrRoomNoExists { + e, err := common.BuildEvent(req.Context(), &builder, cfg, queryAPI, &queryRes) + if err == common.ErrRoomNoExists { return util.JSONResponse{ Code: 404, JSON: jsonerror.NotFound("Room does not exist"), diff --git a/src/github.com/matrix-org/dendrite/clientapi/threepid/invites.go b/src/github.com/matrix-org/dendrite/clientapi/threepid/invites.go index 51c0dd9c9f0b2e2811cb6d719626fb868bddd9c1..8365918294780d4f8f7399d38367a7f8b7e75912 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/threepid/invites.go +++ b/src/github.com/matrix-org/dendrite/clientapi/threepid/invites.go @@ -26,7 +26,6 @@ import ( "github.com/matrix-org/dendrite/clientapi/auth/authtypes" "github.com/matrix-org/dendrite/clientapi/auth/storage/accounts" - "github.com/matrix-org/dendrite/clientapi/events" "github.com/matrix-org/dendrite/clientapi/producers" "github.com/matrix-org/dendrite/common" "github.com/matrix-org/dendrite/common/config" @@ -351,7 +350,7 @@ func emit3PIDInviteEvent( } var queryRes *api.QueryLatestEventsAndStateResponse - event, err := events.BuildEvent(ctx, builder, cfg, queryAPI, queryRes) + event, err := common.BuildEvent(ctx, builder, cfg, queryAPI, queryRes) if err != nil { return err } diff --git a/src/github.com/matrix-org/dendrite/clientapi/events/events.go b/src/github.com/matrix-org/dendrite/common/events.go similarity index 99% rename from src/github.com/matrix-org/dendrite/clientapi/events/events.go rename to src/github.com/matrix-org/dendrite/common/events.go index 23cb5bbc256aa35f93c8bf13181e4a6630b75d3b..cf2df8422d49360edb1e52261604dc12fc05d558 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/events/events.go +++ b/src/github.com/matrix-org/dendrite/common/events.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package events +package common import ( "context"