19 #ifndef IRCCD_DAEMON_PLUGIN_HPP
20 #define IRCCD_DAEMON_PLUGIN_HPP
27 #include <irccd/sysconfig.hpp>
31 #include <string_view>
32 #include <system_error>
33 #include <unordered_map>
41 struct disconnect_event;
61 class plugin :
public std::enable_shared_from_this<plugin> {
68 using map = std::unordered_map<std::string, std::string>;
99 virtual auto
get_name() const noexcept ->
std::string_view = 0;
330 std::vector<std::string> directories_;
331 std::vector<std::string> extensions_;
346 std::vector<std::string> extensions = {}) noexcept;
372 virtual auto open(std::string_view
id, std::string_view file) -> std::shared_ptr<plugin> = 0;
381 virtual auto find(std::string_view
id) -> std::shared_ptr<plugin>;
412 std::string message_;
437 auto get_message() const noexcept -> const
std::
string&;
444 auto what() const noexcept -> const
char* override;
480 #endif // !IRCCD_DAEMON_PLUGIN_HPP
virtual auto find(std::string_view id) -> std::shared_ptr< plugin >
virtual auto get_name() const noexcept -> std::string_view=0
Kick event.
Definition: server.hpp:121
virtual auto is_supported(std::string_view path) noexcept -> bool
virtual void handle_invite(bot &bot, const invite_event &event)
virtual void handle_whois(bot &bot, const whois_event &event)
Topic event.
Definition: server.hpp:211
Connection success event.
Definition: server.hpp:84
error
Plugin related errors.
Definition: plugin.hpp:393
auto get_id() const noexcept -> const std::string &
Whois event.
Definition: server.hpp:222
virtual void set_templates(const map &map)
virtual void handle_notice(bot &bot, const notice_event &event)
virtual auto get_options() const -> map
virtual void handle_connect(bot &bot, const connect_event &event)
virtual void handle_me(bot &bot, const me_event &event)
CTCP action event.
Definition: server.hpp:144
virtual void set_options(const map &map)
Abstract plugin.
Definition: plugin.hpp:61
Notice event.
Definition: server.hpp:189
Part event.
Definition: server.hpp:200
virtual auto get_author() const noexcept -> std::string_view
std::variant< std::monostate, connect_event, disconnect_event, invite_event, join_event, kick_event, me_event, message_event, mode_event, names_event, nick_event, notice_event, part_event, topic_event, whois_event > event
Store all possible events.
Definition: server.hpp:247
plugin_loader(std::vector< std::string > directories={}, std::vector< std::string > extensions={}) noexcept
virtual auto get_paths() const -> map
virtual auto get_license() const noexcept -> std::string_view
virtual void handle_part(bot &bot, const part_event &event)
virtual void handle_names(bot &bot, const names_event &event)
Mode event.
Definition: server.hpp:155
virtual void handle_load(bot &bot)
auto plugin_category() -> const std::error_category &
virtual auto get_version() const noexcept -> std::string_view
Join event.
Definition: server.hpp:111
auto make_error_code(bot_error::error e) noexcept -> std::error_code
virtual void handle_mode(bot &bot, const mode_event &event)
Invite event.
Definition: server.hpp:100
plugin_error(error code, std::string id, std::string message="")
virtual ~plugin_loader()=default
virtual void handle_command(bot &bot, const message_event &event)
virtual auto get_summary() const noexcept -> std::string_view
auto get_id() const noexcept -> const std::string &
@ already_exists
Definition: plugin.hpp:407
virtual void handle_disconnect(bot &bot, const disconnect_event &event)
virtual void handle_topic(bot &bot, const topic_event &event)
virtual void handle_nick(bot &bot, const nick_event &event)
Irccd main instance.
Definition: bot.hpp:58
virtual void handle_reload(bot &bot)
virtual auto get_templates() const -> map
virtual void set_paths(const map &map)
virtual void handle_join(bot &bot, const join_event &event)
virtual ~plugin()=default
Message event.
Definition: server.hpp:133
Parent namespace.
Definition: acceptor.hpp:43
std::unordered_map< std::string, std::string > map
Definition: plugin.hpp:68
Plugin error.
Definition: plugin.hpp:388
Abstract interface for searching plugins.
Definition: plugin.hpp:328
Main irccd namespace.
Definition: bot.hpp:41
virtual void handle_message(bot &bot, const message_event &event)
virtual auto open(std::string_view id, std::string_view file) -> std::shared_ptr< plugin >=0
plugin(std::string id) noexcept
virtual void handle_unload(bot &bot)
Connection success event.
Definition: server.hpp:92
virtual void handle_kick(bot &bot, const kick_event &event)
Nick change event.
Definition: server.hpp:179
Names listing event.
Definition: server.hpp:169