From 3a39c704f1ee43d7b8364284cbfc3c83cd42e2b6 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Mon, 7 Mar 2016 13:23:33 +0100 Subject: [PATCH] Add event handler for m.typing --- .gitignore | 1 + src/Makefile.am | 1 + src/matrix-event-types.c | 3 +++ src/matrix-event-typing.vala | 39 ++++++++++++++++++++++++++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 src/matrix-event-typing.vala diff --git a/.gitignore b/.gitignore index da85e34..8e4e030 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,4 @@ Makefile.in /src/matrix-event-room-message.c /src/namespace-info.c /src/matrix-event-room-topic.c +/src/matrix-event-typing.c diff --git a/src/Makefile.am b/src/Makefile.am index 3a65cea..e0f93ab 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -30,6 +30,7 @@ libmatrix_glib_0_0_la_VALA_SOURCES = \ matrix-event-room-member.vala \ matrix-event-room-message.vala \ matrix-event-room-topic.vala \ + matrix-event-typing.vala \ $(NULL) AM_CPPFLAGS += \ diff --git a/src/matrix-event-types.c b/src/matrix-event-types.c index 038521a..b017ff7 100644 --- a/src/matrix-event-types.c +++ b/src/matrix-event-types.c @@ -164,6 +164,9 @@ matrix_event_types_ctor(void) matrix_event_register_type("m.room.topic", MATRIX_EVENT_TYPE_ROOM_TOPIC, NULL); + matrix_event_register_type("m.typing", + MATRIX_EVENT_TYPE_TYPING, + NULL); } void diff --git a/src/matrix-event-typing.vala b/src/matrix-event-typing.vala new file mode 100644 index 0000000..ee72306 --- /dev/null +++ b/src/matrix-event-typing.vala @@ -0,0 +1,39 @@ +/* + * This file is part of matrix-glib-sdk + * + * matrix-glib-sdk is free software: you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation, either + * version 3 of the License, or (at your option) any later version. + * + * matrix-glib-sdk is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with matrix-glib-sdk. If not, see + * . + */ + +/** + * Class to hold an m.typing event. + * + * Informs the client of the list of users currently typing. + */ +public class Matrix.Event.Typing : Matrix.Event.Base { + private List? _user_ids = null; + + public string? room_id { get; set; default = null; } + public List? user_ids { + get { + return _user_ids; + } + + set { + _user_ids = value.copy(); + } + + default = null; + } +}