From 47a5486258ea9764a1f84ca2539b678a317321f8 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 14 Mar 2019 17:31:34 -0700 Subject: [PATCH] modules/m_event: Enforce m.ignored_user_list for events to client. --- modules/m_event.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/modules/m_event.cc b/modules/m_event.cc index 5b9145b7f..3f0ba70b4 100644 --- a/modules/m_event.cc +++ b/modules/m_event.cc @@ -494,6 +494,23 @@ ircd::m::append(json::stack::object &object, }; #endif + if(!json::get<"state_key"_>(event) && has_user) + { + const m::user::ignores ignores{*opts.user_id}; + if(ignores.enforce("events") && ignores.has(json::get<"sender"_>(event))) + { + log::debug + { + log, "Not sending event '%s' because '%s' is ignored by '%s'", + json::get<"event_id"_>(event), + json::get<"sender"_>(event), + string_view{*opts.user_id} + }; + + return; + } + } + object.append(event); if(json::get<"state_key"_>(event) && has_event_idx)