0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

ircd:Ⓜ️🪝 Minor interface reorg.

This commit is contained in:
Jason Volk 2020-05-12 15:36:56 -07:00
parent 23b7dc62d6
commit a247334744
2 changed files with 20 additions and 17 deletions

View file

@ -66,8 +66,9 @@ struct ircd::m::hook::base
size_t calls {0};
size_t calling {0};
string_view site_name() const;
public:
site *find_site() const;
string_view site_name() const;
protected:
base(const json::members &);
@ -91,14 +92,16 @@ struct ircd::m::hook::base::site
size_t calls {0};
size_t calling {0};
friend class base;
public:
string_view name() const;
protected:
friend class base;
bool add(base &);
bool del(base &);
void match(const event &, const std::function<bool (base &)> &);
protected:
site(const json::members &);
site(site &&) = delete;
site(const site &) = delete;

View file

@ -258,6 +258,20 @@ noexcept
site->del(*this);
}
ircd::string_view
ircd::m::hook::base::site_name()
const try
{
return unquote(feature.at("_site"));
}
catch(const std::out_of_range &e)
{
throw panic
{
"Hook %p must name a '_site' to register with.", this
};
}
ircd::m::hook::base::site *
ircd::m::hook::base::find_site()
const
@ -277,20 +291,6 @@ const
return nullptr;
}
ircd::string_view
ircd::m::hook::base::site_name()
const try
{
return unquote(feature.at("_site"));
}
catch(const std::out_of_range &e)
{
throw panic
{
"Hook %p must name a '_site' to register with.", this
};
}
//
// hook::site
//