From 11d18ef27a9546e2c54bc70c739843407bb1225f Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Thu, 2 Nov 2017 10:25:05 +0100 Subject: [PATCH] Port MatrixSearchGroupBy to C --- src/matrix-c-types.c | 16 ++++++++++++++++ src/matrix-c-types.h | 6 ++++++ src/matrix-types.vala | 27 --------------------------- vapi/c-api.vapi | 7 +++++++ 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/src/matrix-c-types.c b/src/matrix-c-types.c index 0be7c27..ab01a63 100644 --- a/src/matrix-c-types.c +++ b/src/matrix-c-types.c @@ -237,3 +237,19 @@ G_DEFINE_QUARK(matrix-error-quark, matrix_error); * * Search keys. */ + +/** + * MatrixSearchGroupBy: + * @MATRIX_SEARCH_GROUP_BY_NONE: no grouping + * @MATRIX_SEARCH_GROUP_BY_ROOM_ID: group by room ID + * @MATRIX_SEARCH_GROUP_BY_SENDER: group by sender + * + * Search grouping + * + * The client can request that the results are returned along with + * grouping information, e.g. grouped by room_id. In this case the + * response will contain a group entry for each distinct value of + * room_id. Each group entry contains at least a list of the + * event_ids that are in that group, as well as potentially other + * metadata about the group. + */ diff --git a/src/matrix-c-types.h b/src/matrix-c-types.h index c3f49fe..ae6548e 100644 --- a/src/matrix-c-types.h +++ b/src/matrix-c-types.h @@ -165,4 +165,10 @@ typedef enum { MATRIX_SEARCH_KEY_CONTENT_TOPIC } MatrixSearchKey; +typedef enum { + MATRIX_SEARCH_GROUP_BY_NONE, + MATRIX_SEARCH_GROUP_BY_ROOM_ID, + MATRIX_SEARCH_GROUP_BY_SENDER +} MatrixSearchGroupBy; + #endif /* __MATRIX_TYPE_H__ */ diff --git a/src/matrix-types.vala b/src/matrix-types.vala index 93edd99..fbcafa1 100644 --- a/src/matrix-types.vala +++ b/src/matrix-types.vala @@ -17,33 +17,6 @@ */ namespace Matrix { - /** - * Search grouping - * - * The client can request that the results are returned along with - * grouping information, e.g. grouped by room_id. In this case the - * response will contain a group entry for each distinct value of - * room_id. Each group entry contains at least a list of the - * event_ids that are in that group, as well as potentially other - * metadata about the group. - */ - public enum SearchGroupBy { - /** - * no grouping - */ - NONE, - - /** - * group by room ID - */ - ROOM_ID, - - /** - * group by sender - */ - SENDER; - } - /** * Room history visibility */ diff --git a/vapi/c-api.vapi b/vapi/c-api.vapi index 6d8bba6..acece42 100644 --- a/vapi/c-api.vapi +++ b/vapi/c-api.vapi @@ -169,6 +169,13 @@ namespace Matrix { CONTENT_TOPIC; } + [CCode (cheader_filename = "matrix-enumtypes.h", cprefix = "MATRIX_SEARCH_GROUP_BY_")] + public enum SearchGroupBy { + NONE, + ROOM_ID, + SENDER; + } + /** * The major version number of the Matrix.org GLib SDK. */