diff --git a/src/matrix-event-room-name.vala b/src/matrix-event-room-name.vala index d31d676..15430e7 100644 --- a/src/matrix-event-room-name.vala +++ b/src/matrix-event-room-name.vala @@ -33,9 +33,15 @@ public class Matrix.Event.RoomName : Matrix.Event.State { from_json(Json.Node json_data) throws Matrix.Error { - var content_root = json_data.get_object() - .get_member("content").get_object(); - Json.Node? node; + var root = json_data.get_object(); + var content_root = root.get_member("content").get_object(); + Json.Node? node = null; + + if (Config.DEBUG && ((node = root.get_member("state_key")) != null)) { + if (node.get_string() != "") { + warning("state_key of a m.room.name event is non-empty"); + } + } if ((node = content_root.get_member("name")) != null) { _name = node.get_string(); @@ -53,6 +59,11 @@ public class Matrix.Event.RoomName : Matrix.Event.State { var content_root = json_data.get_object() .get_member("content").get_object(); + if (_state_key != "") { + throw new Matrix.Error.INCOMPLETE( + "Won't send a m.room.name with a non-empty state key"); + } + if (_name == null) { throw new Matrix.Error.INCOMPLETE( "Won't send a m.room.name event without a name");