MatrixMessageBase

MatrixMessageBase — Base class for message handlers.

Functions

Types and Values

Description

Message handler base class.

Functions

matrix_message_get_handler ()

GType *
matrix_message_get_handler (const gchar *message_type);

Get the GType of the class that is registered to handle messages with type param message_type.

Parameters

self

the (null) instance

 

message_type

 .

the message type to look up

.

[in]

Returns

a GType or `null` if no handler is registered


matrix_message_register_type ()

void
matrix_message_register_type (const gchar *message_type,
                              GType message_gtype,
                              GError **error);

Register param message_type to be handled by the type param message_gtype.

Parameters

self

the (null) instance

 

message_type

 .

the type of the message

.

[in]

message_gtype

 .

the GType of the event's handler

.

[in]

error

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

[error-domains MatrixError]

matrix_message_unregister_type ()

void
matrix_message_unregister_type (const gchar *message_type);

Unregister param message_type.

Parameters

self

the (null) instance

 

message_type

 .

the message type to remove

.

[in]

MATRIX_MESSAGE_TYPE_BASE

#define MATRIX_MESSAGE_TYPE_BASE (matrix_message_base_get_type ())

The type for MatrixMessageBase.


matrix_message_base_from_json ()

void
matrix_message_base_from_json (MatrixMessageBase *self,
                               JsonNode *json_data,
                               GError **error);

Subclasses should override this method to initialize themselves from JSON data while chaining up to allow parent classes to do the same.

Parameters

self

the MatrixMessageBase instance

 

json_data

 

 

error

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

[error-domains MatrixError]

matrix_message_base_to_json ()

void
matrix_message_base_to_json (MatrixMessageBase *self,
                             JsonNode *json_data,
                             GError **error);

Subclasses should override this method to export their data to JSON, while chaining up to allow parent classes to do the same.

Parameters

self

the MatrixMessageBase instance

 

json_data

 

 

error

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

[error-domains MatrixError]

matrix_message_base_get_message_type ()

const gchar *
matrix_message_base_get_message_type (MatrixMessageBase *self);

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

The message type.

Parameters

self

the MatrixMessageBase instance to query

 

Returns

the value of the "message-type" property


matrix_message_base_set_message_type ()

void
matrix_message_base_set_message_type (MatrixMessageBase *self,
                                      const gchar *value);

Set the value of the "message-type" property to value .

The message type.

Parameters

self

the MatrixMessageBase instance to modify

 

value

the new value of the "message-type" property

 

matrix_message_base_get_body ()

const gchar *
matrix_message_base_get_body (MatrixMessageBase *self);

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

The body of the message.

Parameters

self

the MatrixMessageBase instance to query

 

Returns

the value of the "body" property


matrix_message_base_set_body ()

void
matrix_message_base_set_body (MatrixMessageBase *self,
                              const gchar *value);

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

The body of the message.

Parameters

self

the MatrixMessageBase instance to modify

 

value

the new value of the "body" property

 

matrix_message_base_get_json ()

JsonNode *
matrix_message_base_get_json (MatrixMessageBase *self);

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

Parameters

self

the MatrixMessageBase instance to query

 

Returns

the value of the "json" property


matrix_message_base_new_from_json ()

MatrixMessageBase *
matrix_message_base_new_from_json (JsonNode *json_data,
                                   GError **error);

Parameters

json_data

 

 

error

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

[error-domains MatrixError]

Types and Values

struct MatrixMessageBase

struct MatrixMessageBase {
	GObject parent_instance;
	MatrixMessageBasePrivate * priv;
};

Base class for message handlers.

Message handler base class.


struct MatrixMessageBaseClass

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

The class structure for MATRIX_MESSAGE_TYPE_BASE. 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_message_base_from_json()

 

to_json ()

virtual method called by matrix_message_base_to_json()