0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-11 06:28:55 +02:00

ircd:Ⓜ️ Move user::is_active() to modules/client/account.

This commit is contained in:
Jason Volk 2018-03-05 03:59:46 -08:00
parent f8dc84d46e
commit 1723a48e89
3 changed files with 33 additions and 19 deletions

View file

@ -369,6 +369,20 @@ ircd::m::user::deactivate(const json::members &contents)
return function(*this, contents);
}
bool
ircd::m::user::is_active()
const
{
using prototype = bool (const m::user &);
static import<prototype> function
{
"client_account", "is_active__user"
};
return function(*this);
}
///////////////////////////////////////////////////////////////////////////////
//
// m/room.h

View file

@ -128,25 +128,6 @@ catch(const std::exception &e)
return false;
}
bool
ircd::m::user::is_active()
const
{
bool ret{false};
users.get(std::nothrow, "ircd.user", user_id, [&ret]
(const m::event &event)
{
const json::object &content
{
at<"content"_>(event)
};
ret = content.get("active") == "true";
});
return ret;
}
/// Generates a user-room ID into buffer; see room_id() overload.
ircd::m::id::room::buf
ircd::m::user::room_id()

View file

@ -26,3 +26,22 @@ account_resource
"(3.4,3.5,3.6) Account management"
}
};
extern "C" bool
is_active__user(const m::user &user)
{
bool ret{false};
const m::room &users{m::user::users};
users.get(std::nothrow, "ircd.user", user.user_id, [&ret]
(const m::event &event)
{
const json::object &content
{
at<"content"_>(event)
};
ret = content.get("active") == "true";
});
return ret;
}