From b60edf3212f5b73f5221e1dfb077f2688f87fe50 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sun, 11 Aug 2019 22:42:12 -0700 Subject: [PATCH] ircd::m: Eliminate the !nodes room related. --- ircd/m.cc | 21 ------------------ modules/m_init_bootstrap.cc | 3 +++ modules/m_node.cc | 43 ++++++------------------------------- 3 files changed, 9 insertions(+), 58 deletions(-) diff --git a/ircd/m.cc b/ircd/m.cc index b03e6aebc..2a2ef2a65 100644 --- a/ircd/m.cc +++ b/ircd/m.cc @@ -456,7 +456,6 @@ ircd::m::self::host() //TODO: XXX extern ircd::m::room::id::buf users_room_id; extern ircd::m::room::id::buf tokens_room_id; -extern ircd::m::room::id::buf nodes_room_id; ircd::m::self::init::init(const string_view &origin, const string_view &servername) @@ -484,9 +483,6 @@ ircd::m::self::init::init(const string_view &origin, tokens_room_id = {"tokens", origin}; m::user::tokens = {tokens_room_id}; - nodes_room_id = {"nodes", origin}; - m::nodes = {nodes_room_id}; - if(origin == "localhost") log::warning { @@ -2103,23 +2099,6 @@ ircd::m::device::for_each(const m::user &user, // m/node.h // -/// ID of the room which indexes all nodes (an instance of the room is -/// provided below). -ircd::m::room::id::buf -nodes_room_id -{ - "nodes", ircd::my_host() -}; - -/// The nodes room is the database of all nodes. It primarily serves as an -/// indexing mechanism and for top-level node related keys. -/// -ircd::m::room -ircd::m::nodes -{ - nodes_room_id -}; - // // node // diff --git a/modules/m_init_bootstrap.cc b/modules/m_init_bootstrap.cc index 26e646c62..bf94ab78a 100644 --- a/modules/m_init_bootstrap.cc +++ b/modules/m_init_bootstrap.cc @@ -35,6 +35,9 @@ try me.activate(); } + if(!exists(my_node)) + create(my_node); + if(!exists(my_room)) create(my_room, me.user_id, "internal"); diff --git a/modules/m_node.cc b/modules/m_node.cc index b433bbe6f..365fc740e 100644 --- a/modules/m_node.cc +++ b/modules/m_node.cc @@ -8,46 +8,12 @@ // copyright notice and this permission notice is present in all copies. The // full license for this software is available in the LICENSE file. -namespace ircd::m -{ - extern hookfn create_my_node_hook; - extern hookfn create_nodes_hook; -} - ircd::mapi::header IRCD_MODULE { "Server Nodes" }; -decltype(ircd::m::create_my_node_hook) -ircd::m::create_my_node_hook -{ - { - { "_site", "vm.effect" }, - { "room_id", "!nodes" }, - { "type", "m.room.create" }, - }, - [](const m::event &, m::vm::eval &) - { - create(m::my_node.room_id(), m::me.user_id); - } -}; - -decltype(ircd::m::create_nodes_hook) -ircd::m::create_nodes_hook -{ - { - { "_site", "vm.effect" }, - { "room_id", "!ircd" }, - { "type", "m.room.create" }, - }, - [](const m::event &, m::vm::eval &) - { - create(m::nodes, m::me.user_id); - } -}; - // // node // @@ -63,9 +29,7 @@ ircd::m::create(const node &node, node.room_id() }; - //TODO: ABA create(room_id, m::me.user_id); - send(nodes, m::me.user_id, "ircd.node", node.node_id, args); return node; } @@ -73,7 +37,12 @@ bool IRCD_MODULE_EXPORT ircd::m::exists(const node &node) { - return nodes.has("ircd.node", node.node_id); + const m::room::id::buf room_id + { + node.room_id() + }; + + return exists(room_id); } bool