Rename MatrixAPIStateEvent to MatrixStateEvent

This commit is contained in:
Gergely Polonkai 2016-01-25 16:36:18 +01:00
parent f51a4ba63c
commit c56dee6c56
5 changed files with 84 additions and 85 deletions

View File

@ -147,18 +147,18 @@ matrix_pusher_get_json_node
matrix_pusher_get_json_data matrix_pusher_get_json_data
<SUBSECTION> <SUBSECTION>
MatrixAPIStateEvent MatrixStateEvent
matrix_api_state_event_new matrix_state_event_new
matrix_api_state_event_ref matrix_state_event_ref
matrix_api_state_event_unref matrix_state_event_unref
matrix_api_state_event_set_event_type matrix_state_event_set_event_type
matrix_api_state_event_get_event_type matrix_state_event_get_event_type
matrix_api_state_event_set_state_key matrix_state_event_set_state_key
matrix_api_state_event_get_state_key matrix_state_event_get_state_key
matrix_api_state_event_set_content matrix_state_event_set_content
matrix_api_state_event_get_content matrix_state_event_get_content
matrix_api_state_event_get_json_node matrix_state_event_get_json_node
matrix_api_state_event_get_json_data matrix_state_event_get_json_data
<SUBSECTION Standard> <SUBSECTION Standard>
MATRIX_TYPE_EVENT_FORMAT MATRIX_TYPE_EVENT_FORMAT
@ -191,8 +191,8 @@ MATRIX_TYPE_3PID_CREDENTIAL
matrix_3pid_credential_get_type matrix_3pid_credential_get_type
MATRIX_TYPE_PUSHER MATRIX_TYPE_PUSHER
matrix_pusher_get_type matrix_pusher_get_type
MATRIX_TYPE_API_STATE_EVENT MATRIX_TYPE_STATE_EVENT
matrix_api_state_event_get_type matrix_state_event_get_type
</SECTION> </SECTION>
<SECTION> <SECTION>

View File

@ -890,7 +890,7 @@ void matrix_api_toggle_pusher(MatrixAPI *api,
* @visibility: the initial visibility of the room * @visibility: the initial visibility of the room
* @creation_content: (allow-none): extra keys to be added to the * @creation_content: (allow-none): extra keys to be added to the
* content of m.room.create * content of m.room.create
* @initial_state: (element-type MatrixAPIStateEvent) (allow-none): A * @initial_state: (element-type MatrixStateEvent) (allow-none): A
* list of state events to set in the new room * list of state events to set in the new room
* @invitees: (element-type utf8) (allow-none): list of user IDs to * @invitees: (element-type utf8) (allow-none): list of user IDs to
* invite to the new room * invite to the new room

View File

@ -863,9 +863,9 @@ i_login(MatrixAPI *api,
} }
static void static void
add_state_event(MatrixAPIStateEvent *event, JsonBuilder *builder) add_state_event(MatrixStateEvent *event, JsonBuilder *builder)
{ {
JsonNode *node = matrix_api_state_event_get_json_node(event); JsonNode *node = matrix_state_event_get_json_node(event);
json_builder_add_value(builder, node); json_builder_add_value(builder, node);
json_node_free(node); json_node_free(node);

View File

@ -2351,41 +2351,41 @@ gchar *matrix_pusher_get_json_data(MatrixPusher *pusher,
} }
/** /**
* MatrixAPIStateEvent: * MatrixStateEvent:
* *
* An opaque structure to hold a state event filter. * An opaque structure to hold a state event filter.
*/ */
struct _MatrixAPIStateEvent { struct _MatrixStateEvent {
gchar *type; gchar *type;
gchar *state_key; gchar *state_key;
JsonNode *content; JsonNode *content;
guint refcount; guint refcount;
}; };
G_DEFINE_BOXED_TYPE(MatrixAPIStateEvent, matrix_api_state_event, G_DEFINE_BOXED_TYPE(MatrixStateEvent, matrix_state_event,
(GBoxedCopyFunc)matrix_api_state_event_ref, (GBoxedCopyFunc)matrix_state_event_ref,
(GBoxedFreeFunc)matrix_api_state_event_unref); (GBoxedFreeFunc)matrix_state_event_unref);
/** /**
* matrix_api_state_event_new: * matrix_state_event_new:
* *
* Create a new #MatrixAPIStateEvent object with reference count of 1. * Create a new #MatrixStateEvent object with reference count of 1.
* *
* Returns: (transfer full): a new #MatrixAPIStateEvent * Returns: (transfer full): a new #MatrixStateEvent
*/ */
MatrixAPIStateEvent * MatrixStateEvent *
matrix_api_state_event_new(void) matrix_state_event_new(void)
{ {
MatrixAPIStateEvent *event; MatrixStateEvent *event;
event = g_new0(MatrixAPIStateEvent, 1); event = g_new0(MatrixStateEvent, 1);
event->refcount = 1; event->refcount = 1;
return event; return event;
} }
static void static void
matrix_api_state_event_free(MatrixAPIStateEvent *event) matrix_state_event_free(MatrixStateEvent *event)
{ {
g_free(event->type); g_free(event->type);
g_free(event->state_key); g_free(event->state_key);
@ -2398,15 +2398,15 @@ matrix_api_state_event_free(MatrixAPIStateEvent *event)
} }
/** /**
* matrix_api_state_event_ref: * matrix_state_event_ref:
* @event: a #MatrixAPIStateEvent * @event: a #MatrixStateEvent
* *
* Increase reference count of @event by one. * Increase reference count of @event by one.
* *
* Returns: (transfer none): the same #MatrixAPIStateEvent * Returns: (transfer none): the same #MatrixStateEvent
*/ */
MatrixAPIStateEvent * MatrixStateEvent *
matrix_api_state_event_ref(MatrixAPIStateEvent *event) matrix_state_event_ref(MatrixStateEvent *event)
{ {
event->refcount++; event->refcount++;
@ -2414,29 +2414,29 @@ matrix_api_state_event_ref(MatrixAPIStateEvent *event)
} }
/** /**
* matrix_api_state_event_unref: * matrix_state_event_unref:
* @event: a #MatrixAPIStateEvent * @event: a #MatrixStateEvent
* *
* Decrease reference count of @event by one. If reference count * Decrease reference count of @event by one. If reference count
* reaches zero, @event is freed. * reaches zero, @event is freed.
*/ */
void void
matrix_api_state_event_unref(MatrixAPIStateEvent *event) matrix_state_event_unref(MatrixStateEvent *event)
{ {
if (--event->refcount == 0) { if (--event->refcount == 0) {
matrix_api_state_event_free(event); matrix_state_event_free(event);
} }
} }
/** /**
* matrix_api_state_event_set_event_type: * matrix_state_event_set_event_type:
* @event: a #MatrixAPIStateEvent * @event: a #MatrixStateEvent
* @event_type: the type of the state event * @event_type: the type of the state event
* *
* Set the type of the state event in @event. * Set the type of the state event in @event.
*/ */
void void
matrix_api_state_event_set_event_type(MatrixAPIStateEvent *event, matrix_state_event_set_event_type(MatrixStateEvent *event,
const gchar *event_type) const gchar *event_type)
{ {
g_free(event->type); g_free(event->type);
@ -2444,8 +2444,8 @@ matrix_api_state_event_set_event_type(MatrixAPIStateEvent *event,
} }
/** /**
* matrix_api_state_event_get_event_type: * matrix_state_event_get_event_type:
* @event: a #MatrixAPIStateEvent * @event: a #MatrixStateEvent
* *
* Get the type of the state event in @event. * Get the type of the state event in @event.
* *
@ -2453,20 +2453,20 @@ matrix_api_state_event_set_event_type(MatrixAPIStateEvent *event,
* owned by @event and should not be freed nor modified. * owned by @event and should not be freed nor modified.
*/ */
const gchar * const gchar *
matrix_api_state_event_get_event_type(MatrixAPIStateEvent *event) matrix_state_event_get_event_type(MatrixStateEvent *event)
{ {
return event->type; return event->type;
} }
/** /**
* matrix_api_state_event_set_state_key: * matrix_state_event_set_state_key:
* @event: a #MatrixAPIStateEvent * @event: a #MatrixStateEvent
* @state_key: the key of the state event * @state_key: the key of the state event
* *
* Set the state key for the state event @event. * Set the state key for the state event @event.
*/ */
void void
matrix_api_state_event_set_state_key(MatrixAPIStateEvent *event, matrix_state_event_set_state_key(MatrixStateEvent *event,
const gchar *state_key) const gchar *state_key)
{ {
g_free(event->state_key); g_free(event->state_key);
@ -2474,8 +2474,8 @@ matrix_api_state_event_set_state_key(MatrixAPIStateEvent *event,
} }
/** /**
* matrix_api_state_event_get_state_key: * matrix_state_event_get_state_key:
* @event: a #MatrixAPIStateEvent * @event: a #MatrixStateEvent
* *
* Get the state key of @event. * Get the state key of @event.
* *
@ -2483,21 +2483,20 @@ matrix_api_state_event_set_state_key(MatrixAPIStateEvent *event,
* owned by @event and should not be freed nor modified * owned by @event and should not be freed nor modified
*/ */
const gchar * const gchar *
matrix_api_state_event_get_state_key(MatrixAPIStateEvent *event) matrix_state_event_get_state_key(MatrixStateEvent *event)
{ {
return event->state_key; return event->state_key;
} }
/** /**
* matrix_api_state_event_set_content: * matrix_state_event_set_content:
* @event: a #MatrixAPIStateEvent * @event: a #MatrixStateEvent
* @content: the desired content of the state event * @content: the desired content of the state event
* *
* Set the content of the state event. * Set the content of the state event.
*/ */
void void
matrix_api_state_event_set_content(MatrixAPIStateEvent *event, matrix_state_event_set_content(MatrixStateEvent *event, const JsonNode *content)
const JsonNode *content)
{ {
if (event->content) { if (event->content) {
json_node_free(event->content); json_node_free(event->content);
@ -2507,8 +2506,8 @@ matrix_api_state_event_set_content(MatrixAPIStateEvent *event,
} }
/** /**
* matrix_api_state_event_get_content: * matrix_state_event_get_content:
* @event: a #MatrixAPIStateEvent * @event: a #MatrixStateEvent
* *
* Get the contents of the state event. * Get the contents of the state event.
* *
@ -2517,14 +2516,14 @@ matrix_api_state_event_set_content(MatrixAPIStateEvent *event,
* nor modified * nor modified
*/ */
const JsonNode * const JsonNode *
matrix_api_state_event_get_content(MatrixAPIStateEvent *event) matrix_state_event_get_content(MatrixStateEvent *event)
{ {
return event->content; return event->content;
} }
/** /**
* matrix_api_state_event_get_json_node: * matrix_state_event_get_json_node:
* @event: a #MatrixAPIStateEvent * @event: a #MatrixStateEvent
* *
* Get the JSON representation of the state event as a #JsonNode * Get the JSON representation of the state event as a #JsonNode
* object. * object.
@ -2533,7 +2532,7 @@ matrix_api_state_event_get_content(MatrixAPIStateEvent *event)
* event * event
*/ */
JsonNode * JsonNode *
matrix_api_state_event_get_json_node(MatrixAPIStateEvent *event) matrix_state_event_get_json_node(MatrixStateEvent *event)
{ {
JsonBuilder *builder; JsonBuilder *builder;
JsonNode *node; JsonNode *node;
@ -2559,8 +2558,8 @@ matrix_api_state_event_get_json_node(MatrixAPIStateEvent *event)
} }
/** /**
* matrix_api_state_event_get_json_data: * matrix_state_event_get_json_data:
* @event: a #MatrixAPIStateEvent * @event: a #MatrixStateEvent
* @datalen: (out): storage for the the length of the JSON data or * @datalen: (out): storage for the the length of the JSON data or
* %NULL * %NULL
* *
@ -2570,10 +2569,10 @@ matrix_api_state_event_get_json_node(MatrixAPIStateEvent *event)
* event * event
*/ */
gchar * gchar *
matrix_api_state_event_get_json_data(MatrixAPIStateEvent *event, gsize *datalen) matrix_state_event_get_json_data(MatrixStateEvent *event, gsize *datalen)
{ {
JsonGenerator *generator; JsonGenerator *generator;
JsonNode *node = matrix_api_state_event_get_json_node(event); JsonNode *node = matrix_state_event_get_json_node(event);
gchar *data; gchar *data;
generator = json_generator_new(); generator = json_generator_new();

View File

@ -273,25 +273,25 @@ gchar *matrix_pusher_get_json_data(MatrixPusher *pusher,
gsize *datalen, gsize *datalen,
GError **err); GError **err);
typedef struct _MatrixAPIStateEvent MatrixAPIStateEvent; typedef struct _MatrixStateEvent MatrixStateEvent;
GType matrix_api_state_event_get_type(void); GType matrix_state_event_get_type(void);
#define MATRIX_TYPE_API_STATE_EVENT (matrix_api_state_event_get_type()) #define MATRIX_TYPE_STATE_EVENT (matrix_state_event_get_type())
MatrixAPIStateEvent *matrix_api_state_event_new(void); MatrixStateEvent *matrix_state_event_new(void);
MatrixAPIStateEvent *matrix_api_state_event_ref(MatrixAPIStateEvent *event); MatrixStateEvent *matrix_state_event_ref(MatrixStateEvent *event);
void matrix_api_state_event_unref(MatrixAPIStateEvent *event); void matrix_state_event_unref(MatrixStateEvent *event);
void matrix_api_state_event_set_event_type(MatrixAPIStateEvent *event, void matrix_state_event_set_event_type(MatrixStateEvent *event,
const gchar *event_type); const gchar *event_type);
const gchar *matrix_api_state_event_get_event_type(MatrixAPIStateEvent *event); const gchar *matrix_state_event_get_event_type(MatrixStateEvent *event);
void matrix_api_state_event_set_state_key(MatrixAPIStateEvent *event, void matrix_state_event_set_state_key(MatrixStateEvent *event,
const gchar *state_key); const gchar *state_key);
const gchar *matrix_api_state_event_get_state_key(MatrixAPIStateEvent *event); const gchar *matrix_state_event_get_state_key(MatrixStateEvent *event);
void matrix_api_state_event_set_content(MatrixAPIStateEvent *event, void matrix_state_event_set_content(MatrixStateEvent *event,
const JsonNode *content); const JsonNode *content);
const JsonNode *matrix_api_state_event_get_content(MatrixAPIStateEvent *event); const JsonNode *matrix_state_event_get_content(MatrixStateEvent *event);
JsonNode *matrix_api_state_event_get_json_node(MatrixAPIStateEvent *event); JsonNode *matrix_state_event_get_json_node(MatrixStateEvent *event);
gchar *matrix_api_state_event_get_json_data(MatrixAPIStateEvent *event, gchar *matrix_state_event_get_json_data(MatrixStateEvent *event,
gsize *datalen); gsize *datalen);
G_END_DECLS G_END_DECLS