From 43e36861cc8cda3bc424e00cb5cb593df537f3c5 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 27 Apr 2019 17:23:37 -0700 Subject: [PATCH] modules/m_room_history_visibility: Add some more rules for node visibility. --- modules/m_room_history_visibility.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/modules/m_room_history_visibility.cc b/modules/m_room_history_visibility.cc index f4001b5d8..9fe709897 100644 --- a/modules/m_room_history_visibility.cc +++ b/modules/m_room_history_visibility.cc @@ -64,7 +64,21 @@ _visible_(const m::event &event, room }; - return origins.has(node_id.host()); + // Allow joined servers + if(origins.has(node_id.host())) + return true; + + // Allow auth chain events XXX: this is too broad + if(m::event::auth::is_power_event(event)) + return true; + + // Allow any event where the state_key string is a user mxid and the server + // is the host of that user. Note that applies to any type of event. + if(m::valid(m::id::USER, json::get<"state_key"_>(event))) + if(m::user::id(at<"state_key"_>(event)).host() == node_id.host()) + return true; + + return false; } static bool