From 0fa7122d637b54262ea6e9b86ee0cbf39e6c8cdc Mon Sep 17 00:00:00 2001 From: Derek Meer Date: Wed, 1 Aug 2018 20:01:58 -0700 Subject: [PATCH] Added matrix configuration to function args for access to homeserver string --- .../matrix-org/dendrite/appservice/routing/routing.go | 2 +- src/github.com/matrix-org/dendrite/appservice/routing/user.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/appservice/routing/routing.go b/src/github.com/matrix-org/dendrite/appservice/routing/routing.go index 0a379cbf2..d21402653 100644 --- a/src/github.com/matrix-org/dendrite/appservice/routing/routing.go +++ b/src/github.com/matrix-org/dendrite/appservice/routing/routing.go @@ -51,7 +51,7 @@ func Setup( ).Methods(http.MethodGet, http.MethodOptions) appMux.Handle("/user", common.MakeExternalAPI("user", func(req *http.Request) util.JSONResponse { - return URIToUID(req) + return URIToUID(req, cfg) }), ).Methods(http.MethodGet, http.MethodOptions) } diff --git a/src/github.com/matrix-org/dendrite/appservice/routing/user.go b/src/github.com/matrix-org/dendrite/appservice/routing/user.go index 2c167dc55..f01f76b05 100644 --- a/src/github.com/matrix-org/dendrite/appservice/routing/user.go +++ b/src/github.com/matrix-org/dendrite/appservice/routing/user.go @@ -16,8 +16,9 @@ type URIToUIDResponse struct { // URI and turning it into a Matrix ID on the homeserver. // https://matrix.org/docs/spec/application_service/unstable.html#user-ids -func URIToUID(req *http.Request) util.JSONResponse { +func URIToUID(req *http.Request, cfg config.Dendrite) util.JSONResponse { // TODO: Implement + homeserver := cfg.Matrix.ServerName return util.JSONResponse{ Code: http.StatusOK, JSON: nil,