From 25f809d37e9fd48f233ddf0472c40e15ee5a42ac Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Thu, 2 Nov 2017 09:30:04 +0100 Subject: [PATCH] Port MatrixEventFormat to C --- src/matrix-c-types.c | 10 ++++++++++ src/matrix-c-types.h | 6 ++++++ src/matrix-types.vala | 22 ---------------------- vapi/c-api.vapi | 7 +++++++ 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/matrix-c-types.c b/src/matrix-c-types.c index 83ecebd..d5eeed9 100644 --- a/src/matrix-c-types.c +++ b/src/matrix-c-types.c @@ -106,3 +106,13 @@ G_DEFINE_QUARK(matrix-error-quark, matrix_error); * * Direction of events when requesting an event context. */ + +/** + * MatrixEventFormat: + * @MATRIX_EVENT_FORMAT_DEFAULT: event format will be omitted from the filter, so the server + * will use its default (usually #MATRIX_EVENT_FORMAT_FEDERATION) + * @MATRIX_EVENT_FORMAT_CLIENT: return the events in a format suitable for clients + * @MATRIX_EVENT_FORMAT_FEDERATION: return the raw event as receieved over federation + * + * Event format received when synchronizing. + */ diff --git a/src/matrix-c-types.h b/src/matrix-c-types.h index 1d07209..e3e21de 100644 --- a/src/matrix-c-types.h +++ b/src/matrix-c-types.h @@ -85,4 +85,10 @@ typedef enum { MATRIX_EVENT_DIRECTION_BACKWARD } MatrixEventDirection; +typedef enum { + MATRIX_EVENT_FORMAT_DEFAULT, + MATRIX_EVENT_FORMAT_CLIENT, + MATRIX_EVENT_FORMAT_FEDERATION +} MatrixEventFormat; + #endif /* __MATRIX_TYPE_H__ */ diff --git a/src/matrix-types.vala b/src/matrix-types.vala index 24428f3..c0911b4 100644 --- a/src/matrix-types.vala +++ b/src/matrix-types.vala @@ -17,28 +17,6 @@ */ namespace Matrix { - /** - * Event format received when synchronizing. - */ - public enum EventFormat { - /** - * event format will be omitted from the filter, so the server - * will use its default (usually - * {@link Matrix.EventFormat.FEDERATION}) - */ - DEFAULT, - - /** - * return the events in a format suitable for clients - */ - CLIENT, - - /** - * return the raw event as receieved over federation - */ - FEDERATION; - } - /** * Presence values for matrix_api_set_user_presence() and other * presence related queries. diff --git a/vapi/c-api.vapi b/vapi/c-api.vapi index 59b1bcd..eb2c942 100644 --- a/vapi/c-api.vapi +++ b/vapi/c-api.vapi @@ -77,6 +77,13 @@ namespace Matrix { BACKWARD; } + [CCode (cheader_filename = "matrix-enumtypes.h", cprefix = "MATRIX_EVENT_FORMAT_")] + public enum EventFormat { + DEFAULT, + CLIENT, + FEDERATION; + } + /** * The major version number of the Matrix.org GLib SDK. */