From f97896a2502e24a0ed4d693ba129179293aa12e3 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Thu, 2 Nov 2017 09:36:06 +0100 Subject: [PATCH] Port MatrixPresence to C --- src/matrix-c-types.c | 11 +++++++++++ src/matrix-c-types.h | 8 ++++++++ src/matrix-types.vala | 31 ------------------------------- vapi/c-api.vapi | 9 +++++++++ 4 files changed, 28 insertions(+), 31 deletions(-) diff --git a/src/matrix-c-types.c b/src/matrix-c-types.c index d5eeed9..7dcf2e0 100644 --- a/src/matrix-c-types.c +++ b/src/matrix-c-types.c @@ -116,3 +116,14 @@ G_DEFINE_QUARK(matrix-error-quark, matrix_error); * * Event format received when synchronizing. */ + +/** + * MatrixPresence: + * @MATRIX_PRESENCE_UNKNOWN: user's presence is unknown + * @MATRIX_PRESENCE_ONLINE: user is online + * @MATRIX_PRESENCE_OFFLINE: user is offline + * @MATRIX_PRESENCE_UNAVAILABLE: user is unavailable (i.e. busy) + * @MATRIX_PRESENCE_FREE_FOR_CHAT: user is free for chat + * + * Presence values for matrix_api_set_presence() and other presence related queries. + */ diff --git a/src/matrix-c-types.h b/src/matrix-c-types.h index e3e21de..e4dc6a9 100644 --- a/src/matrix-c-types.h +++ b/src/matrix-c-types.h @@ -91,4 +91,12 @@ typedef enum { MATRIX_EVENT_FORMAT_FEDERATION } MatrixEventFormat; +typedef enum { + MATRIX_PRESENCE_UNKNOWN, + MATRIX_PRESENCE_ONLINE, + MATRIX_PRESENCE_OFFLINE, + MATRIX_PRESENCE_UNAVAILABLE, + MATRIX_PRESENCE_FREE_FOR_CHAT +} MatrixPresence; + #endif /* __MATRIX_TYPE_H__ */ diff --git a/src/matrix-types.vala b/src/matrix-types.vala index c0911b4..cd44a87 100644 --- a/src/matrix-types.vala +++ b/src/matrix-types.vala @@ -17,37 +17,6 @@ */ namespace Matrix { - /** - * Presence values for matrix_api_set_user_presence() and other - * presence related queries. - */ - public enum Presence { - /** - * user's presence is unknown - */ - UNKNOWN, - - /** - * user is online - */ - ONLINE, - - /** - * user is offline - */ - OFFLINE, - - /** - * user is unavailable (i.e. busy) - */ - UNAVAILABLE, - - /** - * user is free for chat - */ - FREE_FOR_CHAT; - } - /** * Condition types for pushers. */ diff --git a/vapi/c-api.vapi b/vapi/c-api.vapi index eb2c942..99c961f 100644 --- a/vapi/c-api.vapi +++ b/vapi/c-api.vapi @@ -84,6 +84,15 @@ namespace Matrix { FEDERATION; } + [CCode (cheader_filename = "matrix-enumtypes.h", cprefix = "MATRIX_PRESENCE_")] + public enum Presence { + UNKNOWN, + ONLINE, + OFFLINE, + UNAVAILABLE, + FREE_FOR_CHAT; + } + /** * The major version number of the Matrix.org GLib SDK. */