mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 07:23:53 +01:00
ircd:Ⓜ️:device: Add has(user, device_id, property) overload to interface suite.
This commit is contained in:
parent
d8da7814e8
commit
1381524f95
3 changed files with 32 additions and 0 deletions
|
@ -124,6 +124,7 @@ struct ircd::m::device
|
|||
static bool for_each(const user &, const string_view &id, const closure_bool &); // each property
|
||||
static bool get(std::nothrow_t, const user &, const string_view &id, const string_view &prop, const closure &);
|
||||
static bool get(const user &, const string_view &id, const string_view &prop, const closure &);
|
||||
static bool has(const user &, const string_view &id, const string_view &prop);
|
||||
static bool has(const user &, const string_view &id);
|
||||
static bool del(const user &, const string_view &id);
|
||||
static bool set(const user &, const string_view &id, const string_view &prop, const string_view &val);
|
||||
|
|
15
ircd/m.cc
15
ircd/m.cc
|
@ -1714,6 +1714,21 @@ ircd::m::device::has(const m::user &user,
|
|||
return function(user, id);
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::m::device::has(const m::user &user,
|
||||
const string_view &id,
|
||||
const string_view &prop)
|
||||
{
|
||||
using prototype = bool (const m::user &, const string_view &id, const string_view &prop);
|
||||
|
||||
static mods::import<prototype> function
|
||||
{
|
||||
"m_device", "ircd::m::device::has"
|
||||
};
|
||||
|
||||
return function(user, id, prop);
|
||||
}
|
||||
|
||||
bool
|
||||
ircd::m::device::get(const m::user &user,
|
||||
const string_view &id,
|
||||
|
|
|
@ -174,6 +174,22 @@ ircd::m::device::has(const m::user &user,
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool
|
||||
IRCD_MODULE_EXPORT
|
||||
ircd::m::device::has(const m::user &user,
|
||||
const string_view &id,
|
||||
const string_view &prop)
|
||||
{
|
||||
bool ret{false};
|
||||
get(std::nothrow, user, id, prop, [&ret]
|
||||
(const string_view &value)
|
||||
{
|
||||
ret = !empty(value);
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool
|
||||
IRCD_MODULE_EXPORT
|
||||
ircd::m::device::get(std::nothrow_t,
|
||||
|
|
Loading…
Reference in a new issue