0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00

ircd:Ⓜ️ Eliminate the !nodes room related.

This commit is contained in:
Jason Volk 2019-08-11 22:42:12 -07:00
parent f24bf54799
commit b60edf3212
3 changed files with 9 additions and 58 deletions

View file

@ -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
//

View file

@ -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");

View file

@ -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<vm::eval &> create_my_node_hook;
extern hookfn<vm::eval &> 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