0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-01-14 00:34:18 +01:00

modules/client/register: Remove the first user thing.

This commit is contained in:
Jason Volk 2018-05-20 18:08:25 -07:00
parent c88ce8168b
commit 6bacfb6cb7

View file

@ -254,66 +254,3 @@ validate_password(const string_view &password)
"The desired password is too long"
};
}
static void _first_user_registered(const m::event &event);
const m::hook
_first_user_hook
{
_first_user_registered,
{
{ "_site", "vm.notify" },
{ "room_id", "!users" },
{ "type", "ircd.user" },
},
};
void
_first_user_registered(const m::event &event)
{
static bool already;
if(already)
return;
const m::room::state state
{
m::room{at<"room_id"_>(event)}
};
const auto &count
{
state.count("ircd.user")
};
//TODO: This will rot as soon as more auto-users are created
//TODO: along with @ircd. Need a way to know when the first HUMAN
//TODO: has registered.
if(count != 2) // @ircd + first user
{
if(count > 2)
already = true;
return;
}
const m::user::id user
{
at<"state_key"_>(event)
};
const auto &content
{
at<"content"_>(event)
};
if(!content.get<bool>("active"))
return;
const m::room::id::buf control_room_id
{
"!control", m::self::host()
};
join(m::room{control_room_id}, user);
already = true;
}