func SendJoinRequestsHandler(s *Server, w http.ResponseWriter, req *http.Request) {
	fedReq, errResp := gomatrixserverlib.VerifyHTTPRequest(
		req, time.Now(), gomatrixserverlib.ServerName(s.ServerName), s.keyRing,
	)
	if fedReq == nil {
		w.WriteHeader(errResp.Code)
		b, _ := json.Marshal(errResp.JSON)
		w.Write(b)
		return
	}
	vars := mux.Vars(req)
	roomID := vars["roomID"]

	room, ok := s.rooms[roomID]
	if !ok {
		w.WriteHeader(404)
		w.Write([]byte("complement: HandleMakeSendJoinRequests send_join unexpected room ID: " + roomID))
		return
	}
	event, err := gomatrixserverlib.NewEventFromUntrustedJSON(fedReq.Content(), room.Version)
	if err != nil {
		w.WriteHeader(500)
		w.Write([]byte("complement: HandleMakeSendJoinRequests send_join cannot parse event JSON: " + err.Error()))
	}
	// insert the join event into the room state
	room.AddEvent(event)

	// return current state and auth chain
	b, err := json.Marshal(gomatrixserverlib.RespSendJoin{
		AuthEvents:  room.AuthChain(),
		StateEvents: room.AllCurrentState(),
		Origin:      gomatrixserverlib.ServerName(s.ServerName),
	})
	if err != nil {
		w.WriteHeader(500)
		w.Write([]byte("complement: HandleMakeSendJoinRequests send_join cannot marshal RespSendJoin: " + err.Error()))
	}
	w.WriteHeader(200)
	w.Write(b)
}
// SendJoinRequestsHandler is the http.Handler implementation for the send_join part of
// HandleMakeSendJoinRequests.
SendJoinRequestsHandler is the http.Handler implementation for the send_join part of
HandleMakeSendJoinRequests.
// SendJoinRequestsHandler is the http . Handler implementation for the send_join part of // HandleMakeSendJoinRequests .
func SendJoinRequestsHandler(s *Server, w http.ResponseWriter, req *http.Request) {
	fedReq, errResp := gomatrixserverlib.VerifyHTTPRequest(
		req, time.Now(), gomatrixserverlib.ServerName(s.ServerName), s.keyRing,
	)
	if fedReq == nil {
		w.WriteHeader(errResp.Code)
		b, _ := json.Marshal(errResp.JSON)
		w.Write(b)
		return
	}
	vars := mux.Vars(req)
	roomID := vars["roomID"]
	room, ok := s.rooms[roomID]
	if !ok {
		w.WriteHeader(404)
		w.Write([]byte("complement: HandleMakeSendJoinRequests send_join unexpected room ID: " + roomID))
		return
	}
	event, err := gomatrixserverlib.NewEventFromUntrustedJSON(fedReq.Content(), room.Version)
	if err != nil {
		w.WriteHeader(500)
		w.Write([]byte("complement: HandleMakeSendJoinRequests send_join cannot parse event JSON: " + err.Error()))
	}
	room.AddEvent(event)
	b, err := json.Marshal(gomatrixserverlib.RespSendJoin{
		AuthEvents:  room.AuthChain(),
		StateEvents: room.AllCurrentState(),
		Origin:      gomatrixserverlib.ServerName(s.ServerName),
	})
	if err != nil {
		w.WriteHeader(500)
		w.Write([]byte("complement: HandleMakeSendJoinRequests send_join cannot marshal RespSendJoin: " + err.Error()))
	}
	w.WriteHeader(200)
	w.Write(b)
}
func SendJoinRequestsHandler ( s * Server , w http . ResponseWriter , req * http . Request ) { fedReq , errResp := gomatrixserverlib . VerifyHTTPRequest ( req , time . Now ( ) , gomatrixserverlib . ServerName ( s . ServerName ) , s . keyRing , ) if fedReq == nil { w . WriteHeader ( errResp . Code ) b , _ := json . Marshal ( errResp . JSON ) w . Write ( b ) return } vars := mux . Vars ( req ) roomID := vars [ " " ] room , ok := s . rooms [ roomID ] if ! ok { w . WriteHeader ( 404 ) w . Write ( [ ] byte ( " " + roomID ) ) return } event , err := gomatrixserverlib . NewEventFromUntrustedJSON ( fedReq . Content ( ) , room . Version ) if err != nil { w . WriteHeader ( 500 ) w . Write ( [ ] byte ( " " + err . Error ( ) ) ) } room . AddEvent ( event ) b , err := json . Marshal ( gomatrixserverlib . RespSendJoin { AuthEvents : room . AuthChain ( ) , StateEvents : room . AllCurrentState ( ) , Origin : gomatrixserverlib . ServerName ( s . ServerName ) , } ) if err != nil { w . WriteHeader ( 500 ) w . Write ( [ ] byte ( " " + err . Error ( ) ) ) } w . WriteHeader ( 200 ) w . Write ( b ) }
SendJoinRequestsHandler is the http.Handler implementation for the send_join part of
HandleMakeSendJoinRequests.
SendJoinRequestsHandler is the http . Handler implementation for the send_join part of HandleMakeSendJoinRequests .
// insert the join event into the room state // return current state and auth chain