diff --git a/.gitignore b/.gitignore index ac5d984..2c6fce7 100644 --- a/.gitignore +++ b/.gitignore @@ -85,3 +85,4 @@ Makefile.in /src/matrix-message-base.c /src/matrix-message-text.c /src/matrix-message-emote.c +/src/matrix-message-notice.c diff --git a/src/Makefile.am b/src/Makefile.am index a277dec..6c8cea1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -53,6 +53,7 @@ libmatrix_glib_0_0_la_VALA_SOURCES = \ matrix-message-base.vala \ matrix-message-text.vala \ matrix-message-emote.vala \ + matrix-message-notice.vala \ $(NULL) AM_CPPFLAGS += \ diff --git a/src/matrix-event-types.c b/src/matrix-event-types.c index c8c4042..4ce9680 100644 --- a/src/matrix-event-types.c +++ b/src/matrix-event-types.c @@ -228,6 +228,9 @@ matrix_event_types_ctor(void) matrix_message_register_type("m.emote", MATRIX_MESSAGE_TYPE_EMOTE, NULL); + matrix_message_register_type("m.notice", + MATRIX_MESSAGE_TYPE_NOTICE, + NULL); } void diff --git a/src/matrix-message-notice.vala b/src/matrix-message-notice.vala new file mode 100644 index 0000000..011754b --- /dev/null +++ b/src/matrix-message-notice.vala @@ -0,0 +1,31 @@ +/* + * 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 + * . + */ + +/** + * Message type to hold a m.notice message + * + * A m.notice message should be considered similar to a plain m.text + * message except that clients should visually distinguish it in some + * way. It is intended to be used by automated clients, such as bots, + * bridges, and other entities, rather than humans. Additionally, such + * automated agents which watch a room for messages and respond to + * them ought to ignore m.notice messages. This helps to prevent + * infinite-loop situations where two automated clients continuously + * exchange messages, as each responds to the other. + */ +public class Matrix.Message.Notice : Matrix.Message.Base {}