0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-16 15:00:51 +01:00

modules/console: Use pretty_detailed() for fed event cmd; minor reorg.

This commit is contained in:
Jason Volk 2020-05-01 09:39:55 -07:00
parent a507785f8f
commit a8b02549db

View file

@ -13952,41 +13952,22 @@ console_cmd__fed__event(opt &out, const string_view &line)
request request
}; };
if(has(op, "raw"))
{
out
<< string_view{response}
<< std::endl;
return true;
}
m::event::id::buf _event_id; m::event::id::buf _event_id;
const m::event event const m::event event
{ {
_event_id, response _event_id, response
}; };
out << pretty(event) << std::endl; if(has(op, "eval"))
try
{ {
if(!verify(event))
out << "- SIGNATURE FAILED" << std::endl;
}
catch(const std::exception &e)
{
out << "- SIGNATURE FAILED: " << e.what() << std::endl;
}
if(!verify_hash(event))
out << "- HASH MISMATCH: " << b64encode_unpadded(hash(event)) << std::endl;
const m::event::conforms conforms
{
event
};
if(!conforms.clean())
out << "- " << conforms << std::endl;
if(has(op, "raw"))
out << string_view{response} << std::endl;
if(!has(op, "eval"))
return true;
m::vm::opts vmopts; m::vm::opts vmopts;
vmopts.fetch_prev = has(op, "prev"); vmopts.fetch_prev = has(op, "prev");
vmopts.fetch_state = false; vmopts.fetch_state = false;
@ -13996,6 +13977,11 @@ console_cmd__fed__event(opt &out, const string_view &line)
event, vmopts event, vmopts
}; };
return true;
}
m::pretty_detailed(out, event, 0UL);
out << std::endl;
return true; return true;
} }