mirror of
https://github.com/matrix-construct/construct
synced 2024-11-04 21:08:57 +01:00
ircd:Ⓜ️🆔 Add event::id version gauge method.
This commit is contained in:
parent
7c142b9519
commit
fcfc28c6e4
2 changed files with 34 additions and 0 deletions
|
@ -161,6 +161,8 @@ struct ircd::m::id::event
|
|||
using closure = std::function<void (const id::event &)>;
|
||||
using closure_bool = std::function<bool (const id::event &)>;
|
||||
|
||||
string_view version() const; // static view
|
||||
|
||||
template<class... args>
|
||||
event(args&&... a)
|
||||
:m::id{EVENT, std::forward<args>(a)...}
|
||||
|
|
32
ircd/m_id.cc
32
ircd/m_id.cc
|
@ -648,6 +648,38 @@ const
|
|||
return ret;
|
||||
}
|
||||
|
||||
//
|
||||
// id::event
|
||||
//
|
||||
|
||||
ircd::string_view
|
||||
ircd::m::id::event::version()
|
||||
const
|
||||
{
|
||||
static const parser::rule<> &is_v4
|
||||
{
|
||||
parser.event_id_v4
|
||||
};
|
||||
|
||||
static const parser::rule<> &is_v3
|
||||
{
|
||||
parser.event_id_v3
|
||||
};
|
||||
|
||||
const auto &local(this->local());
|
||||
auto *start(std::begin(local));
|
||||
auto *const stop(std::end(local));
|
||||
|
||||
return
|
||||
qi::parse(start, stop, is_v4)? "4":
|
||||
qi::parse(start, stop, is_v3)? "3":
|
||||
"1";
|
||||
}
|
||||
|
||||
//
|
||||
// util
|
||||
//
|
||||
|
||||
bool
|
||||
ircd::m::my(const id &id)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue