diff --git a/.gitignore b/.gitignore
index c3a6f24..449472f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -68,4 +68,3 @@ Makefile.in
/src/matrix-event-call-answer.c
/src/matrix-event-call-hangup.c
/src/matrix-glib-0.0.pc
-/src/matrix-message-notice.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 03ed382..bd06851 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -35,7 +35,6 @@ libmatrix_glib_0_0_la_VALA_SOURCES = \
matrix-event-call-candidates.vala \
matrix-event-call-answer.vala \
matrix-event-call-hangup.vala \
- matrix-message-notice.vala \
$(NULL)
AM_CPPFLAGS += \
@@ -101,6 +100,7 @@ INST_H_SRC_FILES = \
matrix-message-image.h \
matrix-message-audio.h \
matrix-message-video.h \
+ matrix-message-notice.h \
matrix-event-room-base.h \
matrix-event-state-base.h \
matrix-event-tag.h \
@@ -145,6 +145,7 @@ libmatrix_glib_0_0_la_SOURCES = \
matrix-message-image.c \
matrix-message-audio.c \
matrix-message-video.c \
+ matrix-message-notice.c \
matrix-event-tag.c \
matrix-event-presence.c \
matrix-event-room-member.c \
diff --git a/src/matrix-event-types.c b/src/matrix-event-types.c
index c5b6f15..a40e3b4 100644
--- a/src/matrix-event-types.c
+++ b/src/matrix-event-types.c
@@ -35,6 +35,7 @@
#include "matrix-message-image.h"
#include "matrix-message-audio.h"
#include "matrix-message-video.h"
+#include "matrix-message-notice.h"
/*
Borrowed from GLib
diff --git a/src/matrix-message-notice.c b/src/matrix-message-notice.c
new file mode 100644
index 0000000..1d1dc61
--- /dev/null
+++ b/src/matrix-message-notice.c
@@ -0,0 +1,62 @@
+/*
+ * 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
+ * .
+ */
+
+#include "matrix-message-notice.h"
+
+/**
+ * SECTION:matrix-message-notice
+ * @short_description: message type representing notices
+ *
+ * This is the default message handler for `m.notice` messages.
+ *
+ * A notice should be considered similar to a plain text messages 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 notices. This
+ * helps to prevent infinite loop situations where two automated clients continuously exchange
+ * messages, as each responds to the other.
+ */
+G_DEFINE_TYPE(MatrixMessageNotice, matrix_message_notice, MATRIX_MESSAGE_TYPE_BASE);
+
+static void
+matrix_message_notice_real_from_json(MatrixMessageBase *matrix_message_base, JsonNode *json_data, GError **error)
+{
+ MATRIX_MESSAGE_BASE_CLASS(matrix_message_notice_parent_class)->from_json(matrix_message_base, json_data, error);
+}
+
+static void
+matrix_message_notice_real_to_json(MatrixMessageBase *matrix_message_base, JsonNode *json_data, GError **error)
+{
+ MATRIX_MESSAGE_BASE_CLASS(matrix_message_notice_parent_class)->to_json(matrix_message_base, json_data, error);
+}
+
+MatrixMessageNotice *
+matrix_message_notice_new(void) {
+ return (MatrixMessageNotice *)matrix_message_base_construct(MATRIX_MESSAGE_TYPE_NOTICE);
+}
+
+static void
+matrix_message_notice_class_init(MatrixMessageNoticeClass *klass)
+{
+ ((MatrixMessageBaseClass *)klass)->from_json = matrix_message_notice_real_from_json;
+ ((MatrixMessageBaseClass *)klass)->to_json = matrix_message_notice_real_to_json;
+}
+
+static void
+matrix_message_notice_init(MatrixMessageNotice *matrix_message_notice)
+{}
diff --git a/src/matrix-message-notice.h b/src/matrix-message-notice.h
new file mode 100644
index 0000000..0a83df5
--- /dev/null
+++ b/src/matrix-message-notice.h
@@ -0,0 +1,38 @@
+/*
+ * 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
+ * .
+ */
+
+#ifndef __MATRIX_GLIB_SDK_MESSAGE_NOTICE_H__
+# define __MATRIX_GLIB_SDK_MESSAGE_NOTICE_H__
+
+# include
+# include "matrix-message-base.h"
+
+G_BEGIN_DECLS
+
+#define MATRIX_MESSAGE_TYPE_NOTICE (matrix_message_notice_get_type ())
+G_DECLARE_DERIVABLE_TYPE(MatrixMessageNotice, matrix_message_notice, MATRIX_MESSAGE, NOTICE, MatrixMessageBase)
+
+struct _MatrixMessageNoticeClass {
+ MatrixMessageBaseClass parent_class;
+};
+
+MatrixMessageNotice* matrix_message_notice_new (void);
+
+G_END_DECLS
+
+#endif /* __MATRIX_GLIB_SDK_MESSAGE_NOTICE_H__ */
diff --git a/src/matrix-message-notice.vala b/src/matrix-message-notice.vala
deleted file mode 100644
index 47b4b38..0000000
--- a/src/matrix-message-notice.vala
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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 {
- public override void
- from_json(Json.Node json_data)
- throws Matrix.Error
- {
- base.from_json(json_data);
- }
-
- public override void
- to_json(Json.Node json_data)
- throws Matrix.Error
- {
- base.to_json(json_data);
- }
-}
diff --git a/vapi/c-api.vapi b/vapi/c-api.vapi
index 31a392d..3b1443f 100644
--- a/vapi/c-api.vapi
+++ b/vapi/c-api.vapi
@@ -837,5 +837,16 @@ namespace Matrix {
to_json(Json.Node json_data)
throws Matrix.Error;
}
+
+ [CCode (cheader_filename = "matrix-message-notice.h")]
+ public class Notice : Base {
+ public override void
+ from_json(Json.Node json_data)
+ throws Matrix.Error;
+
+ public override void
+ to_json(Json.Node json_data)
+ throws Matrix.Error;
+ }
}
}