0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-01-13 08:23:56 +01:00

ircd:Ⓜ️:feds: Add central interface linkage for feds head.

This commit is contained in:
Jason Volk 2018-09-25 17:09:31 -07:00
parent 295a08fc07
commit c90b530656
3 changed files with 53 additions and 15 deletions

View file

@ -13,6 +13,7 @@
namespace ircd::m::feds
{
struct head;
struct state;
}
@ -23,3 +24,12 @@ struct ircd::m::feds::state
state(const m::room::id &, const m::event::id &, const milliseconds &, const closure &);
state(const m::room::id &, const m::event::id &, const closure &);
};
struct ircd::m::feds::head
{
using closure = std::function<bool (const string_view &, std::exception_ptr, const json::object &)>;
head(const m::room::id &, const m::user::id &, const milliseconds &, const closure &);
head(const m::room::id &, const m::user::id &, const closure &);
head(const m::room::id &, const closure &);
};

View file

@ -416,6 +416,48 @@ ircd::m::feds::state::state(const m::room::id &room_id,
feds__state(room_id, event_id, to, view);
}
//
// head
//
ircd::m::feds::head::head(const m::room::id &room_id,
const closure &view)
:head
{
room_id, m::me.user_id, view
}
{
}
ircd::m::feds::head::head(const m::room::id &room_id,
const m::user::id &user_id,
const closure &view)
:head
{
//TODO: conf
room_id, user_id, seconds(20), view
}
{
}
ircd::m::feds::head::head(const m::room::id &room_id,
const m::user::id &user_id,
const milliseconds &to,
const closure &view)
{
using prototype = void (const m::room::id &,
const m::user::id &,
const milliseconds &,
const closure &);
static mods::import<prototype> feds__head
{
"federation_federation", "feds__head"
};
feds__head(room_id, user_id, to, view);
}
///////////////////////////////////////////////////////////////////////////////
//
// m/vm.h

View file

@ -7020,21 +7020,7 @@ console_cmd__feds__head(opt &out, const string_view &line)
param.at(1, m::me.user_id)
};
using closure_prototype = bool (const string_view &,
std::exception_ptr,
const json::object &);
using prototype = void (const m::room::id &,
const m::user::id &,
const milliseconds &,
const std::function<closure_prototype> &);
static mods::import<prototype> feds__head
{
"federation_federation", "feds__head"
};
feds__head(room_id, user_id, out.timeout, [&out]
m::feds::head(room_id, user_id, out.timeout, [&out]
(const string_view &origin, std::exception_ptr eptr, const json::object &event)
{
if(eptr)