Rework MatrixFilterRules in Vala

This commit is contained in:
Gergely Polonkai 2016-02-19 09:34:25 +01:00
parent e35cd53d79
commit 132ea9c426
4 changed files with 185 additions and 782 deletions

View File

@ -124,11 +124,6 @@ namespace Matrix {
throws Matrix.Error;
}
[CCode (cheader_filename = "matrix-types.h")]
public class FilterRules {
public Json.Node? get_json_node();
}
[CCode (cheader_filename = "utils.h", cname = "_json_node_deep_copy")]
public Json.Node?
_json_node_deep_copy(Json.Node? node);

View File

@ -173,4 +173,189 @@ namespace Matrix {
return builder.get_root();
}
}
/**
* Class to hold filtering rules.
*/
public class FilterRules : JsonCompact {
private List<string>? _types;
private List<string>? _excluded_types;
private List<string>? _senders;
private List<string>? _excluded_senders;
private List<string>? _rooms;
private List<string>? _excluded_rooms;
/**
* The limit of the count of returned events.
*/
public uint limit { get; set; }
/**
* List of message types to include in the filtered result.
*/
public List<string>? types {
get {
return _types;
}
set {
_types = value.copy();
}
default = null;
}
/**
* List of message types to exclude from the filtered
* result. A matching type will be excluded from the result
* even if it is listed in the types to include.
*/
public List<string>? excluded_types {
get {
return _excluded_types;
}
set {
_excluded_types = value.copy();
}
default = null;
}
/**
* List of senders to include in the filtered results.
*/
public List<string>? senders {
get {
return _senders;
}
set {
_senders = value.copy();
}
default = null;
}
/**
* List of senders to exclude from the filtered result. A
* matching sender will be excluded from the result even if it
* is listed in the senders to include.
*/
public List<string>? excluded_senders {
get {
return _excluded_senders;
}
set {
_excluded_senders = value.copy();
}
default = null;
}
/**
* List of rooms to include in the filtered results.
*/
public List<string>? rooms {
get {
return _rooms;
}
set {
_rooms = value.copy();
}
default = null;
}
/**
* List of rooms to exclude from the filtered result. A
* matching room will be excluded from the result even if it
* is listed in the rooms to include.
*/
public List<string>? excluded_rooms {
get {
return _excluded_rooms;
}
set {
_excluded_rooms = value.copy();
}
default = null;
}
/**
* Get the filtering rules as a JSON node.
*/
public override Json.Node?
get_json_node()
throws Matrix.Error
{
var builder = new Json.Builder();
builder.begin_object();
builder.set_member_name("limit");
builder.add_int_value(limit);
if (rooms != null) {
builder.set_member_name("rooms");
builder.begin_array();
foreach (var entry in rooms) {
builder.add_string_value(entry);
}
builder.end_array();
}
if (excluded_rooms != null) {
builder.set_member_name("not_rooms");
builder.begin_array();
foreach (var entry in excluded_rooms) {
builder.add_string_value(entry);
}
builder.end_array();
}
if (senders != null) {
builder.set_member_name("senders");
builder.begin_array();
foreach (var entry in senders) {
builder.add_string_value(entry);
}
builder.end_array();
}
if (excluded_senders != null) {
builder.set_member_name("not_senders");
builder.begin_array();
foreach (var entry in excluded_senders) {
builder.add_string_value(entry);
}
builder.end_array();
}
if (types != null) {
builder.set_member_name("types");
builder.begin_array();
foreach (var entry in types) {
builder.add_string_value(entry);
}
builder.end_array();
}
if (excluded_types != null) {
builder.set_member_name("not_types");
builder.begin_array();
foreach(var entry in types) {
builder.add_string_value(entry);
}
builder.end_array();
}
builder.end_object();
return builder.get_root();
}
}
}

View File

@ -247,732 +247,6 @@ G_DEFINE_QUARK(matrix-error-quark, matrix_error);
* Receipt types of acknowledgment.
*/
/**
* MatrixFilterRules: (ref-func matrix_filter_rules_ref) (unref-func matrix_filter_rules_unref)
*
* An opaque structure to hold filter rules that can be used to filter
* events in the event stream. It is possible to filter by event type,
* room and sender ID.
*/
struct _MatrixFilterRules {
guint limit;
GList *rooms;
GList *excluded_rooms;
GList *senders;
GList *excluded_senders;
GList *types;
GList *excluded_types;
guint refcount;
};
G_DEFINE_BOXED_TYPE(MatrixFilterRules, matrix_filter_rules,
(GBoxedCopyFunc)matrix_filter_rules_ref,
(GBoxedFreeFunc)matrix_filter_rules_unref);
/**
* matrix_filter_rules_new:
*
* Create a new #MatrixFilterRules object with reference count of
* 1.
*
* Returns: (transfer full): a new #MatrixFilterRules
*/
MatrixFilterRules *
matrix_filter_rules_new(void)
{
MatrixFilterRules *rules;
rules = g_new0(MatrixFilterRules, 1);
rules->refcount = 1;
return rules;
}
static void
matrix_filter_rules_free(MatrixFilterRules *rules)
{
g_list_free_full(rules->rooms, g_free);
g_list_free_full(rules->excluded_rooms, g_free);
g_list_free_full(rules->senders, g_free);
g_list_free_full(rules->excluded_senders, g_free);
g_list_free_full(rules->types, g_free);
g_list_free_full(rules->excluded_types, g_free);
g_free(rules);
}
/**
* matrix_filter_rules_ref:
* @rules: a #MatrixFilterRules
*
* Increase reference count of @rules by one.
*
* Returns: (transfer none): the same #MatrixFilterRules
*/
MatrixFilterRules *
matrix_filter_rules_ref(MatrixFilterRules *rules)
{
rules->refcount++;
return rules;
}
/**
* matrix_filter_rules_unref:
* @rules: a #MatrixFilterRules
*
* Decrease reference count of @rules by one. If reference count
* reaches zero, @rules is freed.
*/
void
matrix_filter_rules_unref(MatrixFilterRules *rules)
{
if (--rules->refcount == 0) {
matrix_filter_rules_free(rules);
}
}
/**
* matrix_filter_rules_set_limit:
* @rules: a #MatrixFilterRules
* @limit: (in): the maximum number of events to return.
*
* Set the maximum number of events to return by the filter. If @limit
* is <code>0</code>, no limit will be applied.
*/
void
matrix_filter_rules_set_limit(MatrixFilterRules *rules, guint limit)
{
rules->limit = limit;
}
/**
* matrix_filter_rules_get_limit:
* @rules: a #MatrixFilterRules
*
* Get the current limit set in @rules.
*
* Returns: the limit currently set
*/
guint
matrix_filter_rules_get_limit(MatrixFilterRules *rules)
{
return rules->limit;
}
/**
* matrix_filter_rules_set_senders:
* @rules: a #MatrixFilterRules
* @senders: (in) (element-type utf8) (transfer full) (allow-none):
* a list of Matrix user IDs. Events from these users will
* be included in the filtered event list.If %NULL then all
* senders are included. See
* matrix_filter_rules_add_sender() for wildcarding
* possibilities
*
* Set the list of user IDs to include in the filtered events. @rules
* takes ownership of @senders, so it should not be freed nor modified
* directly after this call.
*/
void
matrix_filter_rules_set_senders(MatrixFilterRules *rules, GList *senders)
{
g_list_free_full(rules->senders, g_free);
rules->senders = senders;
}
/**
* matrix_filter_rules_add_sender:
* @rules: a #MatrixFilterRules
* @sender: (in): a Matrix user ID to add to the included senders
* list. A <code>*</code> can be used as a wildcard to match
* any sequence of characters
*
* Add @sender to the list of user IDs to include in the filtered
* event list. If @sender is already included in the senders list,
* nothing happens.
*/
void
matrix_filter_rules_add_sender(MatrixFilterRules *rules, const gchar *sender)
{
g_return_if_fail(sender != NULL);
if (!g_list_find_custom(rules->senders, sender, (GCompareFunc)g_strcmp0)) {
rules->senders = g_list_prepend(rules->senders, g_strdup(sender));
}
}
/**
* matrix_filter_rules_delete_sender:
* @rules: a #MatrixFilterRules
* @sender: (in): the user ID to remove from the senders list
*
* Remove @sender from the list of user IDs to include in the filtered
* event list.
*/
void
matrix_filter_rules_delete_sender(MatrixFilterRules *rules, const gchar *sender)
{
GList *sender_element;
g_return_if_fail(sender != NULL);
while ((sender_element = g_list_find_custom(rules->senders, sender,
(GCompareFunc)g_strcmp0))) {
rules->senders = g_list_remove_link(rules->senders, sender_element);
g_list_free_full(sender_element, g_free);
}
}
/**
* matrix_filter_rules_get_senders:
* @rules: a #MatrixFilterRules
*
* Get the list of user IDs that will be included in the filtered
* events.
*
* Returns: (element-type utf8) (allow-none) (transfer none): the
* list of user IDs. The returned value is owned by @rules
* and should not be freed nor modified
*/
const GList *
matrix_filter_rules_get_senders(MatrixFilterRules *rules)
{
return rules->senders;
}
/**
* matrix_filter_rules_set_excluded_senders:
* @rules: a #MatrixFilterRules
* @senders: (in) (element-type utf8) (transfer full) (allow-none): a
* list of Matrix user IDs. Events from these users will be
* included in the filtered event list.If %NULL then all
* senders are included. See
* matrix_filter_rules_add_sender() for wildcarding
* possibilities
*
* Set the list of Matrix user IDs to exclude from the filtered
* events. A matching sender will be excluded even if it is listed in
* the senders list (specified by
* e.g. matrix_filter_rules_set_senders()). @rules takes ownership of
* @senders, so it should not be freed nor modified directly after
* this call.
*/
void
matrix_filter_rules_set_excluded_senders(MatrixFilterRules *rules,
GList *senders)
{
g_list_free_full(rules->excluded_senders, g_free);
rules->excluded_senders = senders;
}
/**
* matrix_filter_rules_add_excluded_sender:
* @rules: a #MatrixFilterRules
* @sender: (in): a Matrix user ID to add to the excluded senders
* list. See matrix_filter_rules_add_sender() for wildcarding
* possibilities
*
* Add @sender to the list of user IDs to exclude from the filtered
* event list. If @sender is already in the excluded senders list,
* nothing happens.
*/
void
matrix_filter_rules_add_excluded_sender(MatrixFilterRules *rules,
const gchar *sender)
{
g_return_if_fail(sender != NULL);
if (!g_list_find_custom(rules->excluded_senders, sender,
(GCompareFunc)g_strcmp0)) {
rules->excluded_senders = g_list_prepend(rules->excluded_senders,
g_strdup(sender));
}
}
/**
* matrix_filter_rules_delete_excluded_sender:
* @rules: a #MatrixFilterRules
* @sender: (in): the Matrix user ID to remove from the excluded
* senders list
*
* Remove @sender from the list of user IDs to exclude from the
* filtered event list.
*/
void
matrix_filter_rules_delete_excluded_sender(MatrixFilterRules *rules,
const gchar *sender)
{
GList *sender_element;
g_return_if_fail(sender != NULL);
while ((sender_element = g_list_find_custom(rules->excluded_senders, sender,
(GCompareFunc)g_strcmp0))) {
rules->excluded_senders = g_list_remove_link(rules->excluded_senders,
sender_element);
g_list_free_full(sender_element, g_free);
}
}
/**
* matrix_filter_rules_get_excluded_senders:
* @rules: a #MatrixFilterRules
*
* Get the list of user IDs that will be excluded in the filtered
* events.
*
* Returns: (element-type utf8) (allow-none) (transfer none): the
* list of user IDs to be excluded. The returned value is
* owned by @rules and should not be freed nor modified.
*/
const GList *
matrix_filter_rules_get_excluded_senders(MatrixFilterRules *rules)
{
return rules->excluded_senders;
}
/**
* matrix_filter_rules_set_rooms:
* @rules: a #MatrixFilterRules
* @rooms: (in) (element-type utf8) (transfer full) (allow-none): a
* list of room IDs. Events from these rooms will be included
* in the filtered event list.If %NULL then all rooms are
* included. See matrix_filter_rules_add_sender() for
* wildcarding possibilities
*
* Set the list of room IDs to include in the filtered events. @rules
* takes ownership of @rooms, so it should not be freed nor modified
* directly after this call.
*/
void
matrix_filter_rules_set_rooms(MatrixFilterRules *rules, GList *rooms)
{
g_list_free_full(rules->rooms, g_free);
rules->rooms = rooms;
}
/**
* matrix_filter_rules_add_room:
* @rules: a #MatrixFilterRules
* @room: (in): a room ID to add to the included rooms list. See
* matrix_filter_rules_add_sender() for wildcarding
* possibilities
*
* Add @room to the list of room IDs to include in the filtered
* event list. If @room is already included in the rooms list,
* nothing happens.
*/
void
matrix_filter_rules_add_room(MatrixFilterRules *rules, const gchar *room)
{
g_return_if_fail(room != NULL);
if (!g_list_find_custom(rules->rooms, room, (GCompareFunc)g_strcmp0)) {
rules->rooms = g_list_prepend(rules->rooms, g_strdup(room));
}
}
/**
* matrix_filter_rules_delete_room:
* @rules: a #MatrixFilterRules
* @room: (in): the room ID to remove from the rooms list
*
* Remove @room from the list of room IDs to include in the filtered
* event list.
*/
void
matrix_filter_rules_delete_room(MatrixFilterRules *rules, const gchar *room)
{
GList *room_element;
g_return_if_fail(room != NULL);
while ((room_element = g_list_find_custom(rules->rooms, room,
(GCompareFunc)g_strcmp0))) {
rules->rooms = g_list_remove_link(rules->rooms, room_element);
g_list_free_full(room_element, g_free);
}
}
/**
* matrix_filter_rules_get_rooms:
* @rules: a #MatrixFilterRules
*
* Get the list of room IDs that will be included in the filtered
* events.
*
* Returns: (element-type utf8) (allow-none) (transfer none): the
* list of room IDs. The returned value is owned by @rules
* and should not be freed nor modified
*/
const GList *
matrix_filter_rules_get_rooms(MatrixFilterRules *rules)
{
return rules->rooms;
}
/**
* matrix_filter_rules_set_excluded_rooms:
* @rules: a #MatrixFilterRules
* @rooms: (in) (element-type utf8) (transfer full) (allow-none): a
* list of room IDs. Events from these rooms will be included
* in the filtered event list.If %NULL, then all rooms are
* included. See matrix_filter_rules_add_sender() for
* wildcarding possibilities
*
* Set the list of room IDs to exclude from the filtered events. A
* matching room will be excluded even if it is listed in the rooms
* list (specified by e.g. matrix_filter_rules_set_rooms()). @rules
* takes ownership of @rooms, so it should not be freed nor modified
* directly after this call.
*/
void
matrix_filter_rules_set_excluded_rooms(MatrixFilterRules *rules, GList *rooms)
{
g_list_free_full(rules->excluded_rooms, g_free);
rules->excluded_rooms = rooms;
}
/**
* matrix_filter_rules_add_excluded_room:
* @rules: a #MatrixFilterRules
* @room: (in): a room ID to add to the excluded rooms list. See
* matrix_filter_rules_add_sender() for wildcarding
* possibilities
*
* Add @room to the list of room IDs to exclude from the filtered
* event list. If @room is already in the excluded rooms list, nothing
* happens.
*/
void
matrix_filter_rules_add_excluded_room(MatrixFilterRules *rules,
const gchar *room)
{
g_return_if_fail(room != NULL);
if (!g_list_find_custom(rules->excluded_rooms, room,
(GCompareFunc)g_strcmp0)) {
rules->excluded_rooms = g_list_prepend(rules->excluded_rooms,
g_strdup(room));
}
}
/**
* matrix_filter_rules_delete_excluded_room:
* @rules: a #MatrixFilterRules
* @room: (in): the room ID to remove from the excluded rooms list
*
* Remove @room from the list of room IDs to exclude from the filtered
* event list.
*/
void
matrix_filter_rules_delete_excluded_room(MatrixFilterRules *rules,
const gchar *room)
{
GList *room_element;
g_return_if_fail(room != NULL);
while ((room_element = g_list_find_custom(rules->excluded_rooms, room,
(GCompareFunc)g_strcmp0))) {
rules->excluded_rooms = g_list_remove_link(rules->excluded_rooms,
room_element);
g_list_free_full(room_element, g_free);
}
}
/**
* matrix_filter_rules_get_excluded_rooms:
* @rules: a #MatrixFilterRules
*
* Get the list of room IDs that will be excluded in the filtered
* events.
*
* Returns: (element-type utf8) (allow-none) (transfer none): the
* list of room IDs to be excluded. The returned value is
* owned by @rules and should not be freed nor modified.
*/
const GList *
matrix_filter_rules_get_excluded_rooms(MatrixFilterRules *rules)
{
return rules->excluded_rooms;
}
/**
* matrix_filter_rules_set_types:
* @rules: a #MatrixFilterRules
* @types: (in) (element-type utf8) (transfer full) (allow-none): a
* list of event types to include. If %NULL then all event
* types are included. See
* matrix_filter_rules_add_sender() for wildcarding
* possibilities
*
* Set the list of event types to be included in the filtered events.
*/
void
matrix_filter_rules_set_types(MatrixFilterRules *rules, GList *types)
{
g_list_free_full(rules->types, g_free);
rules->types = types;
}
/**
* matrix_filter_rules_add_type:
* @rules: a #MatrixFilterRules
* @type: (in): an event type to add to the list of included
* events. See matrix_filter_rules_add_sender() for wildcarding
* possibilities
*
* Add @type to the list of event types to include in the filtered
* event list. If @type is already included in the types list, nothing
* happens.
*/
void
matrix_filter_rules_add_type(MatrixFilterRules *rules, const gchar *event_type)
{
g_return_if_fail(event_type != NULL);
if (g_list_find_custom(rules->types, event_type, (GCompareFunc)g_strcmp0)) {
rules->types = g_list_prepend(rules->types, g_strdup(event_type));
}
}
/**
* matrix_filter_rules_delete_type:
* @rules: a #MatrixFilterRules
* @type: (in): a type to remove from the list of included event
* types. See matrix_filter_rules_add_sender() for
* wildcarding possibilities
*
* Remove @type from the list of excluded event type list.
*/
void
matrix_filter_rules_delete_type(MatrixFilterRules *rules,
const gchar *event_type)
{
GList *type_element;
g_return_if_fail(event_type != NULL);
while ((type_element = g_list_find_custom(rules->types, event_type,
(GCompareFunc)g_strcmp0))) {
rules->types = g_list_remove_link(rules->types, type_element);
g_list_free_full(type_element, g_free);
}
}
/**
* matrix_filter_rules_get_types:
* @rules: a #MatrixFilterRules
*
* Get the list of event types that will be included in the filtered
* events.
*
* Returns: (element-type utf8) (allow-none) (transfer none): the
* list of event types. The returned values is owned by
* @rules and should not be freed nor modified
*/
const GList *
matrix_filter_rules_get_types(MatrixFilterRules *rules)
{
return rules->types;
}
/**
* matrix_filter_rules_set_excluded_types:
* @rules: a #MatrixFilterRules
* @types: (in) (element-type utf8) (transfer full) (allow-none): a
* list of event types to exclude. If %NULL then no event
* types are excluded. A matching type will be excluded even
* if it is listed in the included types. See
* matrix_filter_rules_add_sender() for wildcarding
* possibilities
*
* Set the list of event types to be excluded from the filtered
* events. A matching type will be excluded even if it is listed in
* the types list (specified by
* e.g. matrix_filter_rules_set_types()).
*/
void
matrix_filter_rules_set_excluded_types(MatrixFilterRules *rules, GList *types)
{
g_list_free_full(rules->excluded_types, g_free);
rules->excluded_types = types;
}
/**
* matrix_filter_rules_add_excluded_type:
* @rules: a #MatrixFilterRules
* @type: (in): an event type to add to the excluded event type
* list. See matrix_filter_rules_add_sender() for wildcarding
* possibilities
*
* Add @type to the list of excluded event types.
*/
void
matrix_filter_rules_add_excluded_type(MatrixFilterRules *rules,
const gchar *event_type)
{
g_return_if_fail(event_type != NULL);
if (!g_list_find_custom(rules->excluded_types, event_type,
(GCompareFunc)g_strcmp0)) {
rules->excluded_types = g_list_prepend(rules->excluded_types,
g_strdup(event_type));
}
}
/**
* matrix_filter_rules_delete_excluded_type:
* @rules: a #MatrixFilterRules
* @type: (in): the event type to be removed from the excluded types
* list
*
* Remove @type from the list of event types to be excluded from the
* filtered event list.
*/
void
matrix_filter_rules_delete_excluded_type(MatrixFilterRules *rules,
const gchar *event_type)
{
GList *type_element;
g_return_if_fail(event_type != NULL);
while ((type_element = g_list_find_custom(rules->excluded_types, event_type,
(GCompareFunc)g_strcmp0))) {
rules->excluded_types = g_list_remove_link(rules->excluded_types,
type_element);
g_list_free_full(type_element, g_free);
}
}
/**
* matrix_filter_rules_get_excluded_types:
* @rules: a #MatrixFilterRules
*
* Get the list of event types that will be excluded from the filtered
* events.
*
* Returns: (element-type utf8) (allow-none) (transfer none): the
* list of event types. The returned value is owned by
* @rules and should not be freed nor modified
*/
const GList *
matrix_filter_rules_get_excluded_types(MatrixFilterRules *rules)
{
return rules->excluded_types;
}
static void
json_add_string(gchar *str, JsonBuilder *builder)
{
json_builder_add_string_value(builder, str);
}
/**
* matrix_filter_rules_get_json_node:
* @rules: a #MatrixFilterRules
*
* Gets the #JsonNode representation of this filtering ruleset.
*
* Returns: (transfer full): the JSON representation of the filtering
* data as a #JsonNode
*/
JsonNode *
matrix_filter_rules_get_json_node(MatrixFilterRules *rules)
{
JsonBuilder *builder;
JsonNode *node;
builder = json_builder_new();
json_builder_begin_object(builder);
json_builder_set_member_name(builder, "limit");
json_builder_add_int_value(builder, rules->limit);
if (rules->rooms) {
json_builder_set_member_name(builder, "rooms");
json_builder_begin_array(builder);
g_list_foreach(rules->rooms, (GFunc)json_add_string, builder);
json_builder_end_array(builder);
}
if (rules->excluded_rooms) {
json_builder_set_member_name(builder, "not_rooms");
json_builder_begin_array(builder);
g_list_foreach(rules->excluded_rooms, (GFunc)json_add_string, builder);
json_builder_end_array(builder);
}
if (rules->senders) {
json_builder_set_member_name(builder, "senders");
json_builder_begin_array(builder);
g_list_foreach(rules->senders, (GFunc)json_add_string, builder);
json_builder_end_array(builder);
}
if (rules->excluded_senders) {
json_builder_set_member_name(builder, "not_senders");
json_builder_begin_array(builder);
g_list_foreach(rules->excluded_senders,
(GFunc)json_add_string, builder);
json_builder_end_array(builder);
}
if (rules->types) {
json_builder_set_member_name(builder, "types");
json_builder_begin_array(builder);
g_list_foreach(rules->types, (GFunc)json_add_string, builder);
json_builder_end_array(builder);
}
if (rules->excluded_types) {
json_builder_set_member_name(builder, "not_types");
json_builder_begin_array(builder);
g_list_foreach(rules->excluded_types, (GFunc)json_add_string, builder);
json_builder_end_array(builder);
}
json_builder_end_object(builder);
node = json_builder_get_root(builder);
g_object_unref(builder);
return node;
}
/**
* matrix_filter_rules_get_json_data:
* @rules: a #MatrixFilterRules
* @datalen: (out): storage for the the length of the JSON data or
* %NULL
*
* Gets the string representation of these filtering rules, as a JSON
* object.
*
* Returns: (transfer full): the JSON representation of the filtering
* rule data as a string
*/
gchar *
matrix_filter_rules_get_json_data(MatrixFilterRules *rules, gsize *datalen)
{
JsonGenerator *generator;
JsonNode *node = matrix_filter_rules_get_json_node(rules);
gchar *data;
generator = json_generator_new();
json_generator_set_root(generator, node);
json_node_free(node);
data = json_generator_to_data(generator, datalen);
g_object_unref(generator);
return data;
}
/**
* Matrix3PidCredential:
*

View File

@ -129,57 +129,6 @@ typedef enum {
MATRIX_ACCOUNT_KIND_GUEST
} MatrixAccountKind;
typedef struct _MatrixFilterRules MatrixFilterRules;
GType matrix_filter_rules_get_type(void);
#define MATRIX_TYPE_FILTER_RULES (matrix_filter_rules_get_type())
MatrixFilterRules *matrix_filter_rules_new(void);
MatrixFilterRules *matrix_filter_rules_ref(MatrixFilterRules *rules);
void matrix_filter_rules_unref(MatrixFilterRules *rules);
void matrix_filter_rules_set_limit(MatrixFilterRules *rules, guint limit);
guint matrix_filter_rules_get_limit(MatrixFilterRules *rules);
void matrix_filter_rules_set_rooms(MatrixFilterRules *rules, GList *rooms);
void matrix_filter_rules_add_room(MatrixFilterRules *rules, const gchar *room);
void matrix_filter_rules_delete_room(MatrixFilterRules *rules,
const gchar *room);
const GList *matrix_filter_rules_get_rooms(MatrixFilterRules *rules);
void matrix_filter_rules_set_excluded_rooms(MatrixFilterRules *rules,
GList *rooms);
void matrix_filter_rules_add_excluded_room(MatrixFilterRules *rules,
const gchar *room);
void matrix_filter_rules_delete_excluded_room(MatrixFilterRules *rules,
const gchar *room);
const GList *matrix_filter_rules_get_excluded_rooms(MatrixFilterRules *rules);
void matrix_filter_rules_set_senders(MatrixFilterRules *rules, GList *senders);
void matrix_filter_rules_add_sender(MatrixFilterRules *rules,
const gchar *sender);
void matrix_filter_rules_delete_sender(MatrixFilterRules *rules,
const gchar *sender);
const GList *matrix_filter_rules_get_senders(MatrixFilterRules *rules);
void matrix_filter_rules_set_excluded_senders(MatrixFilterRules *rules,
GList *senders);
void matrix_filter_rules_add_excluded_sender(MatrixFilterRules *rules,
const gchar *sender);
void matrix_filter_rules_delete_excluded_sender(MatrixFilterRules *rules,
const gchar *sender);
const GList *matrix_filter_rules_get_excluded_senders(MatrixFilterRules *rules);
void matrix_filter_rules_set_types(MatrixFilterRules *rules, GList *types);
void matrix_filter_rules_add_type(MatrixFilterRules *rules, const gchar *type);
void matrix_filter_rules_delete_type(MatrixFilterRules *rules,
const gchar *type);
const GList *matrix_filter_rules_get_types(MatrixFilterRules *rules);
void matrix_filter_rules_set_excluded_types(MatrixFilterRules *rules,
GList *types);
void matrix_filter_rules_add_excluded_type(MatrixFilterRules *rules,
const gchar *type);
void matrix_filter_rules_delete_excluded_type(MatrixFilterRules *rules,
const gchar *type);
const GList *matrix_filter_rules_get_excluded_types(MatrixFilterRules *rules);
JsonNode *matrix_filter_rules_get_json_node(MatrixFilterRules *rules);
gchar *matrix_filter_rules_get_json_data(MatrixFilterRules *rules,
gsize *datalen);
typedef struct _Matrix3PidCredential Matrix3PidCredential;
GType matrix_3pid_credential_get_type(void);