Rename enum types from MatrixAPI* to Matrix*

This commit is contained in:
Gergely Polonkai 2016-01-25 12:42:26 +01:00
parent d3ac019188
commit e163e73f2c
7 changed files with 241 additions and 256 deletions

View File

@ -26,16 +26,16 @@ MatrixError
MATRIX_ERROR MATRIX_ERROR
<SUBSECTION> <SUBSECTION>
MatrixAPIEventFormat MatrixEventFormat
MatrixAPIRoomPreset MatrixRoomPreset
MatrixAPIRoomVisibility MatrixRoomVisibility
MatrixAPIResizeMethod MatrixResizeMethod
MatrixAPIPresence MatrixPresence
MatrixAPIPusherKind MatrixPusherKind
MatrixAPIPusherConditionKind MatrixPusherConditionKind
MatrixAPIEventDirection MatrixEventDirection
MatrixAPIReceiptType MatrixReceiptType
MatrixAPIAccountKind MatrixAccountKind
<SUBSECTION> <SUBSECTION>
MatrixAPIFilterRules MatrixAPIFilterRules
@ -161,26 +161,26 @@ matrix_api_state_event_get_json_node
matrix_api_state_event_get_json_data matrix_api_state_event_get_json_data
<SUBSECTION Standard> <SUBSECTION Standard>
MATRIX_TYPE_API_EVENT_FORMAT MATRIX_TYPE_EVENT_FORMAT
matrix_api_event_format_get_type matrix_event_format_get_type
MATRIX_TYPE_API_ROOM_PRESET MATRIX_TYPE_ROOM_PRESET
matrix_api_room_preset_get_type matrix_room_preset_get_type
MATRIX_TYPE_API_ROOM_VISIBILITY MATRIX_TYPE_ROOM_VISIBILITY
matrix_api_room_visibility_get_type matrix_room_visibility_get_type
MATRIX_TYPE_API_RESIZE_METHOD MATRIX_TYPE_RESIZE_METHOD
matrix_api_resize_method_get_type matrix_resize_method_get_type
MATRIX_TYPE_API_PRESENCE MATRIX_TYPE_PRESENCE
matrix_api_presence_get_type matrix_presence_get_type
MATRIX_TYPE_API_PUSHER_KIND MATRIX_TYPE_PUSHER_KIND
matrix_api_pusher_kind_get_type matrix_pusher_kind_get_type
MATRIX_TYPE_API_PUSHER_CONDITION_KIND MATRIX_TYPE_PUSHER_CONDITION_KIND
matrix_api_pusher_condition_kind_get_type matrix_pusher_condition_kind_get_type
MATRIX_TYPE_API_EVENT_DIRECTION MATRIX_TYPE_EVENT_DIRECTION
matrix_api_event_direction_get_type matrix_event_direction_get_type
MATRIX_TYPE_API_RECEIPT_TYPE MATRIX_TYPE_RECEIPT_TYPE
matrix_api_receipt_type_get_type matrix_receipt_type_get_type
MATRIX_TYPE_API_ACCOUNT_KIND MATRIX_TYPE_ACCOUNT_KIND
matrix_api_account_kind_get_type matrix_account_kind_get_type
MATRIX_TYPE_API_FILTER_RULES MATRIX_TYPE_API_FILTER_RULES
matrix_api_filter_rules_get_type matrix_api_filter_rules_get_type
MATRIX_TYPE_API_ROOM_FILTER MATRIX_TYPE_API_ROOM_FILTER

View File

@ -389,7 +389,7 @@ matrix_api_media_thumbnail(MatrixAPI *api,
const gchar *media_id, const gchar *media_id,
guint width, guint width,
guint height, guint height,
MatrixAPIResizeMethod method, MatrixResizeMethod method,
GError **error) GError **error)
{ {
g_return_if_fail(MATRIX_IS_API(api)); g_return_if_fail(MATRIX_IS_API(api));
@ -594,7 +594,7 @@ matrix_api_set_user_presence(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *user_id, const gchar *user_id,
MatrixAPIPresence presence, MatrixPresence presence,
const gchar *status_message, const gchar *status_message,
GError **error) GError **error)
{ {
@ -703,7 +703,7 @@ matrix_api_delete_pusher(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *scope, const gchar *scope,
MatrixAPIPusherKind kind, MatrixPusherKind kind,
const gchar *rule_id, const gchar *rule_id,
GError **error) GError **error)
{ {
@ -747,7 +747,7 @@ matrix_api_get_pusher(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *scope, const gchar *scope,
MatrixAPIPusherKind kind, MatrixPusherKind kind,
const gchar *rule_id, const gchar *rule_id,
GError **error) GError **error)
{ {
@ -785,7 +785,7 @@ matrix_api_get_pusher(MatrixAPI *api,
* than this rule ID * than this rule ID
* @actions: (element-type utf8): the actions to perform when the * @actions: (element-type utf8): the actions to perform when the
* conditions for this rule are met * conditions for this rule are met
* @conditions: (element-type MatrixAPIPusherConditionKind) (allow-none): * @conditions: (element-type MatrixPusherConditionKind) (allow-none):
* the conditions that must hold true for an event for a * the conditions that must hold true for an event for a
* rule to be applied. A rule with no conditions always * rule to be applied. A rule with no conditions always
* matches * matches
@ -802,7 +802,7 @@ matrix_api_add_pusher(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *scope, const gchar *scope,
MatrixAPIPusherKind kind, MatrixPusherKind kind,
const gchar *rule_id, const gchar *rule_id,
const gchar *before, const gchar *before,
const gchar *after, const gchar *after,
@ -853,7 +853,7 @@ void matrix_api_toggle_pusher(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *scope, const gchar *scope,
MatrixAPIPusherKind kind, MatrixPusherKind kind,
const gchar *rule_id, const gchar *rule_id,
gboolean enabled, gboolean enabled,
GError **error) GError **error)
@ -906,11 +906,11 @@ void
matrix_api_create_room(MatrixAPI *api, matrix_api_create_room(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
MatrixAPIRoomPreset preset, MatrixRoomPreset preset,
const gchar *room_name, const gchar *room_name,
const gchar *room_alias, const gchar *room_alias,
const gchar *topic, const gchar *topic,
MatrixAPIRoomVisibility visibility, MatrixRoomVisibility visibility,
JsonNode *creation_content, JsonNode *creation_content,
GList *initial_state, GList *initial_state,
GList *invitees, GList *invitees,
@ -1551,7 +1551,7 @@ matrix_api_list_room_messages(MatrixAPI *api,
gpointer user_data, gpointer user_data,
const gchar *room_id, const gchar *room_id,
const gchar *from_token, const gchar *from_token,
MatrixAPIEventDirection direction, MatrixEventDirection direction,
guint limit, guint limit,
GError **error) GError **error)
{ {
@ -1597,7 +1597,7 @@ matrix_api_send_event_receipt(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *room_id, const gchar *room_id,
MatrixAPIReceiptType receipt_type, MatrixReceiptType receipt_type,
const gchar *event_id, const gchar *event_id,
JsonNode *receipt, JsonNode *receipt,
GError **error) GError **error)
@ -2462,7 +2462,7 @@ void
matrix_api_register_account(MatrixAPI *api, matrix_api_register_account(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
MatrixAPIAccountKind account_kind, MatrixAccountKind account_kind,
gboolean bind_email, gboolean bind_email,
const gchar *username, const gchar *username,
const gchar *password, const gchar *password,

View File

@ -76,7 +76,7 @@ struct _MatrixAPIInterface {
const gchar *media_id, const gchar *media_id,
guint width, guint width,
guint height, guint height,
MatrixAPIResizeMethod method, MatrixResizeMethod method,
GError **error); GError **error);
void (*media_upload)(MatrixAPI *api, void (*media_upload)(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
@ -107,7 +107,7 @@ struct _MatrixAPIInterface {
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *user_id, const gchar *user_id,
MatrixAPIPresence presence, MatrixPresence presence,
const gchar *status_message, const gchar *status_message,
GError **error); GError **error);
@ -125,21 +125,21 @@ struct _MatrixAPIInterface {
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *scope, const gchar *scope,
MatrixAPIPusherKind kind, MatrixPusherKind kind,
const gchar *rule_id, const gchar *rule_id,
GError **error); GError **error);
void (*get_pusher)(MatrixAPI *api, void (*get_pusher)(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *scope, const gchar *scope,
MatrixAPIPusherKind kind, MatrixPusherKind kind,
const gchar *rule_id, const gchar *rule_id,
GError **error); GError **error);
void (*add_pusher)(MatrixAPI *api, void (*add_pusher)(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *scope, const gchar *scope,
MatrixAPIPusherKind kind, MatrixPusherKind kind,
const gchar *rule_id, const gchar *rule_id,
const gchar *before, const gchar *before,
const gchar *after, const gchar *after,
@ -150,7 +150,7 @@ struct _MatrixAPIInterface {
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *scope, const gchar *scope,
MatrixAPIPusherKind kind, MatrixPusherKind kind,
const gchar *rule_id, const gchar *rule_id,
gboolean enabled, gboolean enabled,
GError **error); GError **error);
@ -159,11 +159,11 @@ struct _MatrixAPIInterface {
void (*create_room)(MatrixAPI *api, void (*create_room)(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
MatrixAPIRoomPreset preset, MatrixRoomPreset preset,
const gchar *room_name, const gchar *room_name,
const gchar *room_alias, const gchar *room_alias,
const gchar *topic, const gchar *topic,
MatrixAPIRoomVisibility visibility, MatrixRoomVisibility visibility,
JsonNode *creation_content, JsonNode *creation_content,
GList *initial_state, GList *initial_state,
GList *invitees, GList *invitees,
@ -272,14 +272,14 @@ struct _MatrixAPIInterface {
gpointer user_data, gpointer user_data,
const gchar *room_id, const gchar *room_id,
const gchar *from_token, const gchar *from_token,
MatrixAPIEventDirection direction, MatrixEventDirection direction,
guint limit, guint limit,
GError **error); GError **error);
void (*send_event_receipt)(MatrixAPI *api, void (*send_event_receipt)(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *room_id, const gchar *room_id,
MatrixAPIReceiptType receipt_type, MatrixReceiptType receipt_type,
const gchar *event_id, const gchar *event_id,
JsonNode *receipt, JsonNode *receipt,
GError **error); GError **error);
@ -423,7 +423,7 @@ struct _MatrixAPIInterface {
void (*register_account)(MatrixAPI *api, void (*register_account)(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
MatrixAPIAccountKind account_kind, MatrixAccountKind account_kind,
gboolean bind_email, gboolean bind_email,
const gchar *username, const gchar *username,
const gchar *password, const gchar *password,
@ -501,7 +501,7 @@ void matrix_api_media_thumbnail(MatrixAPI *api,
const gchar *media_id, const gchar *media_id,
guint width, guint width,
guint height, guint height,
MatrixAPIResizeMethod method, MatrixResizeMethod method,
GError **error); GError **error);
void matrix_api_media_upload(MatrixAPI *api, void matrix_api_media_upload(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
@ -532,7 +532,7 @@ void matrix_api_set_user_presence(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *user_id, const gchar *user_id,
MatrixAPIPresence presence, MatrixPresence presence,
const gchar *status_message, const gchar *status_message,
GError **error); GError **error);
@ -550,21 +550,21 @@ void matrix_api_delete_pusher(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *scope, const gchar *scope,
MatrixAPIPusherKind kind, MatrixPusherKind kind,
const gchar *rule_id, const gchar *rule_id,
GError **error); GError **error);
void matrix_api_get_pusher(MatrixAPI *api, void matrix_api_get_pusher(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *scope, const gchar *scope,
MatrixAPIPusherKind kind, MatrixPusherKind kind,
const gchar *rule_id, const gchar *rule_id,
GError **error); GError **error);
void matrix_api_add_pusher(MatrixAPI *api, void matrix_api_add_pusher(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *scope, const gchar *scope,
MatrixAPIPusherKind kind, MatrixPusherKind kind,
const gchar *rule_id, const gchar *rule_id,
const gchar *before, const gchar *before,
const gchar *after, const gchar *after,
@ -575,7 +575,7 @@ void matrix_api_toggle_pusher(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *scope, const gchar *scope,
MatrixAPIPusherKind kind, MatrixPusherKind kind,
const gchar *rule_id, const gchar *rule_id,
gboolean enabled, gboolean enabled,
GError **error); GError **error);
@ -584,11 +584,11 @@ void matrix_api_toggle_pusher(MatrixAPI *api,
void matrix_api_create_room(MatrixAPI *api, void matrix_api_create_room(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
MatrixAPIRoomPreset preset, MatrixRoomPreset preset,
const gchar *room_name, const gchar *room_name,
const gchar *room_alias, const gchar *room_alias,
const gchar *topic, const gchar *topic,
MatrixAPIRoomVisibility visibility, MatrixRoomVisibility visibility,
JsonNode *creation_content, JsonNode *creation_content,
GList *initial_state, GList *initial_state,
GList *invitees, GList *invitees,
@ -697,14 +697,14 @@ void matrix_api_list_room_messages(MatrixAPI *api,
gpointer user_data, gpointer user_data,
const gchar *room_id, const gchar *room_id,
const gchar *from_token, const gchar *from_token,
MatrixAPIEventDirection direction, MatrixEventDirection direction,
guint limit, guint limit,
GError **error); GError **error);
void matrix_api_send_event_receipt(MatrixAPI *api, void matrix_api_send_event_receipt(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *room_id, const gchar *room_id,
MatrixAPIReceiptType receipt_type, MatrixReceiptType receipt_type,
const gchar *event_id, const gchar *event_id,
JsonNode *receipt, JsonNode *receipt,
GError **error); GError **error);
@ -847,7 +847,7 @@ void matrix_api_set_display_name(MatrixAPI *api,
void matrix_api_register_account(MatrixAPI *api, void matrix_api_register_account(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
MatrixAPIAccountKind account_kind, MatrixAccountKind account_kind,
gboolean bind_email, gboolean bind_email,
const gchar *username, const gchar *username,
const gchar *password, const gchar *password,

View File

@ -903,11 +903,11 @@ static void
i_create_room(MatrixAPI *api, i_create_room(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
MatrixAPIRoomPreset preset, MatrixRoomPreset preset,
const gchar *room_name, const gchar *room_name,
const gchar *room_alias, const gchar *room_alias,
const gchar *topic, const gchar *topic,
MatrixAPIRoomVisibility visibility, MatrixRoomVisibility visibility,
JsonNode *creation_content, JsonNode *creation_content,
GList *initial_state, GList *initial_state,
GList *invitees, GList *invitees,
@ -966,9 +966,9 @@ i_create_room(MatrixAPI *api,
json_builder_add_string_value(builder, room_name); json_builder_add_string_value(builder, room_name);
} }
if (preset != MATRIX_API_ROOM_PRESET_NONE) { if (preset != MATRIX_ROOM_PRESET_NONE) {
gchar *preset_string = _g_enum_to_string( gchar *preset_string = _g_enum_to_string(
MATRIX_TYPE_API_ROOM_PRESET, preset, TRUE); MATRIX_TYPE_ROOM_PRESET, preset, TRUE);
if (preset_string) { if (preset_string) {
json_builder_set_member_name(builder, "preset"); json_builder_set_member_name(builder, "preset");
@ -989,9 +989,9 @@ i_create_room(MatrixAPI *api,
json_builder_add_string_value(builder, topic); json_builder_add_string_value(builder, topic);
} }
if (visibility != MATRIX_API_ROOM_VISIBILITY_DEFAULT) { if (visibility != MATRIX_ROOM_VISIBILITY_DEFAULT) {
gchar *visibility_string = _g_enum_to_string( gchar *visibility_string = _g_enum_to_string(
MATRIX_TYPE_API_ROOM_VISIBILITY, visibility, TRUE); MATRIX_TYPE_ROOM_VISIBILITY, visibility, TRUE);
if (visibility_string) { if (visibility_string) {
json_builder_set_member_name(builder, "visibility"); json_builder_set_member_name(builder, "visibility");
@ -1210,7 +1210,7 @@ i_media_thumbnail(MatrixAPI *api,
const gchar *media_id, const gchar *media_id,
guint width, guint width,
guint height, guint height,
MatrixAPIResizeMethod method, MatrixResizeMethod method,
GError **error) GError **error)
{ {
gchar *encoded_server_name, gchar *encoded_server_name,
@ -1236,14 +1236,14 @@ i_media_thumbnail(MatrixAPI *api,
g_hash_table_replace(params, "height", g_strdup_printf("%u", height)); g_hash_table_replace(params, "height", g_strdup_printf("%u", height));
} }
if (method != MATRIX_API_RESIZE_METHOD_DEFAULT) { if (method != MATRIX_RESIZE_METHOD_DEFAULT) {
switch (method) { switch (method) {
case MATRIX_API_RESIZE_METHOD_CROP: case MATRIX_RESIZE_METHOD_CROP:
g_hash_table_replace(params, "method", g_strdup("crop")); g_hash_table_replace(params, "method", g_strdup("crop"));
break; break;
case MATRIX_API_RESIZE_METHOD_SCALE: case MATRIX_RESIZE_METHOD_SCALE:
g_hash_table_replace(params, "method", g_strdup("scale")); g_hash_table_replace(params, "method", g_strdup("scale"));
break; break;
@ -1325,7 +1325,7 @@ i_set_user_presence(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *user_id, const gchar *user_id,
MatrixAPIPresence presence, MatrixPresence presence,
const gchar *status_message, const gchar *status_message,
GError **error) GError **error)
{ {
@ -1344,7 +1344,7 @@ i_set_user_presence(MatrixAPI *api,
json_builder_begin_object(builder); json_builder_begin_object(builder);
json_builder_set_member_name(builder, "presence"); json_builder_set_member_name(builder, "presence");
presence_string = _g_enum_to_string(MATRIX_TYPE_API_PRESENCE, presence, TRUE); presence_string = _g_enum_to_string(MATRIX_TYPE_PRESENCE, presence, TRUE);
json_builder_add_string_value(builder, presence_string); json_builder_add_string_value(builder, presence_string);
g_free(presence_string); g_free(presence_string);
@ -1404,7 +1404,7 @@ i_delete_pusher(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *scope, const gchar *scope,
MatrixAPIPusherKind kind, MatrixPusherKind kind,
const gchar *rule_id, const gchar *rule_id,
GError **error) GError **error)
{ {
@ -1412,7 +1412,7 @@ i_delete_pusher(MatrixAPI *api,
encoded_scope = soup_uri_encode(scope, NULL); encoded_scope = soup_uri_encode(scope, NULL);
encoded_rule_id = soup_uri_encode(rule_id, NULL); encoded_rule_id = soup_uri_encode(rule_id, NULL);
kind_string = _g_enum_to_string(MATRIX_TYPE_API_PUSHER_KIND, kind, TRUE); kind_string = _g_enum_to_string(MATRIX_TYPE_PUSHER_KIND, kind, TRUE);
path = g_strdup_printf("pushrules/%s/%s/%s", path = g_strdup_printf("pushrules/%s/%s/%s",
encoded_scope, encoded_scope,
@ -1436,7 +1436,7 @@ i_get_pusher(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *scope, const gchar *scope,
MatrixAPIPusherKind kind, MatrixPusherKind kind,
const gchar *rule_id, const gchar *rule_id,
GError **error) GError **error)
{ {
@ -1444,7 +1444,7 @@ i_get_pusher(MatrixAPI *api,
encoded_scope = soup_uri_encode(scope, NULL); encoded_scope = soup_uri_encode(scope, NULL);
encoded_rule_id = soup_uri_encode(rule_id, NULL); encoded_rule_id = soup_uri_encode(rule_id, NULL);
kind_string = _g_enum_to_string(MATRIX_TYPE_API_PUSHER_KIND, kind, TRUE); kind_string = _g_enum_to_string(MATRIX_TYPE_PUSHER_KIND, kind, TRUE);
path = g_strdup_printf("pushrules/%s/%s/%s", path = g_strdup_printf("pushrules/%s/%s/%s",
encoded_scope, encoded_scope,
@ -1464,11 +1464,11 @@ i_get_pusher(MatrixAPI *api,
} }
static void static void
add_condition_kind_object(MatrixAPIPusherConditionKind kind, add_condition_kind_object(MatrixPusherConditionKind kind,
JsonBuilder *builder) JsonBuilder *builder)
{ {
gchar *kind_string = _g_enum_to_string( gchar *kind_string = _g_enum_to_string(
MATRIX_TYPE_API_PUSHER_CONDITION_KIND, kind, TRUE); MATRIX_TYPE_PUSHER_CONDITION_KIND, kind, TRUE);
if (!kind_string) { if (!kind_string) {
g_warning("Invalid condition kind"); g_warning("Invalid condition kind");
@ -1488,7 +1488,7 @@ static void i_add_pusher(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *scope, const gchar *scope,
MatrixAPIPusherKind kind, MatrixPusherKind kind,
const gchar *rule_id, const gchar *rule_id,
const gchar *before, const gchar *before,
const gchar *after, const gchar *after,
@ -1503,7 +1503,7 @@ static void i_add_pusher(MatrixAPI *api,
encoded_scope = soup_uri_encode(scope, NULL); encoded_scope = soup_uri_encode(scope, NULL);
encoded_rule_id = soup_uri_encode(rule_id, NULL); encoded_rule_id = soup_uri_encode(rule_id, NULL);
kind_string = _g_enum_to_string(MATRIX_TYPE_API_PUSHER_KIND, kind, TRUE); kind_string = _g_enum_to_string(MATRIX_TYPE_PUSHER_KIND, kind, TRUE);
path = g_strdup_printf("pushrules/%s/%s/%s", path = g_strdup_printf("pushrules/%s/%s/%s",
encoded_scope, encoded_scope,
@ -1556,7 +1556,7 @@ i_toggle_pusher(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *scope, const gchar *scope,
MatrixAPIPusherKind kind, MatrixPusherKind kind,
const gchar *rule_id, const gchar *rule_id,
gboolean enabled, gboolean enabled,
GError **error) GError **error)
@ -1567,7 +1567,7 @@ i_toggle_pusher(MatrixAPI *api,
encoded_scope = soup_uri_encode(scope, NULL); encoded_scope = soup_uri_encode(scope, NULL);
encoded_rule_id = soup_uri_encode(rule_id, NULL); encoded_rule_id = soup_uri_encode(rule_id, NULL);
kind_string = _g_enum_to_string(MATRIX_TYPE_API_PUSHER_KIND, kind, TRUE); kind_string = _g_enum_to_string(MATRIX_TYPE_PUSHER_KIND, kind, TRUE);
path = g_strdup_printf("pushrules/%s/%s/%s", path = g_strdup_printf("pushrules/%s/%s/%s",
encoded_scope, encoded_scope,
@ -1898,7 +1898,7 @@ i_list_room_messages(MatrixAPI *api,
gpointer user_data, gpointer user_data,
const gchar *room_id, const gchar *room_id,
const gchar *from_token, const gchar *from_token,
MatrixAPIEventDirection direction, MatrixEventDirection direction,
guint limit, guint limit,
GError **error) GError **error)
{ {
@ -1914,12 +1914,12 @@ i_list_room_messages(MatrixAPI *api,
g_hash_table_replace(params, "from", g_strdup(from_token)); g_hash_table_replace(params, "from", g_strdup(from_token));
switch (direction) { switch (direction) {
case MATRIX_API_EVENT_DIRECTION_BACKWARD: case MATRIX_EVENT_DIRECTION_BACKWARD:
g_hash_table_replace(params, "dir", g_strdup("b")); g_hash_table_replace(params, "dir", g_strdup("b"));
break; break;
case MATRIX_API_EVENT_DIRECTION_FORWARD: case MATRIX_EVENT_DIRECTION_FORWARD:
g_hash_table_replace(params, "dir", g_strdup("f")); g_hash_table_replace(params, "dir", g_strdup("f"));
break; break;
@ -1942,7 +1942,7 @@ i_send_event_receipt(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
const gchar *room_id, const gchar *room_id,
MatrixAPIReceiptType receipt_type, MatrixReceiptType receipt_type,
const gchar *event_id, const gchar *event_id,
JsonNode *receipt, JsonNode *receipt,
GError **error) GError **error)
@ -1951,7 +1951,7 @@ i_send_event_receipt(MatrixAPI *api,
encoded_room_id = soup_uri_encode(room_id, NULL); encoded_room_id = soup_uri_encode(room_id, NULL);
encoded_event_id = soup_uri_encode(event_id, NULL); encoded_event_id = soup_uri_encode(event_id, NULL);
receipt_type_string = _g_enum_to_string(MATRIX_TYPE_API_RECEIPT_TYPE, receipt_type_string = _g_enum_to_string(MATRIX_TYPE_RECEIPT_TYPE,
receipt_type, receipt_type,
TRUE); TRUE);
path = g_strdup_printf("rooms/%s/receipt/%s/%s", path = g_strdup_printf("rooms/%s/receipt/%s/%s",
@ -2572,7 +2572,7 @@ static void
i_register_account(MatrixAPI *api, i_register_account(MatrixAPI *api,
MatrixAPICallback callback, MatrixAPICallback callback,
gpointer user_data, gpointer user_data,
MatrixAPIAccountKind account_kind, MatrixAccountKind account_kind,
gboolean bind_email, gboolean bind_email,
const gchar *username, const gchar *username,
const gchar *password, const gchar *password,
@ -2600,8 +2600,8 @@ i_register_account(MatrixAPI *api,
body = json_builder_get_root(builder); body = json_builder_get_root(builder);
g_object_unref(builder); g_object_unref(builder);
if (account_kind != MATRIX_API_ACCOUNT_KIND_DEFAULT) { if (account_kind != MATRIX_ACCOUNT_KIND_DEFAULT) {
gchar *kind_string = _g_enum_to_string(MATRIX_TYPE_API_ACCOUNT_KIND, gchar *kind_string = _g_enum_to_string(MATRIX_TYPE_ACCOUNT_KIND,
account_kind, TRUE); account_kind, TRUE);
params = create_query_params(); params = create_query_params();

View File

@ -81,165 +81,150 @@
G_DEFINE_QUARK(matrix-error-quark, matrix_error); G_DEFINE_QUARK(matrix-error-quark, matrix_error);
/** /**
* MatrixAPIEventFormat: * MatrixEventFormat:
* @MATRIX_API_EVENT_FORMAT_DEFAULT: event format will be omitted from * @MATRIX_EVENT_FORMAT_DEFAULT: event format will be omitted from the
* the filter, so the server will * filter, so the server will use its
* use its default (usually * default (usually
* @MATRIX_API_EVENT_FORMAT_FEDERATION) * @MATRIX_EVENT_FORMAT_FEDERATION)
* @MATRIX_API_EVENT_FORMAT_CLIENT: return the events in a format * @MATRIX_EVENT_FORMAT_CLIENT: return the events in a format suitable
* suitable for clients * for clients
* @MATRIX_API_EVENT_FORMAT_FEDERATION: return the raw event as * @MATRIX_EVENT_FORMAT_FEDERATION: return the raw event as receieved
* receieved over federation * over federation
* *
* Event format received when synchronizing. * Event format received when synchronizing.
*/ */
/** /**
* MatrixAPIRoomPreset: * MatrixRoomPreset:
* @MATRIX_API_ROOM_PRESET_NONE: no preset * @MATRIX_ROOM_PRESET_NONE: no preset
* @MATRIX_API_ROOM_PRESET_PRIVATE: preset for private rooms * @MATRIX_ROOM_PRESET_PRIVATE: preset for private rooms
* @MATRIX_API_ROOM_PRESET_TRUSTED_PRIVATE: same as private rooms, but * @MATRIX_ROOM_PRESET_TRUSTED_PRIVATE: same as private rooms, but all
* all users get the same * users get the same power level
* power level as the room * as the room creator
* creator * @MATRIX_ROOM_PRESET_PUBLIC: preset for public rooms
* @MATRIX_API_ROOM_PRESET_PUBLIC: preset for public rooms
* *
* Preset values for matrix_api_create_room() calls. * Preset values for matrix_api_create_room() calls.
*/ */
/** /**
* MatrixAPIRoomVisibility: * MatrixRoomVisibility:
* @MATRIX_API_ROOM_VISIBILITY_DEFAULT: use a server-assigned value * @MATRIX_ROOM_VISIBILITY_DEFAULT: use a server-assigned value
* (usually <code>private</code> * (usually <code>private</code>
* @MATRIX_API_ROOM_VISIBILITY_PUBLIC: make the room visible in the * @MATRIX_ROOM_VISIBILITY_PUBLIC: make the room visible in the public
* public room list * room list
* @MATRIX_API_ROOM_VISIBILITY_PRIVATE: hide the room from the public * @MATRIX_ROOM_VISIBILITY_PRIVATE: hide the room from the public room
* room list * list
* *
* Visibility values for room creation. Not to be confused with join * Visibility values for room creation. Not to be confused with join
* rules. * rules.
*/ */
/** /**
* MatrixAPIResizeMethod: * MatrixResizeMethod:
* @MATRIX_API_RESIZE_METHOD_DEFAULT: use the server default value * @MATRIX_RESIZE_METHOD_DEFAULT: use the server default value
* @MATRIX_API_RESIZE_METHOD_CROP: crop thumbnail to the requested * @MATRIX_RESIZE_METHOD_CROP: crop thumbnail to the requested size
* size * @MATRIX_RESIZE_METHOD_SCALE: scale thumbnail to the requested size
* @MATRIX_API_RESIZE_METHOD_SCALE: scale thumbnail to the requested
* size
* *
* Resizing methods for matrix_api_media_thumbnail(). * Resizing methods for matrix_api_media_thumbnail().
*/ */
/** /**
* MatrixAPIPresence: * MatrixPresence:
* @MATRIX_API_PRESENCE_ONLINE: user is online * @MATRIX_PRESENCE_ONLINE: user is online
* @MATRIX_API_PRESENCE_OFFLINE: user is offline * @MATRIX_PRESENCE_OFFLINE: user is offline
* @MATRIX_API_PRESENCE_UNAVAILABLE: user is unavailable (i.e. busy) * @MATRIX_PRESENCE_UNAVAILABLE: user is unavailable (i.e. busy)
* @MATRIX_API_PRESENCE_FREE_FOR_CHAT: user is free for chat * @MATRIX_PRESENCE_FREE_FOR_CHAT: user is free for chat
* *
* Presence values for matrix_api_set_user_presence() and other * Presence values for matrix_api_set_user_presence() and other
* presence related queries. * presence related queries.
*/ */
/** /**
* MatrixAPIPusherKind: * MatrixPusherKind:
* @MATRIX_API_PUSHER_KIND_OVERRIDE: highest priority rules * @MATRIX_PUSHER_KIND_OVERRIDE: highest priority rules
* @MATRIX_API_PUSHER_KIND_SENDER: for (unencrypted) messages that * @MATRIX_PUSHER_KIND_SENDER: for (unencrypted) messages that match
* match certain patterns * certain patterns
* @MATRIX_API_PUSHER_KIND_ROOM: for all messages for a given * @MATRIX_PUSHER_KIND_ROOM: for all messages for a given room. The
* room. The rule ID of a room rule is * rule ID of a room rule is always the ID
* always the ID of the room that it * of the room that it affects
* affects * @MATRIX_PUSHER_KIND_CONTENT: for messages from a specific Matrix
* @MATRIX_API_PUSHER_KIND_CONTENT: for messages from a specific * user ID. The rule ID of such rules is
* Matrix user ID. The rule ID of * always the Matrix ID of the user whose
* such rules is always the Matrix ID * messages they'd apply to
* of the user whose messages they'd * @MATRIX_PUSHER_KIND_UNDERRIDE: lowest priority rules
* apply to
* @MATRIX_API_PUSHER_KIND_UNDERRIDE: lowest priority rules
* *
* Pusher types. * Pusher types.
*/ */
/** /**
* MatrixAPIPusherConditionKind: * MatrixPusherConditionKind:
* @MATRIX_API_PUSHER_CONDITION_KIND_EVENT_MATCH: glob pattern match * @MATRIX_PUSHER_CONDITION_KIND_EVENT_MATCH: glob pattern match on a
* on a field of the * field of the
* event. Requires a * event. Requires a
* <code>key</code> and * <code>key</code> and a
* a * <code>pattern</code>
* <code>pattern</code> * parameter
* parameter * @MATRIX_PUSHER_CONDITION_KIND_PROFILE_TAG: matches the profile tag
* @MATRIX_API_PUSHER_CONDITION_KIND_PROFILE_TAG: matches the profile * of the device that the
* tag of the device * notification would be
* that the * delivered to. Requires a
* notification would * <code>profile_tag</code>
* be delivered * parameter
* to. Requires a * @MATRIX_PUSHER_CONDITION_KIND_CONTAINS_DISPLAY_NAME: matches
* <code>profile_tag</code> * unencrypted
* parameter * messages where
* @MATRIX_API_PUSHER_CONDITION_KIND_CONTAINS_DISPLAY_NAME: matches * the content's
* unencrypted * body contains
* messages * the owner's
* where the * display name
* content's * in that room.
* body * @MATRIX_PUSHER_CONDITION_KIND_ROOM_MEMBER_COUNT: matches the
* contains * current number of
* the * members in the
* owner's * room. Requires an
* display * <code>is</code>
* name in * parameter, which
* that room. * must be an
* @MATRIX_API_PUSHER_CONDITION_KIND_ROOM_MEMBER_COUNT: matches the * integer,
* current number * optionally
* of members in * prefixed by
* the * <code>==</code>,
* room. Requires * <code>&lt;</code>,
* an * <code>&gt;</code>,
* <code>is</code> * <code>&lt;=</code>
* parameter, * or
* which must be * <code>&gt;=</code>. If
* an integer, * the prefix is
* optionally * omitted, it
* prefixed by * defaults to
* <code>==</code>, * <code>==</code>
* <code>&lt;</code>,
* <code>&gt;</code>,
* <code>&lt;=</code>
* or
* <code>&gt;=</code>. If
* the prefix is
* omitted, it
* defaults to
* <code>==</code>
* *
* Condition types for pushers. * Condition types for pushers.
*/ */
/** /**
* MatrixAPIAccountKind: * MatrixAccountKind:
* @MATRIX_API_ACCOUNT_KIND_DEFAULT: use the server default (usually * @MATRIX_ACCOUNT_KIND_DEFAULT: use the server default (usually
* %MATRIX_API_ACCOUNT_KIND_USER) * %MATRIX_ACCOUNT_KIND_USER)
* @MATRIX_API_ACCOUNT_KIND_USER: normal user * @MATRIX_ACCOUNT_KIND_USER: normal user
* @MATRIX_API_ACCOUNT_KIND_GUEST: guest user * @MATRIX_ACCOUNT_KIND_GUEST: guest user
* *
* User account types. * User account types.
*/ */
/** /**
* MatrixAPIEventDirection: * MatrixEventDirection:
* @MATRIX_API_EVENT_DIRECTION_FORWARD: List events after the * @MATRIX_EVENT_DIRECTION_FORWARD: List events after the specified
* specified one * one
* @MATRIX_API_EVENT_DIRECTION_BACKWARD: List events before the * @MATRIX_EVENT_DIRECTION_BACKWARD: List events before the specified
* specified one * one
* *
* Direction of events when requesting an event context. * Direction of events when requesting an event context.
*/ */
/** /**
* MatrixAPIReceiptType: * MatrixReceiptType:
* @MATRIX_API_RECEIPT_TYPE_READ: indicate that the message has been * @MATRIX_RECEIPT_TYPE_READ: indicate that the message has been read
* read
* *
* Receipt types of acknowledgment. * Receipt types of acknowledgment.
*/ */
@ -1281,7 +1266,7 @@ matrix_api_room_filter_get_json_data(MatrixAPIRoomFilter *filter,
*/ */
struct _MatrixAPIFilter { struct _MatrixAPIFilter {
GList *event_fields; GList *event_fields;
MatrixAPIEventFormat event_format; MatrixEventFormat event_format;
MatrixAPIFilterRules *presence; MatrixAPIFilterRules *presence;
MatrixAPIRoomFilter *room; MatrixAPIRoomFilter *room;
guint refcount; guint refcount;
@ -1453,7 +1438,7 @@ matrix_api_filter_get_event_fields(MatrixAPIFilter *filter)
*/ */
void void
matrix_api_filter_set_event_format(MatrixAPIFilter *filter, matrix_api_filter_set_event_format(MatrixAPIFilter *filter,
MatrixAPIEventFormat event_format) MatrixEventFormat event_format)
{ {
filter->event_format = event_format; filter->event_format = event_format;
} }
@ -1466,7 +1451,7 @@ matrix_api_filter_set_event_format(MatrixAPIFilter *filter,
* *
* Returns: the event format currently set * Returns: the event format currently set
*/ */
MatrixAPIEventFormat MatrixEventFormat
matrix_api_filter_get_event_format(MatrixAPIFilter *filter) matrix_api_filter_get_event_format(MatrixAPIFilter *filter)
{ {
return filter->event_format; return filter->event_format;
@ -1564,7 +1549,7 @@ matrix_api_filter_get_json_node(MatrixAPIFilter *filter)
json_builder_set_member_name(builder, "event_format"); json_builder_set_member_name(builder, "event_format");
json_builder_add_string_value(builder, json_builder_add_string_value(builder,
_g_enum_to_string( _g_enum_to_string(
MATRIX_TYPE_API_EVENT_FORMAT, MATRIX_TYPE_EVENT_FORMAT,
filter->event_format, filter->event_format,
TRUE)); TRUE));

View File

@ -53,66 +53,66 @@ typedef enum {
GQuark matrix_error_quark(void); GQuark matrix_error_quark(void);
typedef enum { typedef enum {
MATRIX_API_EVENT_FORMAT_DEFAULT, MATRIX_EVENT_FORMAT_DEFAULT,
MATRIX_API_EVENT_FORMAT_CLIENT, MATRIX_EVENT_FORMAT_CLIENT,
MATRIX_API_EVENT_FORMAT_FEDERATION MATRIX_EVENT_FORMAT_FEDERATION
} MatrixAPIEventFormat; } MatrixEventFormat;
typedef enum { typedef enum {
MATRIX_API_RESIZE_METHOD_DEFAULT, MATRIX_RESIZE_METHOD_DEFAULT,
MATRIX_API_RESIZE_METHOD_CROP, MATRIX_RESIZE_METHOD_CROP,
MATRIX_API_RESIZE_METHOD_SCALE MATRIX_RESIZE_METHOD_SCALE
} MatrixAPIResizeMethod; } MatrixResizeMethod;
typedef enum { typedef enum {
MATRIX_API_PRESENCE_ONLINE, MATRIX_PRESENCE_ONLINE,
MATRIX_API_PRESENCE_OFFLINE, MATRIX_PRESENCE_OFFLINE,
MATRIX_API_PRESENCE_UNAVAILABLE, MATRIX_PRESENCE_UNAVAILABLE,
MATRIX_API_PRESENCE_FREE_FOR_CHAT MATRIX_PRESENCE_FREE_FOR_CHAT
} MatrixAPIPresence; } MatrixPresence;
typedef enum { typedef enum {
MATRIX_API_ROOM_PRESET_NONE, MATRIX_ROOM_PRESET_NONE,
MATRIX_API_ROOM_PRESET_PRIVATE, MATRIX_ROOM_PRESET_PRIVATE,
MATRIX_API_ROOM_PRESET_TRUSTED_PRIVATE, MATRIX_ROOM_PRESET_TRUSTED_PRIVATE,
MATRIX_API_ROOM_PRESET_PUBLIC MATRIX_ROOM_PRESET_PUBLIC
} MatrixAPIRoomPreset; } MatrixRoomPreset;
typedef enum { typedef enum {
MATRIX_API_ROOM_VISIBILITY_DEFAULT, MATRIX_ROOM_VISIBILITY_DEFAULT,
MATRIX_API_ROOM_VISIBILITY_PUBLIC, MATRIX_ROOM_VISIBILITY_PUBLIC,
MATRIX_API_ROOM_VISIBILITY_PRIVATE MATRIX_ROOM_VISIBILITY_PRIVATE
} MatrixAPIRoomVisibility; } MatrixRoomVisibility;
typedef enum { typedef enum {
MATRIX_API_EVENT_DIRECTION_FORWARD, MATRIX_EVENT_DIRECTION_FORWARD,
MATRIX_API_EVENT_DIRECTION_BACKWARD MATRIX_EVENT_DIRECTION_BACKWARD
} MatrixAPIEventDirection; } MatrixEventDirection;
typedef enum { typedef enum {
MATRIX_API_RECEIPT_TYPE_READ MATRIX_RECEIPT_TYPE_READ
} MatrixAPIReceiptType; } MatrixReceiptType;
typedef enum { typedef enum {
MATRIX_API_PUSHER_KIND_OVERRIDE, MATRIX_PUSHER_KIND_OVERRIDE,
MATRIX_API_PUSHER_KIND_SENDER, MATRIX_PUSHER_KIND_SENDER,
MATRIX_API_PUSHER_KIND_ROOM, MATRIX_PUSHER_KIND_ROOM,
MATRIX_API_PUSHER_KIND_CONTENT, MATRIX_PUSHER_KIND_CONTENT,
MATRIX_API_PUSHER_KIND_UNDERRIDE MATRIX_PUSHER_KIND_UNDERRIDE
} MatrixAPIPusherKind; } MatrixPusherKind;
typedef enum { typedef enum {
MATRIX_API_PUSHER_CONDITION_KIND_EVENT_MATCH, MATRIX_PUSHER_CONDITION_KIND_EVENT_MATCH,
MATRIX_API_PUSHER_CONDITION_KIND_PROFILE_TAG, MATRIX_PUSHER_CONDITION_KIND_PROFILE_TAG,
MATRIX_API_PUSHER_CONDITION_KIND_CONTAINS_DISPLAY_NAME, MATRIX_PUSHER_CONDITION_KIND_CONTAINS_DISPLAY_NAME,
MATRIX_API_PUSHER_CONDITION_KIND_ROOM_MEMBER_COUNT MATRIX_PUSHER_CONDITION_KIND_ROOM_MEMBER_COUNT
} MatrixAPIPusherConditionKind; } MatrixPusherConditionKind;
typedef enum { typedef enum {
MATRIX_API_ACCOUNT_KIND_DEFAULT, MATRIX_ACCOUNT_KIND_DEFAULT,
MATRIX_API_ACCOUNT_KIND_USER, MATRIX_ACCOUNT_KIND_USER,
MATRIX_API_ACCOUNT_KIND_GUEST MATRIX_ACCOUNT_KIND_GUEST
} MatrixAPIAccountKind; } MatrixAccountKind;
typedef struct _MatrixAPIFilterRules MatrixAPIFilterRules; typedef struct _MatrixAPIFilterRules MatrixAPIFilterRules;
@ -211,8 +211,8 @@ void matrix_api_filter_delete_event_field(MatrixAPIFilter *filter,
const gchar *event_field); const gchar *event_field);
const GList *matrix_api_filter_get_event_fields(MatrixAPIFilter *filter); const GList *matrix_api_filter_get_event_fields(MatrixAPIFilter *filter);
void matrix_api_filter_set_event_format(MatrixAPIFilter *filter, void matrix_api_filter_set_event_format(MatrixAPIFilter *filter,
MatrixAPIEventFormat event_format); MatrixEventFormat event_format);
MatrixAPIEventFormat matrix_api_filter_get_event_format(MatrixAPIFilter *filter); MatrixEventFormat matrix_api_filter_get_event_format(MatrixAPIFilter *filter);
void matrix_api_filter_set_presence_filter(MatrixAPIFilter *filter, void matrix_api_filter_set_presence_filter(MatrixAPIFilter *filter,
MatrixAPIFilterRules *presence_filter); MatrixAPIFilterRules *presence_filter);
MatrixAPIFilterRules *matrix_api_filter_get_presence_filter(MatrixAPIFilter *filter); MatrixAPIFilterRules *matrix_api_filter_get_presence_filter(MatrixAPIFilter *filter);

View File

@ -137,10 +137,10 @@ login_finished(MatrixAPI *api,
NULL); NULL);
matrix_api_create_room(api, matrix_api_create_room(api,
create_room_finished, NULL, create_room_finished, NULL,
MATRIX_API_ROOM_PRESET_PUBLIC, MATRIX_ROOM_PRESET_PUBLIC,
"GLib SDK test room", "matrix-glib-sdk-test", "GLib SDK test room", "matrix-glib-sdk-test",
"GLib SDK test room", "GLib SDK test room",
MATRIX_API_ROOM_VISIBILITY_DEFAULT, MATRIX_ROOM_VISIBILITY_DEFAULT,
NULL, NULL, NULL, NULL, NULL); NULL, NULL, NULL, NULL, NULL);
matrix_api_get_presence_list(api, NULL, NULL, user_id, NULL); matrix_api_get_presence_list(api, NULL, NULL, user_id, NULL);
matrix_api_get_user_presence(api, matrix_api_get_user_presence(api,