0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-28 16:34:13 +01:00

modules/m_user_highlight: Simplify matching.

This commit is contained in:
Jason Volk 2019-08-07 02:10:05 -07:00
parent 2bc795b883
commit 45478ec0bc

View file

@ -199,23 +199,12 @@ const
json::get<"content"_>(event) json::get<"content"_>(event)
}; };
const string_view &formatted_body const json::string &body
{
content.get("formatted_body")
};
if(match(formatted_body))
return true;
const string_view &body
{ {
content.get("body") content.get("body")
}; };
if(match(body)) return match(body);
return true;
return false;
} }
bool bool
@ -223,7 +212,7 @@ IRCD_MODULE_EXPORT
ircd::m::user::highlight::match(const string_view &text) ircd::m::user::highlight::match(const string_view &text)
const const
{ {
if(likely(match_at_room)) if(match_at_room)
if(startswith(text, "@room")) if(startswith(text, "@room"))
return true; return true;