mirror of
https://github.com/matrix-construct/construct
synced 2024-06-09 05:29:00 +02:00
ircd:Ⓜ️:rooms: Add proffer rule for partial alias search terms.
This commit is contained in:
parent
b0e60fc3fc
commit
31b67dc646
|
@ -56,8 +56,14 @@ IRCD_MODULE_EXPORT
|
|||
ircd::m::rooms::for_each(const opts &opts,
|
||||
const room::id::closure_bool &closure)
|
||||
{
|
||||
const auto match_alias_prefix{[&opts]
|
||||
(const auto &alias)
|
||||
{
|
||||
return !startswith(alias, opts.search_term);
|
||||
}};
|
||||
|
||||
bool ret{true};
|
||||
const auto proffer{[&opts, &closure, &ret]
|
||||
const auto proffer{[&opts, &closure, &ret, &match_alias_prefix]
|
||||
(const m::room::id &room_id)
|
||||
{
|
||||
if(opts.room_id && !opts.lower_bound)
|
||||
|
@ -94,6 +100,10 @@ ircd::m::rooms::for_each(const opts &opts,
|
|||
if(!join_rule(room(room_id), opts.join_rule))
|
||||
return;
|
||||
|
||||
if(startswith(opts.search_term, m::id::ROOM_ALIAS))
|
||||
if(room::aliases(room_id).for_each(match_alias_prefix))
|
||||
return; // no match
|
||||
|
||||
ret = closure(room_id);
|
||||
}};
|
||||
|
||||
|
|
Loading…
Reference in a new issue