mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
modules/key/keys: Minor reduction.
This commit is contained in:
parent
65f7adc8c6
commit
9e793fde82
1 changed files with 9 additions and 12 deletions
|
@ -238,21 +238,18 @@ cache_get(const string_view &server_name,
|
||||||
node_id
|
node_id
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const auto reclosure{[&closure]
|
||||||
|
(const m::event &event)
|
||||||
|
{
|
||||||
|
closure(json::get<"content"_>(event));
|
||||||
|
}};
|
||||||
|
|
||||||
// Without a key_id we search for the most recent key; note this is not
|
// Without a key_id we search for the most recent key; note this is not
|
||||||
// the same as making a state_key="" query, as that would be an actual
|
// the same as making a state_key="" query, as that would be an actual
|
||||||
// ircd.key entry without an id (which shouldn't exist).
|
// ircd.key entry without an id (which shouldn't exist).
|
||||||
if(!key_id)
|
return !key_id?
|
||||||
return node_room.get(std::nothrow, "ircd.key", [&closure]
|
node_room.get(std::nothrow, "ircd.key", reclosure):
|
||||||
(const m::event &event)
|
node_room.get(std::nothrow, "ircd.key", key_id, reclosure);
|
||||||
{
|
|
||||||
closure(json::get<"content"_>(event));
|
|
||||||
});
|
|
||||||
|
|
||||||
return node_room.get(std::nothrow, "ircd.key", key_id, [&closure]
|
|
||||||
(const m::event &event)
|
|
||||||
{
|
|
||||||
closure(json::get<"content"_>(event));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|
Loading…
Reference in a new issue