0
0
Fork 0
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:
Jason Volk 2018-04-06 21:08:59 -07:00
parent 904ec2455f
commit cfbe032af5
2 changed files with 23 additions and 0 deletions

View file

@ -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 &);

View file

@ -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)