From 34b0bea88947d713b3ad41c880c278ba1e7e73a5 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Thu, 17 Mar 2016 14:56:13 +0100 Subject: [PATCH] Workaround for a missing user_id in m.presence MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Despite the Spec, it usually doesn’t have content.user_id, but does have sender --- src/matrix-event-presence.vala | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/matrix-event-presence.vala b/src/matrix-event-presence.vala index e6800cc..eb3372c 100644 --- a/src/matrix-event-presence.vala +++ b/src/matrix-event-presence.vala @@ -72,6 +72,12 @@ public class Matrix.Event.Presence : Matrix.Event.Base { _user_id = node.get_string(); } else if (Config.DEBUG) { warning("content.user_id is missing from the m.presence event"); + + // Workaround for having sender instead of content.user_id + // in most (room-dependent) presence events + if ((node = root.get_member("sender")) != null) { + _user_id = node.get_string(); + } } if ((node = content_root.get_member("last_active_ago")) != null) {