diff options
author | Matthew Hodgson <matthew@matrix.org> | 2020-09-10 14:39:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-10 14:39:18 +0100 |
commit | 39507bacc3dbfc532e0d69b42957c87f27af4c77 (patch) | |
tree | 7ad845e1b25e03e7b7d7cd2d49278fe843c2ff86 /roomserver/inthttp/client.go | |
parent | 35564dd73c48b16b97cd1a972a9b9bc65ec6d7ef (diff) |
Peeking via MSC2753 (#1370)
Initial implementation of MSC2753, as tested by https://github.com/matrix-org/sytest/pull/944.
Doesn't yet handle unpeeks, peeked EDUs, or history viz changing during a peek - these will follow.
https://github.com/matrix-org/dendrite/pull/1370 has full details.
Diffstat (limited to 'roomserver/inthttp/client.go')
-rw-r--r-- | roomserver/inthttp/client.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/roomserver/inthttp/client.go b/roomserver/inthttp/client.go index b414b0d8..1ff1fc82 100644 --- a/roomserver/inthttp/client.go +++ b/roomserver/inthttp/client.go @@ -26,6 +26,7 @@ const ( // Perform operations RoomserverPerformInvitePath = "/roomserver/performInvite" + RoomserverPerformPeekPath = "/roomserver/performPeek" RoomserverPerformJoinPath = "/roomserver/performJoin" RoomserverPerformLeavePath = "/roomserver/performLeave" RoomserverPerformBackfillPath = "/roomserver/performBackfill" @@ -185,6 +186,23 @@ func (h *httpRoomserverInternalAPI) PerformJoin( } } +func (h *httpRoomserverInternalAPI) PerformPeek( + ctx context.Context, + request *api.PerformPeekRequest, + response *api.PerformPeekResponse, +) { + span, ctx := opentracing.StartSpanFromContext(ctx, "PerformPeek") + defer span.Finish() + + apiURL := h.roomserverURL + RoomserverPerformPeekPath + err := httputil.PostJSON(ctx, span, h.httpClient, apiURL, request, response) + if err != nil { + response.Error = &api.PerformError{ + Msg: fmt.Sprintf("failed to communicate with roomserver: %s", err), + } + } +} + func (h *httpRoomserverInternalAPI) PerformLeave( ctx context.Context, request *api.PerformLeaveRequest, |