41 lines
900 B
C++
41 lines
900 B
C++
// SPDX-FileCopyrightText: 2024 Yury Gubich <blue@macaw.me>
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <map>
|
|
|
|
#include "gloox/gloox.h"
|
|
|
|
#include "yaml-cpp/yaml.h"
|
|
|
|
class Config {
|
|
public:
|
|
struct Module {
|
|
typedef std::vector<std::string> List;
|
|
typedef std::map<std::string, List> Permissions;
|
|
|
|
bool enabled;
|
|
std::string alias;
|
|
Permissions permissions;
|
|
};
|
|
|
|
public:
|
|
Config(const std::string& path);
|
|
|
|
bool isValid() const;
|
|
|
|
std::string getBareJID() const;
|
|
std::string getFullJID() const;
|
|
std::string getPassword() const;
|
|
std::string getResource() const;
|
|
std::map<std::string, std::string> getActors() const;
|
|
gloox::LogLevel getLogLevel() const;
|
|
gloox::TLSPolicy getTLSPolicy() const;
|
|
Module getModuleConfig(const std::string& name) const;
|
|
|
|
private:
|
|
YAML::Node root;
|
|
};
|