0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

ircd:Ⓜ️:feds: Add feds::event to interface.

This commit is contained in:
Jason Volk 2019-04-12 00:16:27 -07:00
parent 2ce53fef3c
commit dc93610914
3 changed files with 44 additions and 0 deletions

View file

@ -18,6 +18,7 @@ namespace ircd::m::feds
using closure = std::function<bool (const result &)>;
bool head(const opts &, const closure &);
bool event(const opts &, const closure &);
bool state(const opts &, const closure &);
bool version(const opts &, const closure &);
};

View file

@ -1073,6 +1073,20 @@ ircd::m::feds::version(const opts &o,
return call(o, c);
}
bool
ircd::m::feds::event(const opts &o,
const closure &c)
{
using prototype = bool (const opts &, const closure &);
static mods::import<prototype> call
{
"federation_federation", "ircd::m::feds::event"
};
return call(o, c);
}
bool
ircd::m::feds::head(const opts &o,
const closure &c)

View file

@ -186,6 +186,35 @@ ircd::m::feds::state(const opts &opts,
return handler(opts, closure, requests);
}
bool
IRCD_MODULE_EXPORT
ircd::m::feds::event(const opts &opts,
const closure &closure)
{
const auto make_request{[&opts]
(auto &request, const auto &origin)
{
m::v1::event::opts v1opts;
v1opts.dynamic = true;
v1opts.remote = string_view
{
request.origin, strlcpy{request.origin, origin}
};
return m::v1::event
{
opts.event_id, request.buf, std::move(v1opts)
};
}};
auto requests
{
creator<m::v1::event>(opts, make_request)
};
return handler(opts, closure, requests);
}
bool
IRCD_MODULE_EXPORT
ircd::m::feds::head(const opts &opts,