18 lines
613 B
C++
18 lines
613 B
C++
#include "settings.hpp"
|
|
|
|
#define TOML_ENABLE_FORMATTERS 0
|
|
#include <toml++/toml.hpp>
|
|
|
|
auto Settings::from_stream(std::istream & in) -> Settings
|
|
{
|
|
auto const config = toml::parse(in);
|
|
return Settings{
|
|
.host = config["host"].value_or(std::string{"*"}),
|
|
.service = config["service"].value_or(std::string{"*"}),
|
|
.password = config["password"].value_or(std::string{"*"}),
|
|
.username = config["username"].value_or(std::string{"*"}),
|
|
.realname = config["realname"].value_or(std::string{"*"}),
|
|
.nickname = config["nickname"].value_or(std::string{"*"})
|
|
};
|
|
}
|