Skip to content

Commit

Permalink
modules/m_event: Enforce m.ignored_user_list for events to client.
Browse files Browse the repository at this point in the history
  • Loading branch information
jevolk committed Mar 15, 2019
1 parent ddb08a3 commit 47a5486
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions modules/m_event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 47a5486

Please sign in to comment.