From 7861f77015ca12c1b3b82f8486f7883d2b47ceeb Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 23 Mar 2020 19:32:01 -0700 Subject: [PATCH] ircd::m::push: Add branch to handle other pattern key for content rules. --- matrix/push.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/matrix/push.cc b/matrix/push.cc index 8031b0f5d..26f4e1819 100644 --- a/matrix/push.cc +++ b/matrix/push.cc @@ -73,12 +73,20 @@ ircd::m::push::match::match(const event &event, const match::opts &opts) :boolean{[&event, &rule, &opts] { - const auto &conditions + if(json::get<"pattern"_>(rule)) { - json::get<"conditions"_>(rule) - }; + const push::cond cond + { + { "kind", "event_match" }, + { "key", "content.body" }, + { "pattern", json::get<"pattern"_>(rule) }, + }; - for(const json::object &cond : conditions) + if(!match(event, cond, opts)) + return false; + } + + for(const json::object &cond : json::get<"conditions"_>(rule)) if(!match(event, push::cond(cond), opts)) return false;