diff --git a/ircd/m/m.cc b/ircd/m/m.cc index 0a51abb81..b74fda7c6 100644 --- a/ircd/m/m.cc +++ b/ircd/m/m.cc @@ -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 function + { + "client_account", "is_active__user" + }; + + return function(*this); +} + /////////////////////////////////////////////////////////////////////////////// // // m/room.h diff --git a/ircd/m/user.cc b/ircd/m/user.cc index 73c6b7522..7aae22629 100644 --- a/ircd/m/user.cc +++ b/ircd/m/user.cc @@ -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() diff --git a/modules/client/account/account.cc b/modules/client/account/account.cc index 0e7a12bfc..d0e3153c2 100644 --- a/modules/client/account/account.cc +++ b/modules/client/account/account.cc @@ -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; +}