Patch up Matrix.Event.RoomName
* Require an empty state_key
This commit is contained in:
parent
9be25a5d61
commit
75ab5512f1
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user