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

View File

@ -890,7 +890,7 @@ void matrix_api_toggle_pusher(MatrixAPI *api,
* @visibility: the initial visibility of the room
* @creation_content: (allow-none): extra keys to be added to the
* 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
* @invitees: (element-type utf8) (allow-none): list of user IDs to
* invite to the new room

View File

@ -863,9 +863,9 @@ i_login(MatrixAPI *api,
}
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_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.
*/
struct _MatrixAPIStateEvent {
struct _MatrixStateEvent {
gchar *type;
gchar *state_key;
JsonNode *content;
guint refcount;
};
G_DEFINE_BOXED_TYPE(MatrixAPIStateEvent, matrix_api_state_event,
(GBoxedCopyFunc)matrix_api_state_event_ref,
(GBoxedFreeFunc)matrix_api_state_event_unref);
G_DEFINE_BOXED_TYPE(MatrixStateEvent, matrix_state_event,
(GBoxedCopyFunc)matrix_state_event_ref,
(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 *
matrix_api_state_event_new(void)
MatrixStateEvent *
matrix_state_event_new(void)
{
MatrixAPIStateEvent *event;
MatrixStateEvent *event;
event = g_new0(MatrixAPIStateEvent, 1);
event = g_new0(MatrixStateEvent, 1);
event->refcount = 1;
return event;
}
static void
matrix_api_state_event_free(MatrixAPIStateEvent *event)
matrix_state_event_free(MatrixStateEvent *event)
{
g_free(event->type);
g_free(event->state_key);
@ -2398,15 +2398,15 @@ matrix_api_state_event_free(MatrixAPIStateEvent *event)
}
/**
* matrix_api_state_event_ref:
* @event: a #MatrixAPIStateEvent
* matrix_state_event_ref:
* @event: a #MatrixStateEvent
*
* Increase reference count of @event by one.
*
* Returns: (transfer none): the same #MatrixAPIStateEvent
* Returns: (transfer none): the same #MatrixStateEvent
*/
MatrixAPIStateEvent *
matrix_api_state_event_ref(MatrixAPIStateEvent *event)
MatrixStateEvent *
matrix_state_event_ref(MatrixStateEvent *event)
{
event->refcount++;
@ -2414,29 +2414,29 @@ matrix_api_state_event_ref(MatrixAPIStateEvent *event)
}
/**
* matrix_api_state_event_unref:
* @event: a #MatrixAPIStateEvent
* matrix_state_event_unref:
* @event: a #MatrixStateEvent
*
* Decrease reference count of @event by one. If reference count
* reaches zero, @event is freed.
*/
void
matrix_api_state_event_unref(MatrixAPIStateEvent *event)
matrix_state_event_unref(MatrixStateEvent *event)
{
if (--event->refcount == 0) {
matrix_api_state_event_free(event);
matrix_state_event_free(event);
}
}
/**
* matrix_api_state_event_set_event_type:
* @event: a #MatrixAPIStateEvent
* matrix_state_event_set_event_type:
* @event: a #MatrixStateEvent
* @event_type: the type of the state event
*
* Set the type of the state event in @event.
*/
void
matrix_api_state_event_set_event_type(MatrixAPIStateEvent *event,
matrix_state_event_set_event_type(MatrixStateEvent *event,
const gchar *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:
* @event: a #MatrixAPIStateEvent
* matrix_state_event_get_event_type:
* @event: a #MatrixStateEvent
*
* 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.
*/
const gchar *
matrix_api_state_event_get_event_type(MatrixAPIStateEvent *event)
matrix_state_event_get_event_type(MatrixStateEvent *event)
{
return event->type;
}
/**
* matrix_api_state_event_set_state_key:
* @event: a #MatrixAPIStateEvent
* matrix_state_event_set_state_key:
* @event: a #MatrixStateEvent
* @state_key: the key of the state event
*
* Set the state key for the state event @event.
*/
void
matrix_api_state_event_set_state_key(MatrixAPIStateEvent *event,
matrix_state_event_set_state_key(MatrixStateEvent *event,
const gchar *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:
* @event: a #MatrixAPIStateEvent
* matrix_state_event_get_state_key:
* @event: a #MatrixStateEvent
*
* 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
*/
const gchar *
matrix_api_state_event_get_state_key(MatrixAPIStateEvent *event)
matrix_state_event_get_state_key(MatrixStateEvent *event)
{
return event->state_key;
}
/**
* matrix_api_state_event_set_content:
* @event: a #MatrixAPIStateEvent
* matrix_state_event_set_content:
* @event: a #MatrixStateEvent
* @content: the desired content of the state event
*
* Set the content of the state event.
*/
void
matrix_api_state_event_set_content(MatrixAPIStateEvent *event,
const JsonNode *content)
matrix_state_event_set_content(MatrixStateEvent *event, const JsonNode *content)
{
if (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:
* @event: a #MatrixAPIStateEvent
* matrix_state_event_get_content:
* @event: a #MatrixStateEvent
*
* Get the contents of the state event.
*
@ -2517,14 +2516,14 @@ matrix_api_state_event_set_content(MatrixAPIStateEvent *event,
* nor modified
*/
const JsonNode *
matrix_api_state_event_get_content(MatrixAPIStateEvent *event)
matrix_state_event_get_content(MatrixStateEvent *event)
{
return event->content;
}
/**
* matrix_api_state_event_get_json_node:
* @event: a #MatrixAPIStateEvent
* matrix_state_event_get_json_node:
* @event: a #MatrixStateEvent
*
* Get the JSON representation of the state event as a #JsonNode
* object.
@ -2533,7 +2532,7 @@ matrix_api_state_event_get_content(MatrixAPIStateEvent *event)
* event
*/
JsonNode *
matrix_api_state_event_get_json_node(MatrixAPIStateEvent *event)
matrix_state_event_get_json_node(MatrixStateEvent *event)
{
JsonBuilder *builder;
JsonNode *node;
@ -2559,8 +2558,8 @@ matrix_api_state_event_get_json_node(MatrixAPIStateEvent *event)
}
/**
* matrix_api_state_event_get_json_data:
* @event: a #MatrixAPIStateEvent
* matrix_state_event_get_json_data:
* @event: a #MatrixStateEvent
* @datalen: (out): storage for the the length of the JSON data or
* %NULL
*
@ -2570,10 +2569,10 @@ matrix_api_state_event_get_json_node(MatrixAPIStateEvent *event)
* event
*/
gchar *
matrix_api_state_event_get_json_data(MatrixAPIStateEvent *event, gsize *datalen)
matrix_state_event_get_json_data(MatrixStateEvent *event, gsize *datalen)
{
JsonGenerator *generator;
JsonNode *node = matrix_api_state_event_get_json_node(event);
JsonNode *node = matrix_state_event_get_json_node(event);
gchar *data;
generator = json_generator_new();

View File

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