mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd:Ⓜ️ Add room_id() overload checking sigil to skip resolution.
This commit is contained in:
parent
904ec2455f
commit
cfbe032af5
2 changed files with 23 additions and 0 deletions
|
@ -31,7 +31,9 @@ namespace ircd::m
|
|||
|
||||
// [GET]
|
||||
id::room room_id(const mutable_buffer &, const id::room_alias &);
|
||||
id::room room_id(const mutable_buffer &, const string_view &id_or_alias);
|
||||
id::room::buf room_id(const id::room_alias &);
|
||||
id::room::buf room_id(const string_view &id_or_alias);
|
||||
|
||||
// [GET] Current Event ID and depth suite (non-locking) (one only)
|
||||
std::tuple<int64_t, id::event::buf> top(std::nothrow_t, const id::room &);
|
||||
|
|
21
ircd/m/m.cc
21
ircd/m/m.cc
|
@ -1432,6 +1432,27 @@ ircd::m::room_id(const id::room_alias &room_alias)
|
|||
return room_id(buf, room_alias);
|
||||
}
|
||||
|
||||
ircd::m::id::room::buf
|
||||
ircd::m::room_id(const string_view &room_id_or_alias)
|
||||
{
|
||||
char buf[256];
|
||||
return room_id(buf, room_id_or_alias);
|
||||
}
|
||||
|
||||
ircd::m::id::room
|
||||
ircd::m::room_id(const mutable_buffer &out,
|
||||
const string_view &room_id_or_alias)
|
||||
{
|
||||
switch(m::sigil(room_id_or_alias))
|
||||
{
|
||||
case id::ROOM:
|
||||
return id::room{out, room_id_or_alias};
|
||||
|
||||
default:
|
||||
return room_id(out, id::room_alias{room_id_or_alias});
|
||||
}
|
||||
}
|
||||
|
||||
ircd::m::id::room
|
||||
ircd::m::room_id(const mutable_buffer &out,
|
||||
const id::room_alias &room_alias)
|
||||
|
|
Loading…
Reference in a new issue