mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 23:14:13 +01:00
ircd:Ⓜ️:feds: Add feds::event to interface.
This commit is contained in:
parent
2ce53fef3c
commit
dc93610914
3 changed files with 44 additions and 0 deletions
|
@ -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 &);
|
||||
};
|
||||
|
|
14
ircd/m.cc
14
ircd/m.cc
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue