From 76d68d5c7b6d8cab6cb7a74a136060196e299c72 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Thu, 2 Nov 2017 10:13:09 +0100 Subject: [PATCH] Port MatrixJoinRules to C --- src/matrix-c-types.c | 11 +++++++++++ src/matrix-c-types.h | 8 ++++++++ src/matrix-types.vala | 30 ------------------------------ vapi/c-api.vapi | 9 +++++++++ 4 files changed, 28 insertions(+), 30 deletions(-) diff --git a/src/matrix-c-types.c b/src/matrix-c-types.c index 20ebba0..980968e 100644 --- a/src/matrix-c-types.c +++ b/src/matrix-c-types.c @@ -209,3 +209,14 @@ G_DEFINE_QUARK(matrix-error-quark, matrix_error); * * Visibility values for room creation. Not to be confused with join rules. */ + +/** + * MatrixJoinRules: + * @MATRIX_JOIN_RULES_UNKNOWN: a value unknown to this library + * @MATRIX_JOIN_RULES_PUBLIC: anyone can join + * @MATRIX_JOIN_RULES_INVITE: users may join upon invite + * @MATRIX_JOIN_RULES_PRIVATE: reserved word, not usable yet + * @MATRIX_JOIN_RULES_KNOCK: reserved word, not usable yet + * + * Room join rules. + */ diff --git a/src/matrix-c-types.h b/src/matrix-c-types.h index 321a592..54a9f4b 100644 --- a/src/matrix-c-types.h +++ b/src/matrix-c-types.h @@ -146,4 +146,12 @@ typedef enum { MATRIX_ROOM_VISIBILITY_PRIVATE } MatrixRoomVisibility; +typedef enum { + MATRIX_JOIN_RULES_UNKNOWN, + MATRIX_JOIN_RULES_PUBLIC, + MATRIX_JOIN_RULES_INVITE, + MATRIX_JOIN_RULES_PRIVATE, + MATRIX_JOIN_RULES_KNOCK +} MatrixJoinRules; + #endif /* __MATRIX_TYPE_H__ */ diff --git a/src/matrix-types.vala b/src/matrix-types.vala index 497da3b..4313e92 100644 --- a/src/matrix-types.vala +++ b/src/matrix-types.vala @@ -17,36 +17,6 @@ */ namespace Matrix { - /** - * Room join rules. - */ - public enum JoinRules { - /** - * a value unknown to this library - */ - UNKNOWN, - - /** - * anyone can join - */ - PUBLIC, - - /** - * users may join upon invite - */ - INVITE, - - /** - * reserved word, not usable yet - */ - PRIVATE, - - /** - * reserved word, not usable yet - */ - KNOCK; - } - /** * Search ordering. */ diff --git a/vapi/c-api.vapi b/vapi/c-api.vapi index 1fb6d0d..e95ccb7 100644 --- a/vapi/c-api.vapi +++ b/vapi/c-api.vapi @@ -147,6 +147,15 @@ namespace Matrix { PRIVATE; } + [CCode (cheader_filename = "matrix-enumtypes.h", cprefix = "MATRIX_JOIN_RULES_")] + public enum JoinRules { + UNKNOWN, + PUBLIC, + INVITE, + PRIVATE, + KNOCK; + } + /** * The major version number of the Matrix.org GLib SDK. */