From b497ce35dac9f334e078207c3c409f71e9821d27 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sun, 8 Apr 2018 11:28:40 -0700 Subject: [PATCH] modules/console: Add fed event_auth command. --- modules/console.cc | 47 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/modules/console.cc b/modules/console.cc index 4da125f0b..dbca71fb4 100644 --- a/modules/console.cc +++ b/modules/console.cc @@ -2632,6 +2632,53 @@ console_cmd__fed__event(opt &out, const string_view &line) return true; } +bool +console_cmd__fed__event_auth(opt &out, const string_view &line) +{ + const params param{line, " ", + { + "room_id", "event_id", "remote" + }}; + + const auto room_id + { + m::room_id(param.at(0)) + }; + + const m::event::id &event_id + { + param.at(1) + }; + + const net::hostport remote + { + param.at(2, event_id.host()) + }; + + m::v1::event_auth::opts opts; + opts.remote = remote; + const unique_buffer buf + { + 16_KiB + }; + + m::v1::event_auth request + { + room_id, event_id, buf, std::move(opts) + }; + + request.wait(out.timeout); + request.get(); + + const json::object &response + { + request + }; + + std::cout << string_view{response} << std::endl; + return true; +} + bool console_cmd__fed__query__profile(opt &out, const string_view &line) {