Rename MatrixAPIRoomFilter to MatrixRoomFilter

This commit is contained in:
Gergely Polonkai 2016-01-25 16:08:41 +01:00
parent 8f5877a2f0
commit e6ddc5193a
3 changed files with 102 additions and 104 deletions

View File

@ -72,20 +72,20 @@ matrix_filter_rules_get_json_node
matrix_filter_rules_get_json_data matrix_filter_rules_get_json_data
<SUBSECTION> <SUBSECTION>
MatrixAPIRoomFilter MatrixRoomFilter
matrix_api_room_filter_new matrix_room_filter_new
matrix_api_room_filter_ref matrix_room_filter_ref
matrix_api_room_filter_unref matrix_room_filter_unref
matrix_api_room_filter_set_include_leave matrix_room_filter_set_include_leave
matrix_api_room_filter_get_include_leave matrix_room_filter_get_include_leave
matrix_api_room_filter_set_ephemeral matrix_room_filter_set_ephemeral
matrix_api_room_filter_get_ephemeral matrix_room_filter_get_ephemeral
matrix_api_room_filter_set_state matrix_room_filter_set_state
matrix_api_room_filter_get_state matrix_room_filter_get_state
matrix_api_room_filter_set_timeline matrix_room_filter_set_timeline
matrix_api_room_filter_get_timeline matrix_room_filter_get_timeline
matrix_api_room_filter_get_json_node matrix_room_filter_get_json_node
matrix_api_room_filter_get_json_data matrix_room_filter_get_json_data
<SUBSECTION> <SUBSECTION>
MatrixFilter MatrixFilter
@ -183,8 +183,8 @@ MATRIX_TYPE_ACCOUNT_KIND
matrix_account_kind_get_type matrix_account_kind_get_type
MATRIX_TYPE_FILTER_RULES MATRIX_TYPE_FILTER_RULES
matrix_filter_rules_get_type matrix_filter_rules_get_type
MATRIX_TYPE_API_ROOM_FILTER MATRIX_TYPE_ROOM_FILTER
matrix_api_room_filter_get_type matrix_room_filter_get_type
MATRIX_TYPE_FILTER MATRIX_TYPE_FILTER
matrix_filter_get_type matrix_filter_get_type
MATRIX_TYPE_API_3PID_CREDENTIAL MATRIX_TYPE_API_3PID_CREDENTIAL

View File

@ -956,11 +956,11 @@ matrix_filter_rules_get_json_data(MatrixFilterRules *rules, gsize *datalen)
} }
/** /**
* MatrixAPIRoomFilter: * MatrixRoomFilter:
* *
* An opaque structure to hold room filters. * An opaque structure to hold room filters.
*/ */
struct _MatrixAPIRoomFilter { struct _MatrixRoomFilter {
gboolean include_leave; gboolean include_leave;
MatrixFilterRules *ephemeral; MatrixFilterRules *ephemeral;
MatrixFilterRules *state; MatrixFilterRules *state;
@ -968,30 +968,30 @@ struct _MatrixAPIRoomFilter {
guint refcount; guint refcount;
}; };
G_DEFINE_BOXED_TYPE(MatrixAPIRoomFilter, matrix_api_room_filter, G_DEFINE_BOXED_TYPE(MatrixRoomFilter, matrix_room_filter,
(GBoxedCopyFunc)matrix_api_room_filter_ref, (GBoxedCopyFunc)matrix_room_filter_ref,
(GBoxedFreeFunc)matrix_api_room_filter_unref); (GBoxedFreeFunc)matrix_room_filter_unref);
/** /**
* matrix_api_room_filter_new: * matrix_room_filter_new:
* *
* Create a new #MatrixAPIRoomFilter object with reference count of 1. * Create a new #MatrixRoomFilter object with reference count of 1.
* *
* Returns: (transfer full): a new #MatrixAPIRoomFilter * Returns: (transfer full): a new #MatrixRoomFilter
*/ */
MatrixAPIRoomFilter * MatrixRoomFilter *
matrix_api_room_filter_new(void) matrix_room_filter_new(void)
{ {
MatrixAPIRoomFilter *filter; MatrixRoomFilter *filter;
filter = g_new0(MatrixAPIRoomFilter, 1); filter = g_new0(MatrixRoomFilter, 1);
filter->refcount = 1; filter->refcount = 1;
return filter; return filter;
} }
static void static void
matrix_api_room_filter_free(MatrixAPIRoomFilter *filter) matrix_room_filter_free(MatrixRoomFilter *filter)
{ {
if (filter->ephemeral) { if (filter->ephemeral) {
matrix_filter_rules_unref(filter->ephemeral); matrix_filter_rules_unref(filter->ephemeral);
@ -1009,15 +1009,15 @@ matrix_api_room_filter_free(MatrixAPIRoomFilter *filter)
} }
/** /**
* matrix_api_room_filter_ref: * matrix_room_filter_ref:
* @filter: a #MatrixAPIRoomFilter * @filter: a #MatrixRoomFilter
* *
* Increase reference count of @filter by one. * Increase reference count of @filter by one.
* *
* Returns: (transfer none): the same #MatrixAPIRoomFilter * Returns: (transfer none): the same #MatrixRoomFilter
*/ */
MatrixAPIRoomFilter * MatrixRoomFilter *
matrix_api_room_filter_ref(MatrixAPIRoomFilter *filter) matrix_room_filter_ref(MatrixRoomFilter *filter)
{ {
filter->refcount++; filter->refcount++;
@ -1025,38 +1025,38 @@ matrix_api_room_filter_ref(MatrixAPIRoomFilter *filter)
} }
/** /**
* matrix_api_room_filter_unref: * matrix_room_filter_unref:
* @filter: a #MatrixAPIRoomFilter * @filter: a #MatrixRoomFilter
* *
* Decrease reference count of @filter by one. If reference count * Decrease reference count of @filter by one. If reference count
* reaches zero, @filter is freed. * reaches zero, @filter is freed.
*/ */
void void
matrix_api_room_filter_unref(MatrixAPIRoomFilter *filter) matrix_room_filter_unref(MatrixRoomFilter *filter)
{ {
if (--filter->refcount == 0) { if (--filter->refcount == 0) {
matrix_api_room_filter_free(filter); matrix_room_filter_free(filter);
} }
} }
/** /**
* matrix_api_room_filter_set_include_leave: * matrix_room_filter_set_include_leave:
* @filter: a #MatrixAPIRoomFilter * @filter: a #MatrixRoomFilter
* @include_leave: %TRUE if events from left rooms should be included * @include_leave: %TRUE if events from left rooms should be included
* *
* Sets if events for rooms that the user has left should be included * Sets if events for rooms that the user has left should be included
* in the filtered event list. * in the filtered event list.
*/ */
void void
matrix_api_room_filter_set_include_leave(MatrixAPIRoomFilter *filter, matrix_room_filter_set_include_leave(MatrixRoomFilter *filter,
gboolean include_leave) gboolean include_leave)
{ {
filter->include_leave = include_leave; filter->include_leave = include_leave;
} }
/** /**
* matrix_api_room_filter_get_include_leave: * matrix_room_filter_get_include_leave:
* @filter: a #MatrixAPIRoomFilter * @filter: a #MatrixRoomFilter
* *
* If %TRUE, events from rooms that the user has left will be included * If %TRUE, events from rooms that the user has left will be included
* in the filtered event list. * in the filtered event list.
@ -1064,14 +1064,14 @@ matrix_api_room_filter_set_include_leave(MatrixAPIRoomFilter *filter,
* Returns: the value of <code>include_leave</code> * Returns: the value of <code>include_leave</code>
*/ */
gboolean gboolean
matrix_api_room_filter_get_include_leave(MatrixAPIRoomFilter *filter) matrix_room_filter_get_include_leave(MatrixRoomFilter *filter)
{ {
return filter->include_leave; return filter->include_leave;
} }
/** /**
* matrix_api_room_filter_set_ephemeral: * matrix_room_filter_set_ephemeral:
* @filter: a #MatrixAPIRoomFilter * @filter: a #MatrixRoomFilter
* @rules: (transfer none): filtering rules for ephemeral events * @rules: (transfer none): filtering rules for ephemeral events
* *
* Set filtering rules for ephemeral events, i.e. events that are not * Set filtering rules for ephemeral events, i.e. events that are not
@ -1079,7 +1079,7 @@ matrix_api_room_filter_get_include_leave(MatrixAPIRoomFilter *filter)
* @filter gets a reference on @rules, so the caller may unref it. * @filter gets a reference on @rules, so the caller may unref it.
*/ */
void void
matrix_api_room_filter_set_ephemeral(MatrixAPIRoomFilter *filter, matrix_room_filter_set_ephemeral(MatrixRoomFilter *filter,
MatrixFilterRules *rules) MatrixFilterRules *rules)
{ {
if (filter->ephemeral) { if (filter->ephemeral) {
@ -1090,31 +1090,30 @@ matrix_api_room_filter_set_ephemeral(MatrixAPIRoomFilter *filter,
} }
/** /**
* matrix_api_room_filter_get_ephemeral: * matrix_room_filter_get_ephemeral:
* @filter: a #MatrixAPIRoomFilter * @filter: a #MatrixRoomFilter
* *
* Gets the filtering rules for ephemeral events. See * Gets the filtering rules for ephemeral events. See
* matrix_api_room_filter_set_ephemeral() for details. * matrix_room_filter_set_ephemeral() for details.
* *
* Returns: (transfer none): the filtering rules for ephemeral events. * Returns: (transfer none): the filtering rules for ephemeral events.
*/ */
MatrixFilterRules * MatrixFilterRules *
matrix_api_room_filter_get_ephemeral(MatrixAPIRoomFilter *filter) matrix_room_filter_get_ephemeral(MatrixRoomFilter *filter)
{ {
return filter->ephemeral; return filter->ephemeral;
} }
/** /**
* matrix_api_room_filter_set_state: * matrix_room_filter_set_state:
* @filter: a #MatrixAPIRoomFilter * @filter: a #MatrixRoomFilter
* @rules: (transfer none): filtering rules for state events * @rules: (transfer none): filtering rules for state events
* *
* Sets filtering rules for state events. @filter obtains a reference * Sets filtering rules for state events. @filter obtains a reference
* on @rules, so the caller may unref it safely. * on @rules, so the caller may unref it safely.
*/ */
void void
matrix_api_room_filter_set_state(MatrixAPIRoomFilter *filter, matrix_room_filter_set_state(MatrixRoomFilter *filter, MatrixFilterRules *rules)
MatrixFilterRules *rules)
{ {
if (filter->state) { if (filter->state) {
matrix_filter_rules_unref(filter->state); matrix_filter_rules_unref(filter->state);
@ -1124,29 +1123,29 @@ matrix_api_room_filter_set_state(MatrixAPIRoomFilter *filter,
} }
/** /**
* matrix_api_room_filter_get_state: * matrix_room_filter_get_state:
* @filter: a #MatrixAPIRoomFilter * @filter: a #MatrixRoomFilter
* *
* Gets the filtering rules for state events. * Gets the filtering rules for state events.
* *
* Returns: (transfer none): the filtering rules for state events * Returns: (transfer none): the filtering rules for state events
*/ */
MatrixFilterRules * MatrixFilterRules *
matrix_api_room_filter_get_state(MatrixAPIRoomFilter *filter) matrix_room_filter_get_state(MatrixRoomFilter *filter)
{ {
return filter->state; return filter->state;
} }
/** /**
* matrix_api_room_filter_set_timeline: * matrix_room_filter_set_timeline:
* @filter: a #MatrixAPIRoomFilter * @filter: a #MatrixRoomFilter
* @rules: (transfer none): filtering rules for timeline events * @rules: (transfer none): filtering rules for timeline events
* (messages and state events from rooms) * (messages and state events from rooms)
* *
* Set filtering rules for timeline events. * Set filtering rules for timeline events.
*/ */
void void
matrix_api_room_filter_set_timeline(MatrixAPIRoomFilter *filter, matrix_room_filter_set_timeline(MatrixRoomFilter *filter,
MatrixFilterRules *rules) MatrixFilterRules *rules)
{ {
if (filter->timeline) { if (filter->timeline) {
@ -1157,23 +1156,23 @@ matrix_api_room_filter_set_timeline(MatrixAPIRoomFilter *filter,
} }
/** /**
* matrix_api_room_filter_get_timeline: * matrix_room_filter_get_timeline:
* @filter: a #MatrixAPIRoomFilter * @filter: a #MatrixRoomFilter
* *
* Gets filtering rules for timeline events (see * Gets filtering rules for timeline events (see
* matrix_api_room_filter_set_timeline() for details. * matrix_room_filter_set_timeline() for details.
* *
* Returns: (transfer none): the filtering rules for timeline events * Returns: (transfer none): the filtering rules for timeline events
*/ */
MatrixFilterRules * MatrixFilterRules *
matrix_api_room_filter_get_timeline(MatrixAPIRoomFilter *filter) matrix_room_filter_get_timeline(MatrixRoomFilter *filter)
{ {
return filter->timeline; return filter->timeline;
} }
/** /**
* matrix_api_room_filter_get_json_node: * matrix_room_filter_get_json_node:
* @filter: a #MatrixAPIRoomFilter * @filter: a #MatrixRoomFilter
* *
* Gets the #JsonNode representation of the filtering ruleset. * Gets the #JsonNode representation of the filtering ruleset.
* *
@ -1181,7 +1180,7 @@ matrix_api_room_filter_get_timeline(MatrixAPIRoomFilter *filter)
* ruleset as a #JsonNode * ruleset as a #JsonNode
*/ */
JsonNode * JsonNode *
matrix_api_room_filter_get_json_node(MatrixAPIRoomFilter *filter) matrix_room_filter_get_json_node(MatrixRoomFilter *filter)
{ {
JsonBuilder *builder; JsonBuilder *builder;
JsonNode *node; JsonNode *node;
@ -1222,8 +1221,8 @@ matrix_api_room_filter_get_json_node(MatrixAPIRoomFilter *filter)
} }
/** /**
* matrix_api_room_filter_get_json_data: * matrix_room_filter_get_json_data:
* @filter: a #MatrixAPIRoomFilter * @filter: a #MatrixRoomFilter
* @datalen: (out) (allow-none): storage for the length of the JSON * @datalen: (out) (allow-none): storage for the length of the JSON
* data, or %NULL * data, or %NULL
* *
@ -1234,11 +1233,10 @@ matrix_api_room_filter_get_json_node(MatrixAPIRoomFilter *filter)
* data as a string * data as a string
*/ */
gchar * gchar *
matrix_api_room_filter_get_json_data(MatrixAPIRoomFilter *filter, matrix_room_filter_get_json_data(MatrixRoomFilter *filter, gsize *datalen)
gsize *datalen)
{ {
JsonGenerator *generator; JsonGenerator *generator;
JsonNode *node = matrix_api_room_filter_get_json_node(filter); JsonNode *node = matrix_room_filter_get_json_node(filter);
gchar *data; gchar *data;
generator = json_generator_new(); generator = json_generator_new();
@ -1260,7 +1258,7 @@ struct _MatrixFilter {
GList *event_fields; GList *event_fields;
MatrixEventFormat event_format; MatrixEventFormat event_format;
MatrixFilterRules *presence; MatrixFilterRules *presence;
MatrixAPIRoomFilter *room; MatrixRoomFilter *room;
guint refcount; guint refcount;
}; };
@ -1296,7 +1294,7 @@ matrix_filter_free(MatrixFilter *filter)
} }
if (filter->room) { if (filter->room) {
matrix_api_room_filter_unref(filter->room); matrix_room_filter_unref(filter->room);
} }
g_free(filter); g_free(filter);
@ -1489,13 +1487,13 @@ matrix_filter_get_presence_filter(MatrixFilter *filter)
*/ */
void void
matrix_filter_set_room_filter(MatrixFilter *filter, matrix_filter_set_room_filter(MatrixFilter *filter,
MatrixAPIRoomFilter *room_filter) MatrixRoomFilter *room_filter)
{ {
if (filter->room) { if (filter->room) {
matrix_api_room_filter_unref(filter->room); matrix_room_filter_unref(filter->room);
} }
filter->room = matrix_api_room_filter_ref(room_filter); filter->room = matrix_room_filter_ref(room_filter);
} }
/** /**
@ -1507,7 +1505,7 @@ matrix_filter_set_room_filter(MatrixFilter *filter,
* Returns: (transfer none): the current filtering ruleset for room * Returns: (transfer none): the current filtering ruleset for room
* events * events
*/ */
MatrixAPIRoomFilter * MatrixRoomFilter *
matrix_filter_get_room_filter(MatrixFilter *filter) matrix_filter_get_room_filter(MatrixFilter *filter)
{ {
return filter->room; return filter->room;
@ -1548,7 +1546,7 @@ matrix_filter_get_json_node(MatrixFilter *filter)
json_node_free(tmp); json_node_free(tmp);
json_builder_set_member_name(builder, "room"); json_builder_set_member_name(builder, "room");
tmp = matrix_api_room_filter_get_json_node(filter->room); tmp = matrix_room_filter_get_json_node(filter->room);
json_builder_add_value(builder, tmp); json_builder_add_value(builder, tmp);
json_node_free(tmp); json_node_free(tmp);

View File

@ -165,28 +165,28 @@ JsonNode *matrix_filter_rules_get_json_node(MatrixFilterRules *rules);
gchar *matrix_filter_rules_get_json_data(MatrixFilterRules *rules, gchar *matrix_filter_rules_get_json_data(MatrixFilterRules *rules,
gsize *datalen); gsize *datalen);
typedef struct _MatrixAPIRoomFilter MatrixAPIRoomFilter; typedef struct _MatrixRoomFilter MatrixRoomFilter;
GType matrix_api_room_filter_get_type(void); GType matrix_room_filter_get_type(void);
#define MATRIX_TYPE_API_ROOM_FILTER (matrix_api_room_filter_get_type()) #define MATRIX_TYPE_ROOM_FILTER (matrix_room_filter_get_type())
MatrixAPIRoomFilter *matrix_api_room_filter_new(void); MatrixRoomFilter *matrix_room_filter_new(void);
MatrixAPIRoomFilter *matrix_api_room_filter_ref(MatrixAPIRoomFilter *filter); MatrixRoomFilter *matrix_room_filter_ref(MatrixRoomFilter *filter);
void matrix_api_room_filter_unref(MatrixAPIRoomFilter *filter); void matrix_room_filter_unref(MatrixRoomFilter *filter);
void matrix_api_room_filter_set_include_leave(MatrixAPIRoomFilter *filter, void matrix_room_filter_set_include_leave(MatrixRoomFilter *filter,
gboolean include_leave); gboolean include_leave);
gboolean matrix_api_room_filter_get_include_leave(MatrixAPIRoomFilter *filter); gboolean matrix_room_filter_get_include_leave(MatrixRoomFilter *filter);
void matrix_api_room_filter_set_ephemeral(MatrixAPIRoomFilter *filter, void matrix_room_filter_set_ephemeral(MatrixRoomFilter *filter,
MatrixFilterRules *rules); MatrixFilterRules *rules);
MatrixFilterRules *matrix_api_room_filter_get_ephemeral(MatrixAPIRoomFilter *filter); MatrixFilterRules *matrix_room_filter_get_ephemeral(MatrixRoomFilter *filter);
void matrix_api_room_filter_set_state(MatrixAPIRoomFilter *filter, void matrix_room_filter_set_state(MatrixRoomFilter *filter,
MatrixFilterRules *rules); MatrixFilterRules *rules);
MatrixFilterRules *matrix_api_room_filter_get_state(MatrixAPIRoomFilter *filter); MatrixFilterRules *matrix_room_filter_get_state(MatrixRoomFilter *filter);
void matrix_api_room_filter_set_timeline(MatrixAPIRoomFilter *filter, void matrix_room_filter_set_timeline(MatrixRoomFilter *filter,
MatrixFilterRules *rules); MatrixFilterRules *rules);
MatrixFilterRules *matrix_api_room_filter_get_timeline(MatrixAPIRoomFilter *filter); MatrixFilterRules *matrix_room_filter_get_timeline(MatrixRoomFilter *filter);
JsonNode *matrix_api_room_filter_get_json_node(MatrixAPIRoomFilter *filter); JsonNode *matrix_room_filter_get_json_node(MatrixRoomFilter *filter);
gchar *matrix_api_room_filter_get_json_data(MatrixAPIRoomFilter *filter, gchar *matrix_room_filter_get_json_data(MatrixRoomFilter *filter,
gsize *datalen); gsize *datalen);
typedef struct _MatrixFilter MatrixFilter; typedef struct _MatrixFilter MatrixFilter;
@ -210,8 +210,8 @@ void matrix_filter_set_presence_filter(MatrixFilter *filter,
MatrixFilterRules *presence_filter); MatrixFilterRules *presence_filter);
MatrixFilterRules *matrix_filter_get_presence_filter(MatrixFilter *filter); MatrixFilterRules *matrix_filter_get_presence_filter(MatrixFilter *filter);
void matrix_filter_set_room_filter(MatrixFilter *filter, void matrix_filter_set_room_filter(MatrixFilter *filter,
MatrixAPIRoomFilter *room_filter); MatrixRoomFilter *room_filter);
MatrixAPIRoomFilter *matrix_filter_get_room_filter(MatrixFilter *filter); MatrixRoomFilter *matrix_filter_get_room_filter(MatrixFilter *filter);
JsonNode *matrix_filter_get_json_node(MatrixFilter *filter); JsonNode *matrix_filter_get_json_node(MatrixFilter *filter);
gchar *matrix_filter_get_json_data(MatrixFilter *filter, gsize *datalen); gchar *matrix_filter_get_json_data(MatrixFilter *filter, gsize *datalen);