diff --git a/include/ircd/m/room.h b/include/ircd/m/room.h index 2835f9351..556e73b8d 100644 --- a/include/ircd/m/room.h +++ b/include/ircd/m/room.h @@ -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 top(std::nothrow_t, const id::room &); diff --git a/ircd/m/m.cc b/ircd/m/m.cc index ff18da210..992da22d7 100644 --- a/ircd/m/m.cc +++ b/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)