0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-16 15:00:51 +01:00

ircd:Ⓜ️:keys: Send old_verify_keys contents to cache.

ircd:Ⓜ️:keys: Minor cleanup.
This commit is contained in:
Jason Volk 2019-12-21 13:56:16 -08:00
parent 32819cbefd
commit 06373848bc

View file

@ -132,9 +132,9 @@ ircd::m::verify(const m::keys &keys)
at<"signatures"_>(keys) at<"signatures"_>(keys)
}; };
const string_view &server_name const json::string &server_name
{ {
unquote(at<"server_name"_>(keys)) at<"server_name"_>(keys)
}; };
const json::object &server_signatures const json::object &server_signatures
@ -478,21 +478,22 @@ ircd::m::keys::cache::set(const json::object &keys)
if(!exists(node_room.room_id)) if(!exists(node_room.room_id))
create(node_room, me()); create(node_room, me());
const json::object &vks const auto send_to_cache{[&node_room, &keys]
(const json::object::member &member)
{ {
keys.at("verify_keys") const json::string &key_id{member.first};
}; send(node_room, me(), "ircd.key", key_id, keys);
}};
size_t ret{0}; size_t ret{0};
for(const auto &member : vks) static const size_t max{32};
{ const json::object &vks{keys["verify_keys"]};
if(ret > 16) for(auto it(begin(vks)); it != end(vks) && ret < max; ++it, ++ret)
return ret; send_to_cache(*it);
const auto &key_id(unquote(member.first)); const json::object &old_vks{keys["old_verify_keys"]};
send(node_room, me(), "ircd.key", key_id, keys); for(auto it(begin(old_vks)); it != end(old_vks) && ret < max; ++it, ++ret)
++ret; send_to_cache(*it);
}
return ret; return ret;
} }