Fix state and room events

* State event descended from Event, but it is actually based on Room
* Room events may have a missing room_id property due to HS
* optimization
This commit is contained in:
2016-03-16 17:13:05 +01:00
committed by Gergely Polonkai
parent 62eb4e7e21
commit fcc592b072
3 changed files with 15 additions and 2 deletions

View File

@@ -115,6 +115,17 @@ public class Matrix.HTTPClient : Matrix.HTTPAPI, Matrix.Client {
if (evt != null) {
string? user_id = null;
GLib.Type evt_type = evt.get_type();
// Make sure Room events have room_id set, even if it was
// stripped by the HS
if (evt_type.is_a(typeof(Matrix.Event.Room))) {
Matrix.Event.Room revt = (Matrix.Event.Room)evt;
if (revt.room_id == null) {
revt.room_id = room_id;
}
}
if (evt.get_type().is_a(typeof(Matrix.Event.Presence))) {
var pevt = (Matrix.Event.Presence)evt;