xbot/settings.cpp

18 lines
613 B
C++
Raw Normal View History

2023-11-22 19:59:34 -08:00
#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{"*"})
};
}