mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 23:14:13 +01:00
ircd:Ⓜ️ Add central linkage for m::feds::state.
This commit is contained in:
parent
4cdec1bce6
commit
02d1cd1115
4 changed files with 60 additions and 17 deletions
25
include/ircd/m/feds.h
Normal file
25
include/ircd/m/feds.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
// Matrix Construct
|
||||
//
|
||||
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
|
||||
//
|
||||
// Permission to use, copy, modify, and/or distribute this software for any
|
||||
// purpose with or without fee is hereby granted, provided that the above
|
||||
// copyright notice and this permission notice is present in all copies. The
|
||||
// full license for this software is available in the LICENSE file.
|
||||
|
||||
#pragma once
|
||||
#define HAVE_IRCD_M_FEDS_H
|
||||
|
||||
namespace ircd::m::feds
|
||||
{
|
||||
struct state;
|
||||
}
|
||||
|
||||
struct ircd::m::feds::state
|
||||
{
|
||||
using closure = std::function<bool (const string_view &, std::exception_ptr, const json::object &)>;
|
||||
|
||||
state(const m::room::id &, const m::event::id &, const milliseconds &, const closure &);
|
||||
state(const m::room::id &, const m::event::id &, const closure &);
|
||||
};
|
|
@ -57,6 +57,7 @@ namespace ircd::m::vm
|
|||
#include "txn.h"
|
||||
#include "hook.h"
|
||||
#include "visible.h"
|
||||
#include "feds.h"
|
||||
|
||||
struct ircd::m::init
|
||||
{
|
||||
|
|
27
ircd/m/m.cc
27
ircd/m/m.cc
|
@ -334,6 +334,33 @@ ircd::m::self::init::init(const string_view &origin)
|
|||
};
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// m/feds.h
|
||||
//
|
||||
|
||||
ircd::m::feds::state::state(const m::room::id &room_id,
|
||||
const m::event::id &event_id,
|
||||
const milliseconds &to,
|
||||
const closure &view)
|
||||
{
|
||||
using closure_prototype = bool (const string_view &,
|
||||
std::exception_ptr,
|
||||
const json::object &);
|
||||
|
||||
using prototype = void (const m::room::id &,
|
||||
const m::event::id &,
|
||||
const milliseconds &,
|
||||
const std::function<closure_prototype> &);
|
||||
|
||||
static m::import<prototype> feds__state
|
||||
{
|
||||
"federation_federation", "feds__state"
|
||||
};
|
||||
|
||||
feds__state(room_id, event_id, to, view);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// m/vm.h
|
||||
|
|
|
@ -6048,24 +6048,9 @@ console_cmd__feds__state(opt &out, const string_view &line)
|
|||
param.count() > 1? param.at(1) : m::head(room_id)
|
||||
};
|
||||
|
||||
using closure_prototype = bool (const string_view &,
|
||||
std::exception_ptr,
|
||||
const json::object &);
|
||||
|
||||
using prototype = void (const m::room::id &,
|
||||
const m::event::id &,
|
||||
const milliseconds &,
|
||||
const std::function<closure_prototype> &);
|
||||
|
||||
static m::import<prototype> feds__state
|
||||
{
|
||||
"federation_federation", "feds__state"
|
||||
};
|
||||
|
||||
std::forward_list<std::string> origins;
|
||||
std::map<std::string, std::forward_list<string_view>, std::less<>> grid;
|
||||
|
||||
feds__state(room_id, event_id, out.timeout, [&out, &grid, &origins]
|
||||
const auto closure{[&out, &grid, &origins]
|
||||
(const string_view &origin, std::exception_ptr eptr, const json::object &response)
|
||||
{
|
||||
if(eptr)
|
||||
|
@ -6097,7 +6082,12 @@ console_cmd__feds__state(opt &out, const string_view &line)
|
|||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}};
|
||||
|
||||
m::feds::state
|
||||
{
|
||||
room_id, event_id, out.timeout, closure
|
||||
};
|
||||
|
||||
for(auto &p : grid)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue