MatrixEvent

MatrixEvent — Base class for Matrix events.

Functions

Types and Values

Object Hierarchy


Description

Functions

MATRIX_TYPE_EVENT

#define MATRIX_TYPE_EVENT (matrix_event_get_type ())

The type for MatrixEvent.


matrix_event_from_json ()

void
matrix_event_from_json (MatrixEvent *self,
                        JsonNode *json_data,
                        GError **error);

Subclasses should implement this function to initialize themselves from JSON data.

Parameters

self

the MatrixEvent instance

 

json_data

 

 

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_event_to_json ()

void
matrix_event_to_json (MatrixEvent *self,
                      JsonNode *json_data,
                      GError **error);

Subclasses should implement this to export their data to JSON.

Parameters

self

the MatrixEvent instance

 

json_data

 

 

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_event_set_custom_field ()

void
matrix_event_set_custom_field (MatrixEvent *self,
                               const gchar *field_name,
                               JsonNode *value);

Set a value for a custom field.

Parameters

self

the MatrixEvent instance

 

field_name

 

 

value

 

 

matrix_event_get_custom_field ()

JsonNode *
matrix_event_get_custom_field (MatrixEvent *self,
                               const gchar *field_name);

Get the value of a custom field.

Parameters

self

the MatrixEvent instance

 

field_name

 

 

matrix_event_delete_custom_field ()

void
matrix_event_delete_custom_field (MatrixEvent *self,
                                  const gchar *field_name);

Delete a custom field.

Parameters

self

the MatrixEvent instance

 

field_name

 

 

matrix_event_new ()

MatrixEvent *
matrix_event_new (void);

matrix_event_get_sender ()

const gchar *
matrix_event_get_sender (MatrixEvent *self);

Get and return the current value of the "sender" property.

The Matrix ID of the events sender.

Parameters

self

the MatrixEvent instance to query

 

Returns

the value of the "sender" property


matrix_event_set_sender ()

void
matrix_event_set_sender (MatrixEvent *self,
                         const gchar *value);

Set the value of the "sender" property to value .

The Matrix ID of the events sender.

Parameters

self

the MatrixEvent instance to modify

 

value

the new value of the "sender" property

 

matrix_event_get_room_id ()

const gchar *
matrix_event_get_room_id (MatrixEvent *self);

Get and return the current value of the "room-id" property.

The ID of the room this event is associated with.

Parameters

self

the MatrixEvent instance to query

 

Returns

the value of the "room-id" property


matrix_event_set_room_id ()

void
matrix_event_set_room_id (MatrixEvent *self,
                          const gchar *value);

Set the value of the "room-id" property to value .

The ID of the room this event is associated with.

Parameters

self

the MatrixEvent instance to modify

 

value

the new value of the "room-id" property

 

matrix_event_get_event_type ()

const gchar *
matrix_event_get_event_type (MatrixEvent *self);

Get and return the current value of the "event-type" property.

The type of the event.

Parameters

self

the MatrixEvent instance to query

 

Returns

the value of the "event-type" property


matrix_event_get_origin_server_ts ()

gulong *
matrix_event_get_origin_server_ts (MatrixEvent *self);

Get and return the current value of the "origin-server-ts" property.

The timestamp of the event on the originating server.

Parameters

self

the MatrixEvent instance to query

 

Returns

the value of the "origin-server-ts" property


matrix_event_set_origin_server_ts ()

void
matrix_event_set_origin_server_ts (MatrixEvent *self,
                                   gulong *value);

Set the value of the "origin-server-ts" property to value .

The timestamp of the event on the originating server.

Parameters

self

the MatrixEvent instance to modify

 

value

the new value of the "origin-server-ts" property

 

matrix_event_get_unsigned_data ()

MatrixUnsignedEventData *
matrix_event_get_unsigned_data (MatrixEvent *self);

Get and return the current value of the "unsigned-data" property.

The unsigned part of the event.

Parameters

self

the MatrixEvent instance to query

 

Returns

the value of the "unsigned-data" property


matrix_event_set_unsigned_data ()

void
matrix_event_set_unsigned_data (MatrixEvent *self,
                                MatrixUnsignedEventData *value);

Set the value of the "unsigned-data" property to value .

The unsigned part of the event.

Parameters

self

the MatrixEvent instance to modify

 

value

the new value of the "unsigned-data" property

 

matrix_event_get_json ()

JsonNode *
matrix_event_get_json (MatrixEvent *self);

Get and return the current value of the "json" property.

The event as a JSON node.

Parameters

self

the MatrixEvent instance to query

 

Returns

the value of the "json" property


matrix_event_new_from_json ()

MatrixEvent *
matrix_event_new_from_json (gchar *event_type,
                            const gchar *room_id,
                            JsonNode *json_data,
                            GError **error);

Parameters

event_type

 

 

room_id

 

 

json_data

 

 

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_event_get_handler ()

GType
matrix_event_get_handler (const gchar *event_type);

Get the GType of the class that is registered to handle events with type param event_type.

Parameters

event_type

 .

the event type to look up

.

[in]

Returns

a GType or MatrixEvent if no handler is registered


matrix_event_register_type ()

void
matrix_event_register_type (const gchar *event_type,
                            GType event_gtype,
                            GError **error);

Registers param event_type to be handled by the type param event_gtype.

Parameters

event_type

 .

the type of the event

.

[in]

event_gtype

 .

the GType of the event’s handler

.

[in]

error

location to store the error occuring, or NULL to ignore.

[error-domains MatrixError]

matrix_event_unregister_type ()

void
matrix_event_unregister_type (const gchar *event_type);

Unregister param event_type.

Parameters

event_type

 .

the event type to remove

.

[in]

Types and Values

struct MatrixEvent

struct MatrixEvent {
	GObject parent_instance;
	MatrixEventPrivate * priv;
	gchar* _sender;
	gchar* _room_id;
};

Base class for Matrix events.


struct MatrixEventClass

struct MatrixEventClass {
	GObjectClass parent_class;
	void (*from_json) (MatrixEvent* self, JsonNode* json_data, GError** error);
	void (*to_json) (MatrixEvent* self, JsonNode* json_data, GError** error);
};

The class structure for MATRIX_TYPE_EVENT. All the fields in this structure are private and should never be accessed directly.

Members

GObjectClass parent_class;

the parent class structure

 

from_json ()

virtual method called by matrix_event_from_json()

 

to_json ()

virtual method called by matrix_event_to_json()