mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 00:32:35 +01:00
ircd:Ⓜ️ Add room_id(event_idx) to convenience suite.
This commit is contained in:
parent
7861f77015
commit
8d6dfa7cd5
2 changed files with 24 additions and 0 deletions
|
@ -49,9 +49,11 @@ namespace ircd::m
|
|||
string_view display_name(const mutable_buffer &out, const room &);
|
||||
id::user::buf any_user(const room &, const string_view &host, const string_view &memshp = "join");
|
||||
|
||||
id::room room_id(const mutable_buffer &, const event::idx &); // db
|
||||
id::room room_id(const mutable_buffer &, const id::event &); // db
|
||||
id::room room_id(const mutable_buffer &, const id::room_alias &); // db + net
|
||||
id::room room_id(const mutable_buffer &, const string_view &mxid);
|
||||
id::room::buf room_id(const event::idx &); // db
|
||||
id::room::buf room_id(const id::event &); // db
|
||||
id::room::buf room_id(const id::room_alias &); // db + net
|
||||
id::room::buf room_id(const string_view &id_or_alias);
|
||||
|
|
|
@ -363,6 +363,14 @@ ircd::m::room_id(const string_view &mxid)
|
|||
return room_id(buf, mxid);
|
||||
}
|
||||
|
||||
ircd::m::id::room::buf
|
||||
ircd::m::room_id(const event::idx &event_idx)
|
||||
{
|
||||
char buf[m::id::MAX_SIZE + 1];
|
||||
static_assert(sizeof(buf) <= 256);
|
||||
return room_id(buf, event_idx);
|
||||
}
|
||||
|
||||
ircd::m::id::room
|
||||
ircd::m::room_id(const mutable_buffer &out,
|
||||
const string_view &mxid)
|
||||
|
@ -392,6 +400,20 @@ ircd::m::room_id(const mutable_buffer &out,
|
|||
}
|
||||
}
|
||||
|
||||
ircd::m::id::room
|
||||
ircd::m::room_id(const mutable_buffer &out,
|
||||
const event::idx &event_idx)
|
||||
{
|
||||
room::id ret;
|
||||
m::get(event_idx, "room_id", [&out, &ret]
|
||||
(const room::id &room_id)
|
||||
{
|
||||
ret = string_view { data(out), copy(out, room_id) };
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
ircd::m::id::room
|
||||
ircd::m::room_id(const mutable_buffer &out,
|
||||
const id::event &event_id)
|
||||
|
|
Loading…
Reference in a new issue