Store and solve rules.
More...
#include <rule_service.hpp>
◆ rule_service()
irccd::daemon::rule_service::rule_service |
( |
bot & |
bot | ) |
|
Create the rule service.
- Parameters
-
◆ add()
void irccd::daemon::rule_service::add |
( |
rule |
rule | ) |
|
Append a rule.
- Parameters
-
◆ insert()
void irccd::daemon::rule_service::insert |
( |
rule |
rule, |
|
|
std::size_t |
position |
|
) |
| |
Insert a new rule at the specified position.
- Parameters
-
rule | the rule |
position | the position |
◆ list()
auto irccd::daemon::rule_service::list |
( |
| ) |
const -> const std::vector< rule > & |
|
noexcept |
Get the list of rules.
- Returns
- the list of rules
◆ load()
void irccd::daemon::rule_service::load |
( |
const config & |
cfg | ) |
|
|
noexcept |
Load rules from the configuration.
- Parameters
-
◆ remove()
void irccd::daemon::rule_service::remove |
( |
std::size_t |
position | ) |
|
Remove a new rule from the specified position.
- Precondition
- position must be valid
- Parameters
-
◆ require() [1/2]
auto irccd::daemon::rule_service::require |
( |
std::size_t |
position | ) |
-> rule & |
Overloaded function.
Get a rule at the specified index or throw an exception if not found.
- Parameters
-
- Returns
- the rule
- Exceptions
-
std::out_of_range | if position is invalid |
◆ require() [2/2]
auto irccd::daemon::rule_service::require |
( |
std::size_t |
position | ) |
const -> const rule & |
Get a rule at the specified index or throw an exception if not found.
- Parameters
-
- Returns
- the rule
- Exceptions
-
std::out_of_range | if position is invalid |
◆ solve()
auto irccd::daemon::rule_service::solve |
( |
std::string_view |
server, |
|
|
std::string_view |
channel, |
|
|
std::string_view |
origin, |
|
|
std::string_view |
plugin, |
|
|
std::string_view |
event |
|
) |
| -> bool |
|
noexcept |
Resolve the action to execute with the specified list of rules.
- Parameters
-
server | the server name |
channel | the channel name |
origin | the origin |
plugin | the plugin name |
event | the event name (e.g onKick) |
- Returns
- true if the plugin must be called
The documentation for this class was generated from the following file: