Mercurial > irccd
changeset 519:63faa8087c46
Irccd: store configuration path, closes #723
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 26 Oct 2017 20:55:20 +0200 |
parents | b557017ad3f0 |
children | defacef00c82 |
files | irccd/main.cpp libirccd/irccd/irccd.cpp libirccd/irccd/irccd.hpp |
diffstat | 3 files changed, 31 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/irccd/main.cpp Fri Oct 27 08:52:39 2017 +0200 +++ b/irccd/main.cpp Thu Oct 26 20:55:20 2017 +0200 @@ -247,6 +247,8 @@ void load(const config& config, const option::result& options) { + instance->set_config(config.path()); + /* * Order matters, please be careful when changing this. *
--- a/libirccd/irccd/irccd.cpp Fri Oct 27 08:52:39 2017 +0200 +++ b/libirccd/irccd/irccd.cpp Thu Oct 26 20:55:20 2017 +0200 @@ -24,8 +24,9 @@ namespace irccd { -irccd::irccd() - : command_service_(std::make_unique<command_service>()) +irccd::irccd(std::string config) + : config_(std::move(config)) + , command_service_(std::make_unique<command_service>()) , itr_service_(std::make_unique<interrupt_service>()) , server_service_(std::make_unique<server_service>(*this)) , tpt_service_(std::make_unique<transport_service>(*this))
--- a/libirccd/irccd/irccd.hpp Fri Oct 27 08:52:39 2017 +0200 +++ b/libirccd/irccd/irccd.hpp Thu Oct 26 20:55:20 2017 +0200 @@ -55,6 +55,9 @@ std::mutex mutex_; std::vector<std::function<void (irccd&)>> events_; + // Path to config. + std::string config_; + // Services. std::shared_ptr<command_service> command_service_; std::shared_ptr<interrupt_service> itr_service_; @@ -73,8 +76,10 @@ public: /** * Prepare standard services. + * + * \param config the optional path to the configuration. */ - irccd(); + irccd(std::string config = ""); /** * Default destructor. @@ -82,6 +87,26 @@ ~irccd(); /** + * Get the current configuration path. + * + * \return the path + */ + inline const std::string& config() const noexcept + { + return config_; + } + + /** + * Set the configuration path. + * + * \param path the new path + */ + inline void set_config(std::string path) noexcept + { + config_ = std::move(path); + } + + /** * Access the command service. * * \return the service