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:
Gergely Polonkai 2016-03-07 15:02:27 +01:00 committed by Gergely Polonkai
parent 3a39c704f1
commit 26d144c593
1 changed files with 21 additions and 0 deletions

View File

@ -54,4 +54,25 @@ public abstract class Matrix.Event.State : Matrix.Event.Base {
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;
}
}