Patch up Matrix.Event.RoomCreate
* Require an empty state key
This commit is contained in:
parent
be2220b079
commit
3fe5b57d1c
@ -38,9 +38,15 @@ public class Matrix.Event.RoomCreate : Matrix.Event.State {
|
|||||||
from_json(Json.Node json_data)
|
from_json(Json.Node json_data)
|
||||||
throws Matrix.Error
|
throws Matrix.Error
|
||||||
{
|
{
|
||||||
var content_root = json_data.get_object()
|
var root = json_data.get_object();
|
||||||
.get_member("content").get_object();
|
var content_root = root.get_member("content").get_object();
|
||||||
Json.Node? node;
|
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.create event is non-empty");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((node = content_root.get_member("creator")) != null) {
|
if ((node = content_root.get_member("creator")) != null) {
|
||||||
_creator = node.get_string();
|
_creator = node.get_string();
|
||||||
@ -61,7 +67,12 @@ public class Matrix.Event.RoomCreate : Matrix.Event.State {
|
|||||||
{
|
{
|
||||||
if (_creator == null) {
|
if (_creator == null) {
|
||||||
throw new Matrix.Error.INCOMPLETE(
|
throw new Matrix.Error.INCOMPLETE(
|
||||||
"Won't send a m.room.create event without a creator key");
|
"Won't generate a m.room.create event without a creator key");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state_key != "") {
|
||||||
|
throw new Matrix.Error.INCOMPLETE(
|
||||||
|
"Won't generater a m.root.create event with a non-empty state_key");
|
||||||
}
|
}
|
||||||
|
|
||||||
var content_root = json_data.get_object()
|
var content_root = json_data.get_object()
|
||||||
|
Loading…
Reference in New Issue
Block a user