mirror of
https://github.com/matrix-construct/construct
synced 2024-09-29 04:08:54 +02:00
modules/console: Add peer error filter option for origins random cmd.
This commit is contained in:
parent
18b591c298
commit
d7ca00c4a1
1 changed files with 16 additions and 2 deletions
|
@ -4685,7 +4685,7 @@ console_cmd__room__origins__random(opt &out, const string_view &line)
|
||||||
|
|
||||||
const params param{line, " ",
|
const params param{line, " ",
|
||||||
{
|
{
|
||||||
"room_id"
|
"room_id", "[noerror]"
|
||||||
}};
|
}};
|
||||||
|
|
||||||
const auto &room_id
|
const auto &room_id
|
||||||
|
@ -4693,15 +4693,29 @@ console_cmd__room__origins__random(opt &out, const string_view &line)
|
||||||
m::room_id(param.at("room_id"))
|
m::room_id(param.at("room_id"))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const bool noerror
|
||||||
|
{
|
||||||
|
param.at<bool>("[noerror]", false)
|
||||||
|
};
|
||||||
|
|
||||||
const m::room room
|
const m::room room
|
||||||
{
|
{
|
||||||
room_id
|
room_id
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const auto ok{[&noerror]
|
||||||
|
(const string_view &origin)
|
||||||
|
{
|
||||||
|
if(noerror && ircd::server::errmsg(origin))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}};
|
||||||
|
|
||||||
char buf[256];
|
char buf[256];
|
||||||
const string_view origin
|
const string_view origin
|
||||||
{
|
{
|
||||||
random_origin(room, buf, nullptr)
|
random_origin(room, buf, ok)
|
||||||
};
|
};
|
||||||
|
|
||||||
if(!origin)
|
if(!origin)
|
||||||
|
|
Loading…
Reference in a new issue