From 62b106511d85b678b01aa2d0247ca48d0cd8fe18 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Thu, 2 Nov 2017 09:59:24 +0100 Subject: [PATCH] Port MatrixRoomMembership to C --- src/matrix-c-types.c | 17 +++++++++++++++++ src/matrix-c-types.h | 9 +++++++++ src/matrix-types.vala | 42 ------------------------------------------ vapi/c-api.vapi | 10 ++++++++++ 4 files changed, 36 insertions(+), 42 deletions(-) diff --git a/src/matrix-c-types.c b/src/matrix-c-types.c index bef62fb..f16475d 100644 --- a/src/matrix-c-types.c +++ b/src/matrix-c-types.c @@ -171,3 +171,20 @@ G_DEFINE_QUARK(matrix-error-quark, matrix_error); * * Resizing methods for matrix_api_media_thumbnail(). */ + +/** + * MatrixRoomMembership: + * @MATRIX_ROOM_MEMBERSHIP_UNKNOWN: the membership sent by the server is unknown to this SDK + * @MATRIX_ROOM_MEMBERSHIP_INVITE: the user has been invited to join a room, but has not yet + * joined it. They may not participate in the room until they join + * @MATRIX_ROOM_MEMBERSHIP_JOIN: the user has joined the room (possibly after accepting an invite), + * and may participate in it + * @MATRIX_ROOM_MEMBERSHIP_LEAVE: the user was once joined to the room, but has since left + * (possibly by choice, or possibly by being kicked) + * @MATRIX_ROOM_MEMBERSHIP_BAN: the user has been banned from the room, and is no longer allowed + * to join it until they are un-banned from the room (by having their membership state set + * to a value other than MATRIX_ROOM_MEMBERSHIP_BAN) + * @MATRIX_ROOM_MEMBERSHIP_KNOCK: this is a reserved word, which currently has no meaning + * + * Room membership types. + */ diff --git a/src/matrix-c-types.h b/src/matrix-c-types.h index 8f837a0..1055dcc 100644 --- a/src/matrix-c-types.h +++ b/src/matrix-c-types.h @@ -124,4 +124,13 @@ typedef enum { MATRIX_RESIZE_METHOD_SCALE } MatrixResizeMethod; +typedef enum { + MATRIX_ROOM_MEMBERSHIP_UNKNOWN, + MATRIX_ROOM_MEMBERSHIP_INVITE, + MATRIX_ROOM_MEMBERSHIP_JOIN, + MATRIX_ROOM_MEMBERSHIP_LEAVE, + MATRIX_ROOM_MEMBERSHIP_BAN, + MATRIX_ROOM_MEMBERSHIP_KNOCK +} MatrixRoomMembership; + #endif /* __MATRIX_TYPE_H__ */ diff --git a/src/matrix-types.vala b/src/matrix-types.vala index ba2d39d..17c0210 100644 --- a/src/matrix-types.vala +++ b/src/matrix-types.vala @@ -17,48 +17,6 @@ */ namespace Matrix { - /** - * Room membership types. - */ - public enum RoomMembership { - /** - * the membership sent by the server is unknown to this SDK - */ - UNKNOWN, - - /** - * the user has been invited to join a room, but has not yet - * joined it. They may not participate in the room until they - * join - */ - INVITE, - - /** - * the user has joined the room (possibly after accepting an - * invite), and may participate in it - */ - JOIN, - - /** - * the user was once joined to the room, but has since left - * (possibly by choice, or possibly by being kicked) - */ - LEAVE, - - /** - * the user has been banned from the room, and is no longer - * allowed to join it until they are un-banned from the room - * (by having their membership state set to a value other than - * {@link Matrix.RoomMembership.BAN}) - */ - BAN, - - /** - * this is a reserved word, which currently has no meaning - */ - KNOCK; - } - /** * Preset values for matrix_api_create_room() calls. */ diff --git a/vapi/c-api.vapi b/vapi/c-api.vapi index 2911543..d578628 100644 --- a/vapi/c-api.vapi +++ b/vapi/c-api.vapi @@ -122,6 +122,16 @@ namespace Matrix { SCALE; } + [CCode (cheader_filename = "matrix-enumtypes.h", cprefix = "MATRIX_ROOM_MEMBERSHIP_")] + public enum RoomMembership { + UNKNOWN, + INVITE, + JOIN, + LEAVE, + BAN, + KNOCK; + } + /** * The major version number of the Matrix.org GLib SDK. */