mirror of
https://github.com/matrix-construct/construct
synced 2024-09-27 11:18:51 +02:00
modules/m_bridge: Add room alias match to picker.
This commit is contained in:
parent
2498b7cd00
commit
506d954fb3
1 changed files with 22 additions and 1 deletions
|
@ -386,6 +386,7 @@ catch(const std::exception &e)
|
||||||
|
|
||||||
namespace ircd::m::bridge
|
namespace ircd::m::bridge
|
||||||
{
|
{
|
||||||
|
static bool pick_alias(const config &, const event::idx &, const event &, const json::array &, const m::room::alias &);
|
||||||
static bool pick_alias(const config &, const event::idx &, const event &, const room &, const json::array &);
|
static bool pick_alias(const config &, const event::idx &, const event &, const room &, const json::array &);
|
||||||
static bool pick_room(const config &, const event::idx &, const event &, const room &, const json::array &);
|
static bool pick_room(const config &, const event::idx &, const event &, const room &, const json::array &);
|
||||||
static bool pick_user(const config &, const event::idx &, const event &, const json::array &, const m::user::id &);
|
static bool pick_user(const config &, const event::idx &, const event &, const json::array &, const m::user::id &);
|
||||||
|
@ -591,6 +592,25 @@ ircd::m::bridge::pick_alias(const config &config,
|
||||||
const event &event,
|
const event &event,
|
||||||
const room &room,
|
const room &room,
|
||||||
const json::array &namespaces)
|
const json::array &namespaces)
|
||||||
|
{
|
||||||
|
const m::room::aliases aliases
|
||||||
|
{
|
||||||
|
room
|
||||||
|
};
|
||||||
|
|
||||||
|
return !aliases.for_each(my_host(), [&]
|
||||||
|
(const room::alias &alias)
|
||||||
|
{
|
||||||
|
return !pick_alias(config, event_idx, event, namespaces, alias);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
ircd::m::bridge::pick_alias(const config &config,
|
||||||
|
const event::idx &event_idx,
|
||||||
|
const event &event,
|
||||||
|
const json::array &namespaces,
|
||||||
|
const m::room::alias &room_alias)
|
||||||
{
|
{
|
||||||
for(const json::object object : namespaces)
|
for(const json::object object : namespaces)
|
||||||
{
|
{
|
||||||
|
@ -604,7 +624,8 @@ ircd::m::bridge::pick_alias(const config &config,
|
||||||
json::get<"regex"_>(ns)
|
json::get<"regex"_>(ns)
|
||||||
};
|
};
|
||||||
|
|
||||||
//TODO: XXX
|
if(match(room_alias))
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue