0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 07:23:53 +01:00

ircd:Ⓜ️ Add state_filter w/ related m::name strings.

This commit is contained in:
Jason Volk 2019-03-31 13:25:00 -07:00
parent a3ca9a986b
commit 6644161140
4 changed files with 41 additions and 1 deletions

View file

@ -17,6 +17,7 @@ namespace ircd::m
struct room_filter;
struct event_filter;
struct room_event_filter;
struct state_filter;
bool match(const event_filter &, const event &);
bool match(const room_event_filter &, const event &);
@ -59,13 +60,35 @@ struct ircd::m::room_event_filter
using super_type::operator=;
};
/// "StateFilter"
struct ircd::m::state_filter
:json::tuple
<
json::property<name::limit, long>,
json::property<name::types, json::array>,
json::property<name::rooms, json::array>,
json::property<name::senders, json::array>,
json::property<name::not_types, json::array>,
json::property<name::not_rooms, json::array>,
json::property<name::not_senders, json::array>,
json::property<name::contains_url, bool>,
json::property<name::lazy_load_members, bool>,
json::property<name::include_redundant_members, bool>
>
{
using super_type::tuple;
state_filter(const mutable_buffer &, const json::members &);
state_filter() = default;
using super_type::operator=;
};
/// 5.1 "RoomFilter"
struct ircd::m::room_filter
:json::tuple
<
json::property<name::rooms, json::array>,
json::property<name::not_rooms, json::array>,
json::property<name::state, room_event_filter>,
json::property<name::state, state_filter>,
json::property<name::timeline, room_event_filter>,
json::property<name::ephemeral, room_event_filter>,
json::property<name::account_data, room_event_filter>,

View file

@ -93,6 +93,8 @@ struct ircd::m::name
static constexpr const char *const not_senders {"not_senders"};
static constexpr const char *const limit {"limit"};
static constexpr const char *const contains_url {"contains_url"};
static constexpr const char *const lazy_load_members {"lazy_load_members"};
static constexpr const char *const include_redundant_members {"include_redundant_members"};
static constexpr const char *const edu_type {"edu_type"};

View file

@ -2429,6 +2429,19 @@ ircd::m::room_filter::room_filter(const mutable_buffer &buf,
{
}
//
// state_filter
//
ircd::m::state_filter::state_filter(const mutable_buffer &buf,
const json::members &members)
:super_type::tuple
{
json::stringify(mutable_buffer{buf}, members)
}
{
}
//
// room_event_filter
//

View file

@ -72,6 +72,8 @@ constexpr const char *const ircd::m::name::senders;
constexpr const char *const ircd::m::name::not_senders;
constexpr const char *const ircd::m::name::limit;
constexpr const char *const ircd::m::name::contains_url;
constexpr const char *const ircd::m::name::lazy_load_members;
constexpr const char *const ircd::m::name::include_redundant_members;
constexpr const char *const ircd::m::name::edu_type;