mirror of
https://github.com/matrix-construct/construct
synced 2024-10-04 06:38:58 +02:00
ircd:Ⓜ️ Move user::is_active() to modules/client/account.
This commit is contained in:
parent
f8dc84d46e
commit
1723a48e89
3 changed files with 33 additions and 19 deletions
14
ircd/m/m.cc
14
ircd/m/m.cc
|
@ -369,6 +369,20 @@ ircd::m::user::deactivate(const json::members &contents)
|
||||||
return function(*this, 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
|
// m/room.h
|
||||||
|
|
|
@ -128,25 +128,6 @@ catch(const std::exception &e)
|
||||||
return false;
|
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.
|
/// Generates a user-room ID into buffer; see room_id() overload.
|
||||||
ircd::m::id::room::buf
|
ircd::m::id::room::buf
|
||||||
ircd::m::user::room_id()
|
ircd::m::user::room_id()
|
||||||
|
|
|
@ -26,3 +26,22 @@ account_resource
|
||||||
"(3.4,3.5,3.6) Account management"
|
"(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;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue