From 45478ec0bc7baac05d16c99a0f36ba67d70a5052 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 7 Aug 2019 02:10:05 -0700 Subject: [PATCH] modules/m_user_highlight: Simplify matching. --- modules/m_user_highlight.cc | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/modules/m_user_highlight.cc b/modules/m_user_highlight.cc index d4e08cec2..d4c0a657c 100644 --- a/modules/m_user_highlight.cc +++ b/modules/m_user_highlight.cc @@ -199,23 +199,12 @@ const json::get<"content"_>(event) }; - const string_view &formatted_body - { - content.get("formatted_body") - }; - - if(match(formatted_body)) - return true; - - const string_view &body + const json::string &body { content.get("body") }; - if(match(body)) - return true; - - return false; + return match(body); } bool @@ -223,7 +212,7 @@ IRCD_MODULE_EXPORT ircd::m::user::highlight::match(const string_view &text) const { - if(likely(match_at_room)) + if(match_at_room) if(startswith(text, "@room")) return true;