mirror of
https://github.com/matrix-construct/construct
synced 2024-12-27 07:54:05 +01:00
ircd:Ⓜ️ Add a membership string size constant.
This commit is contained in:
parent
425385265a
commit
80fb8699a1
7 changed files with 14 additions and 9 deletions
|
@ -11,6 +11,11 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#define HAVE_IRCD_M_ROOM_MEMBERS_H
|
#define HAVE_IRCD_M_ROOM_MEMBERS_H
|
||||||
|
|
||||||
|
namespace ircd::m
|
||||||
|
{
|
||||||
|
constexpr size_t MEMBERSHIP_MAX_SIZE {16};
|
||||||
|
}
|
||||||
|
|
||||||
/// Interface to the members of a room.
|
/// Interface to the members of a room.
|
||||||
///
|
///
|
||||||
/// This interface focuses specifically on room membership and its routines
|
/// This interface focuses specifically on room membership and its routines
|
||||||
|
|
|
@ -39,13 +39,13 @@ post__forget(client &client,
|
||||||
string_view{room_id}
|
string_view{room_id}
|
||||||
};
|
};
|
||||||
|
|
||||||
char room_membuf[32];
|
char room_membuf[m::MEMBERSHIP_MAX_SIZE];
|
||||||
const string_view &room_membership
|
const string_view &room_membership
|
||||||
{
|
{
|
||||||
room.membership(room_membuf, request.user_id)
|
room.membership(room_membuf, request.user_id)
|
||||||
};
|
};
|
||||||
|
|
||||||
char user_membuf[32];
|
char user_membuf[m::MEMBERSHIP_MAX_SIZE];
|
||||||
string_view user_membership;
|
string_view user_membership;
|
||||||
m::get(std::nothrow, event_idx, "content", [&user_membuf, &user_membership]
|
m::get(std::nothrow, event_idx, "content", [&user_membuf, &user_membership]
|
||||||
(const json::object &content)
|
(const json::object &content)
|
||||||
|
|
|
@ -90,7 +90,7 @@ get__initialsync_local(client &client,
|
||||||
const m::user &user,
|
const m::user &user,
|
||||||
json::stack::object &out)
|
json::stack::object &out)
|
||||||
{
|
{
|
||||||
char membership_buf[32];
|
char membership_buf[m::MEMBERSHIP_MAX_SIZE];
|
||||||
json::stack::member
|
json::stack::member
|
||||||
{
|
{
|
||||||
out, "membership", room.membership(membership_buf, request.user_id)
|
out, "membership", room.membership(membership_buf, request.user_id)
|
||||||
|
|
|
@ -53,7 +53,7 @@ ircd::m::sync::rooms_linear(data &data)
|
||||||
data.room, &room
|
data.room, &room
|
||||||
};
|
};
|
||||||
|
|
||||||
char membuf[32];
|
char membuf[MEMBERSHIP_MAX_SIZE];
|
||||||
const string_view &membership
|
const string_view &membership
|
||||||
{
|
{
|
||||||
data.room?
|
data.room?
|
||||||
|
@ -196,7 +196,7 @@ ircd::m::sync::_rooms_polylog(data &data,
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(RB_DEBUG)
|
#if defined(RB_DEBUG)
|
||||||
thread_local char tmbuf[32];
|
thread_local char tmbuf[MEMBERSHIP_MAX_SIZE];
|
||||||
if(data.stats && rooms.stats_debug) log::debug
|
if(data.stats && rooms.stats_debug) log::debug
|
||||||
{
|
{
|
||||||
log, "polylog %s %s %s in %s",
|
log, "polylog %s %s %s in %s",
|
||||||
|
|
|
@ -88,7 +88,7 @@ ircd::m::sync::room_account_data_linear_events(data &data,
|
||||||
lstrip(json::get<"type"_>(event), type.first)
|
lstrip(json::get<"type"_>(event), type.first)
|
||||||
};
|
};
|
||||||
|
|
||||||
char membuf[32];
|
char membuf[MEMBERSHIP_MAX_SIZE];
|
||||||
const auto membership
|
const auto membership
|
||||||
{
|
{
|
||||||
room.membership(membuf, data.user)
|
room.membership(membuf, data.user)
|
||||||
|
@ -150,7 +150,7 @@ ircd::m::sync::room_account_data_linear_tags(data &data,
|
||||||
lstrip(json::get<"type"_>(event), type.first)
|
lstrip(json::get<"type"_>(event), type.first)
|
||||||
};
|
};
|
||||||
|
|
||||||
char membuf[32];
|
char membuf[MEMBERSHIP_MAX_SIZE];
|
||||||
const auto membership
|
const auto membership
|
||||||
{
|
{
|
||||||
room.membership(membuf, data.user)
|
room.membership(membuf, data.user)
|
||||||
|
|
|
@ -72,7 +72,7 @@ get__make_leave(client &client,
|
||||||
room_id
|
room_id
|
||||||
};
|
};
|
||||||
|
|
||||||
char membuf[32];
|
char membuf[m::MEMBERSHIP_MAX_SIZE];
|
||||||
const string_view membership
|
const string_view membership
|
||||||
{
|
{
|
||||||
room.membership(membuf, user_id)
|
room.membership(membuf, user_id)
|
||||||
|
|
|
@ -22,7 +22,7 @@ _visible_(const m::event &event,
|
||||||
const m::room &room,
|
const m::room &room,
|
||||||
const string_view &history_visibility)
|
const string_view &history_visibility)
|
||||||
{
|
{
|
||||||
char membership_buf[32];
|
char membership_buf[m::MEMBERSHIP_MAX_SIZE];
|
||||||
string_view membership
|
string_view membership
|
||||||
{
|
{
|
||||||
room.membership(membership_buf, user_id)
|
room.membership(membership_buf, user_id)
|
||||||
|
|
Loading…
Reference in a new issue