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:
parent
c88ce8168b
commit
6bacfb6cb7
1 changed files with 0 additions and 63 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue