0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-05-15 17:33:46 +02:00

ircd:Ⓜ️ Fix various occurrences of state_key="" considered falsy.

This commit is contained in:
Jason Volk 2023-02-24 18:30:25 -08:00
parent 5d7a4e4b36
commit 56984d59e9
3 changed files with 11 additions and 11 deletions

View file

@ -454,7 +454,7 @@ ircd::m::dbs::_index_event_refs_state(db::txn &txn,
if(!json::get<"room_id"_>(event)) if(!json::get<"room_id"_>(event))
return; return;
if(!json::get<"state_key"_>(event)) if(!defined(json::get<"state_key"_>(event)))
return; return;
const m::room room const m::room room
@ -531,7 +531,7 @@ ircd::m::dbs::_prefetch_event_refs_state(const event &event,
assert(json::get<"type"_>(event)); assert(json::get<"type"_>(event));
assert(json::get<"room_id"_>(event)); assert(json::get<"room_id"_>(event));
if(!json::get<"state_key"_>(event)) if(!defined(json::get<"state_key"_>(event)))
return false; return false;
const m::room room const m::room room

View file

@ -95,12 +95,12 @@ ircd::m::hook::maps::add(base &hook,
if(json::get<"sender"_>(matching)) if(json::get<"sender"_>(matching))
map(sender, at<"sender"_>(matching)); map(sender, at<"sender"_>(matching));
if(json::get<"state_key"_>(matching))
map(state_key, at<"state_key"_>(matching));
if(json::get<"type"_>(matching)) if(json::get<"type"_>(matching))
map(type, at<"type"_>(matching)); map(type, at<"type"_>(matching));
if(defined(json::get<"state_key"_>(matching)))
map(state_key, at<"state_key"_>(matching));
// Hook had no mappings which means it will match everything. // Hook had no mappings which means it will match everything.
// We don't increment the matcher count for this case. // We don't increment the matcher count for this case.
if(!ret) if(!ret)
@ -139,12 +139,12 @@ ircd::m::hook::maps::del(base &hook,
if(json::get<"sender"_>(matching)) if(json::get<"sender"_>(matching))
unmap(sender, at<"sender"_>(matching)); unmap(sender, at<"sender"_>(matching));
if(json::get<"state_key"_>(matching))
unmap(state_key, at<"state_key"_>(matching));
if(json::get<"type"_>(matching)) if(json::get<"type"_>(matching))
unmap(type, at<"type"_>(matching)); unmap(type, at<"type"_>(matching));
if(defined(json::get<"state_key"_>(matching)))
unmap(state_key, at<"state_key"_>(matching));
return ret; return ret;
} }
@ -178,7 +178,7 @@ const
if(json::get<"type"_>(event)) if(json::get<"type"_>(event))
site_match(type, at<"type"_>(event)); site_match(type, at<"type"_>(event));
if(json::get<"state_key"_>(event)) if(defined(json::get<"state_key"_>(event)))
site_match(state_key, at<"state_key"_>(event)); site_match(state_key, at<"state_key"_>(event));
auto it(begin(matching)); auto it(begin(matching));
@ -703,7 +703,7 @@ ircd::m::_hook_match(const m::event &matching,
if(at<"type"_>(matching) != json::get<"type"_>(event)) if(at<"type"_>(matching) != json::get<"type"_>(event))
return false; return false;
if(json::get<"state_key"_>(matching)) if(defined(json::get<"state_key"_>(matching)))
if(at<"state_key"_>(matching) != json::get<"state_key"_>(event)) if(at<"state_key"_>(matching) != json::get<"state_key"_>(event))
return false; return false;

View file

@ -92,7 +92,7 @@ ircd::m::sync::room_state_linear_events(data &data)
return false; return false;
assert(data.event); assert(data.event);
if(!json::get<"state_key"_>(*data.event)) if(!defined(json::get<"state_key"_>(*data.event)))
return false; return false;
const bool is_own_membership const bool is_own_membership