0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-05 13:28:54 +01:00

modules/m_event: Tweak conditions for is_power_event().

This commit is contained in:
Jason Volk 2019-04-27 15:59:56 -07:00
parent 0cdbe472d1
commit 48f339ac82

View file

@ -1242,6 +1242,9 @@ bool
IRCD_MODULE_EXPORT
ircd::m::event::auth::is_power_event(const m::event &event)
{
if(!json::get<"type"_>(event))
return false;
if(json::get<"type"_>(event) == "m.room.create")
return true;
@ -1254,7 +1257,10 @@ ircd::m::event::auth::is_power_event(const m::event &event)
if(json::get<"type"_>(event) != "m.room.member")
return false;
if(at<"sender"_>(event) == at<"state_key"_>(event))
if(!json::get<"sender"_>(event) || !json::get<"state_key"_>(event))
return false;
if(json::get<"sender"_>(event) == json::get<"state_key"_>(event))
return false;
if(membership(event) == "leave" || membership(event) == "ban")