From c91035dbd0576496eb16285b64538d8ce6345bd9 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Thu, 2 Nov 2017 09:43:31 +0100 Subject: [PATCH] Port MatrixPusherConditionKind to C --- src/matrix-c-types.c | 15 +++++++++++++++ src/matrix-c-types.h | 7 +++++++ src/matrix-types.vala | 32 -------------------------------- vapi/c-api.vapi | 8 ++++++++ 4 files changed, 30 insertions(+), 32 deletions(-) diff --git a/src/matrix-c-types.c b/src/matrix-c-types.c index 7dcf2e0..0451147 100644 --- a/src/matrix-c-types.c +++ b/src/matrix-c-types.c @@ -127,3 +127,18 @@ G_DEFINE_QUARK(matrix-error-quark, matrix_error); * * Presence values for matrix_api_set_presence() and other presence related queries. */ + +/** + * MatrixPusherConditionKind: + * @MATRIX_PUSHER_CONDITION_KIND_EVENT_MATCH: glob pattern match on a field of the event. + * Requires a `key` and a `pattern` parameter + * @MATRIX_PUSHER_CONDITION_KIND_PROFILE_TAG: matches the profile tag of the device that the + * notification would be delivered to. Requires a `profile_tag` parameter + * @MATRIX_PUSHER_CONDITION_KIND_CONTAINS_DISPLAY_NAME: matches unencrypted messages where the + * content's body contains the owner's display name in that room. + * @MATRIX_PUSHER_CONDITION_KIND_ROOM_MEMBER_COUNT: matches the current number of members in the + * room. Requires an `is` parameter, which must be an integer, optionally prefixed by `==`, + * `<`, `>`, `<=` or `>=`. If the prefix is omitted, it defaults to `==` + * + * Condition types for pushers. + */ diff --git a/src/matrix-c-types.h b/src/matrix-c-types.h index e4dc6a9..8a1d564 100644 --- a/src/matrix-c-types.h +++ b/src/matrix-c-types.h @@ -99,4 +99,11 @@ typedef enum { MATRIX_PRESENCE_FREE_FOR_CHAT } MatrixPresence; +typedef enum { + MATRIX_PUSHER_CONDITION_KIND_EVENT_MATCH, + MATRIX_PUSHER_CONDITION_KIND_PROFILE_TAG, + MATRIX_PUSHER_CONDITION_KIND_CONTAINS_DISPLAY_NAME, + MATRIX_PUSHER_CONDITION_KIND_ROOM_MEMBER_COUNT +} MatrixPusherConditionKind; + #endif /* __MATRIX_TYPE_H__ */ diff --git a/src/matrix-types.vala b/src/matrix-types.vala index cd44a87..03d475d 100644 --- a/src/matrix-types.vala +++ b/src/matrix-types.vala @@ -17,38 +17,6 @@ */ namespace Matrix { - /** - * Condition types for pushers. - */ - public enum PusherConditionKind { - /** - * glob pattern match on a field of the event. Requires a - * {{{key}}} and a {{{pattern}}} parameter - */ - EVENT_MATCH, - - /** - * matches the profile tag of the device that the notification - * would be delivered to. Requires a {{{profile_tag}}} - * parameter - */ - PROFILE_TAG, - - /** - * matches unencrypted messages where the content's body - * contains the owner's display name in that room. - */ - CONTAINS_DISPLAY_NAME, - - /** - * matches the current number of members in the room. Requires - * an {{{is}}} parameter, which must be an integer, optionally - * prefixed by {{{==}}}, {{{<}}}, {{{>}}}, {{{<=}}} or - * {{{>=}}}. If the prefix is omitted, it defaults to {{{==}}} - */ - ROOM_MEMBER_COUNT; - } - /** * Pusher types. */ diff --git a/vapi/c-api.vapi b/vapi/c-api.vapi index 99c961f..47d3a5e 100644 --- a/vapi/c-api.vapi +++ b/vapi/c-api.vapi @@ -93,6 +93,14 @@ namespace Matrix { FREE_FOR_CHAT; } + [CCode (cheader_filename = "matrix-enumtypes.h", cprefix = "MATRIX_PUSHER_CONDITION_KIND_")] + public enum PusherConditionKind { + EVENT_MATCH, + PROFILE_TAG, + CONTAINS_DISPLAY_NAME, + ROOM_MEMBER_COUNT; + } + /** * The major version number of the Matrix.org GLib SDK. */