From ebd8539ce14e5b4a329d6ee01dcd9deb500f6be8 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 17 Aug 2018 14:28:53 -0700 Subject: [PATCH] modules/s_listen: Minor cleanup. --- modules/s_listen.cc | 51 ++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/modules/s_listen.cc b/modules/s_listen.cc index af4058c6a..a56518ee8 100644 --- a/modules/s_listen.cc +++ b/modules/s_listen.cc @@ -28,7 +28,8 @@ decltype(listeners) listeners; // -// init +// On module load any existing listener descriptions are sought out +// of room state and instantiated (i.e on startup). // void @@ -63,6 +64,33 @@ init_listeners() }; } +// +// Upon processing of a new event which saved a listener description +// to room state in its content, we instantiate the listener here. +// + +static void +create_listener(const m::event &event) +{ + init_listener(event); +} + +/// Hook for a new listener description being sent. +const m::hookfn<> +create_listener_hook +{ + create_listener, + { + { "_site", "vm.notify" }, + { "room_id", "!ircd" }, + { "type", "ircd.listen" }, + } +}; + +// +// Common +// + void init_listener(const m::event &event) { @@ -97,24 +125,3 @@ init_listener(const string_view &name, ircd::add_client(sock); }); } - -// -// -// - -static void -create_listener(const m::event &event) -{ - init_listener(event); -} - -const m::hookfn<> -create_listener_hook -{ - create_listener, - { - { "_site", "vm.notify" }, - { "room_id", "!ircd" }, - { "type", "ircd.listen" }, - } -};