Logging of the messages, customizable replies, assigning groups

This commit is contained in:
Blue 2025-03-15 22:34:50 +02:00
parent f03f392cee
commit 7f57cd3bf6
Signed by: blue
GPG key ID: 9B203B252A63EE38
21 changed files with 288 additions and 62 deletions

9
shared/CMakeLists.txt Normal file
View file

@ -0,0 +1,9 @@
set(SOURCES
)
set(HEADERS
definitions.h
result.h
)
target_sources(${EXEC_NAME} PRIVATE ${SOURCES})

13
shared/definitions.h Normal file
View file

@ -0,0 +1,13 @@
// SPDX-FileCopyrightText: 2024 Yury Gubich <blue@macaw.me>
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <string>
#include <vector>
#include <map>
namespace Shared {
typedef std::vector<std::string> Strings;
typedef std::map<std::string, Strings> Permissions;
}

30
shared/result.h Normal file
View file

@ -0,0 +1,30 @@
// SPDX-FileCopyrightText: 2024 Yury Gubich <blue@macaw.me>
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
#include <map>
#include <array>
#include <string_view>
#include "definitions.h"
namespace Shared {
enum Result {
success,
forbidden,
unhandled,
error
};
typedef std::map<Result, Strings> Responses;
constexpr std::array<std::pair<Result, std::string_view>, 4> results = {{
{ success, "success" },
{ forbidden, "forbidden" },
{ unhandled, "unhandled" },
{ error, "error" },
}};
}