diff --git a/modules/m_feds.cc b/modules/m_feds.cc index 38aaf9dda..0332db3fc 100644 --- a/modules/m_feds.cc +++ b/modules/m_feds.cc @@ -23,7 +23,7 @@ namespace ircd::m::feds using request_list = std::list>; template using create_closure = std::function &, const string_view &origin)>; - template static request_list creator(const opts &, const create_closure &); + template static request_list for_each_in_room(const opts &, const create_closure &); static bool call_user(const closure &closure, const result &result); static bool handler(request_list &, const milliseconds &, const closure &); @@ -171,14 +171,14 @@ ircd::m::feds::send(const opts &opts, }; }}; - return creator(opts, make_request); + return for_each_in_room(opts, make_request); } ircd::m::feds::request_list ircd::m::feds::keys(const opts &opts, const closure &closure) { - const auto make_request{[&opts] + const auto make_request_to_room{[&opts] (auto &request, const auto &origin) { m::v1::key::query::opts v1opts; @@ -199,7 +199,7 @@ ircd::m::feds::keys(const opts &opts, }; }}; - return creator(opts, make_request); + return for_each_in_room(opts, make_request_to_room); } ircd::m::feds::request_list @@ -222,7 +222,7 @@ ircd::m::feds::version(const opts &opts, }; }}; - return creator(opts, make_request); + return for_each_in_room(opts, make_request); } ircd::m::feds::request_list @@ -247,7 +247,7 @@ ircd::m::feds::backfill(const opts &opts, }; }}; - return creator(opts, make_request); + return for_each_in_room(opts, make_request); } ircd::m::feds::request_list @@ -272,7 +272,7 @@ ircd::m::feds::state(const opts &opts, }; }}; - return creator(opts, make_request); + return for_each_in_room(opts, make_request); } ircd::m::feds::request_list @@ -295,7 +295,7 @@ ircd::m::feds::event(const opts &opts, }; }}; - return creator(opts, make_request); + return for_each_in_room(opts, make_request); } ircd::m::feds::request_list @@ -318,7 +318,7 @@ ircd::m::feds::auth(const opts &opts, }; }}; - return creator(opts, make_request); + return for_each_in_room(opts, make_request); } ircd::m::feds::request_list @@ -340,7 +340,7 @@ ircd::m::feds::head(const opts &opts, }; }}; - return creator(opts, make_request); + return for_each_in_room(opts, make_request); } /////////////////////////////////////////////////////////////////////////////// @@ -441,16 +441,18 @@ catch(const std::exception &) template ircd::m::feds::request_list -ircd::m::feds::creator(const opts &opts, - const std::function &, const string_view &origin)> &closure) +ircd::m::feds::for_each_in_room(const opts &opts, + const std::function &, const string_view &origin)> &closure) { - assert(opts.room_id); + request_list ret; + if(!opts.room_id) + return ret; + const m::room::origins origins { opts.room_id }; - request_list ret; origins.for_each([&opts, &ret, &closure] (const string_view &origin) {