Add Matrix.Event.State.get_stripped_node()
This returns the full state event if it is allowed to be stripped. It is needed for m.room.member events.
This commit is contained in:
parent
3a39c704f1
commit
26d144c593
@ -54,4 +54,25 @@ public abstract class Matrix.Event.State : Matrix.Event.Base {
|
|||||||
|
|
||||||
base.to_json(json_node);
|
base.to_json(json_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a stripped state event.
|
||||||
|
*
|
||||||
|
* @return `null` if the event is not allowed to be stripped, or
|
||||||
|
* the full JSON node otherwise
|
||||||
|
*/
|
||||||
|
public Json.Node?
|
||||||
|
get_stripped_node()
|
||||||
|
{
|
||||||
|
if ((_event_type != "m.room.join_rules")
|
||||||
|
&& (_event_type != "m.room.canonical_alias")
|
||||||
|
&& (_event_type != "m.room.avatar")
|
||||||
|
&& (_event_type != "m.room.name")) {
|
||||||
|
warning("Trying to strip down event that is not allowed to be stripped.");
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return json;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user