mirror of
https://github.com/matrix-construct/construct
synced 2024-11-17 15:30:52 +01:00
modules/s_listen: Improve various.
This commit is contained in:
parent
8603ccf16b
commit
4793545dc2
2 changed files with 33 additions and 22 deletions
|
@ -66,11 +66,13 @@ s_moduledir = @moduledir@
|
||||||
s_conf_la_SOURCES = s_conf.cc
|
s_conf_la_SOURCES = s_conf.cc
|
||||||
s_control_la_SOURCES = s_control.cc
|
s_control_la_SOURCES = s_control.cc
|
||||||
s_node_la_SOURCES = s_node.cc
|
s_node_la_SOURCES = s_node.cc
|
||||||
|
s_listen_la_SOURCES = s_listen.cc
|
||||||
|
|
||||||
s_module_LTLIBRARIES = \
|
s_module_LTLIBRARIES = \
|
||||||
s_conf.la \
|
s_conf.la \
|
||||||
s_control.la \
|
s_control.la \
|
||||||
s_node.la \
|
s_node.la \
|
||||||
|
s_listen.la \
|
||||||
###
|
###
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
|
@ -10,8 +10,10 @@
|
||||||
|
|
||||||
using namespace ircd;
|
using namespace ircd;
|
||||||
|
|
||||||
static void create_listener(const m::event &);
|
extern "C" std::list<net::listener> listeners;
|
||||||
|
|
||||||
static void init_listener(const string_view &, const json::object &);
|
static void init_listener(const string_view &, const json::object &);
|
||||||
|
static void init_listener(const m::event &);
|
||||||
static void init_listeners();
|
static void init_listeners();
|
||||||
static void on_load();
|
static void on_load();
|
||||||
|
|
||||||
|
@ -21,7 +23,8 @@ IRCD_MODULE
|
||||||
"Server listeners", on_load
|
"Server listeners", on_load
|
||||||
};
|
};
|
||||||
|
|
||||||
std::list<net::listener>
|
/// Active listener state
|
||||||
|
decltype(listeners)
|
||||||
listeners;
|
listeners;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -50,6 +53,19 @@ init_listeners()
|
||||||
m::room::state{m::my_room}.for_each("ircd.listen", []
|
m::room::state{m::my_room}.for_each("ircd.listen", []
|
||||||
(const m::event &event)
|
(const m::event &event)
|
||||||
{
|
{
|
||||||
|
init_listener(event);
|
||||||
|
});
|
||||||
|
|
||||||
|
if(listeners.empty())
|
||||||
|
log::warning
|
||||||
|
{
|
||||||
|
"No listening sockets configured; can't hear anyone."
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
init_listener(const m::event &event)
|
||||||
|
{
|
||||||
const string_view &name
|
const string_view &name
|
||||||
{
|
{
|
||||||
at<"state_key"_>(event)
|
at<"state_key"_>(event)
|
||||||
|
@ -61,13 +77,6 @@ init_listeners()
|
||||||
};
|
};
|
||||||
|
|
||||||
init_listener(name, opts);
|
init_listener(name, opts);
|
||||||
});
|
|
||||||
|
|
||||||
if(listeners.empty())
|
|
||||||
log::warning
|
|
||||||
{
|
|
||||||
"No listening sockets configured; can't hear anyone."
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -93,6 +102,12 @@ init_listener(const string_view &name,
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
|
static void
|
||||||
|
create_listener(const m::event &event)
|
||||||
|
{
|
||||||
|
init_listener(event);
|
||||||
|
}
|
||||||
|
|
||||||
const m::hookfn<>
|
const m::hookfn<>
|
||||||
create_listener_hook
|
create_listener_hook
|
||||||
{
|
{
|
||||||
|
@ -100,12 +115,6 @@ create_listener_hook
|
||||||
{
|
{
|
||||||
{ "_site", "vm.notify" },
|
{ "_site", "vm.notify" },
|
||||||
{ "room_id", "!ircd" },
|
{ "room_id", "!ircd" },
|
||||||
{ "type", "m.room.create" },
|
{ "type", "ircd.listen" },
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
|
||||||
create_listener(const m::event &)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue