46 lines
1001 B
C++
46 lines
1001 B
C++
// SPDX-FileCopyrightText: 2024 Yury Gubich <blue@macaw.me>
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <iostream>
|
|
#include <vector>
|
|
#include <memory>
|
|
#include <mutex>
|
|
|
|
#include <gloox/client.h>
|
|
#include <gloox/disco.h>
|
|
#include <gloox/connectionlistener.h>
|
|
|
|
#include "component/logger.h"
|
|
#include "component/config.h"
|
|
#include "component/router.h"
|
|
#include "handler/message.h"
|
|
#include "handler/connection.h"
|
|
|
|
class Jay {
|
|
public:
|
|
Jay(const std::string& configPath);
|
|
~Jay();
|
|
|
|
bool isConfigValid() const;
|
|
|
|
void run();
|
|
|
|
private:
|
|
void addLogger(gloox::LogLevel level);
|
|
void initialize();
|
|
void createClient();
|
|
void createActors();
|
|
|
|
private:
|
|
std::mutex runMutex;
|
|
std::shared_ptr<Config> config;
|
|
std::unique_ptr<Router> router;
|
|
std::shared_ptr<gloox::Client> client;
|
|
std::unique_ptr<Message> messageHandler;
|
|
std::unique_ptr<Connection> connectionHandler;
|
|
std::vector<std::unique_ptr<Logger>> loggers;
|
|
};
|