2024-03-30 22:44:52 -03:00
|
|
|
// SPDX-FileCopyrightText: 2024 Yury Gubich <blue@macaw.me>
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
2025-02-21 23:01:11 +02:00
|
|
|
#include <set>
|
2024-03-30 22:44:52 -03:00
|
|
|
#include <iostream>
|
|
|
|
#include <vector>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include <gloox/client.h>
|
|
|
|
#include <gloox/messagehandler.h>
|
2025-02-21 23:01:11 +02:00
|
|
|
#include <gloox/connectionlistener.h>
|
2024-03-30 22:44:52 -03:00
|
|
|
#include <gloox/message.h>
|
|
|
|
|
|
|
|
#include "logger.h"
|
|
|
|
|
2025-02-21 23:01:11 +02:00
|
|
|
class Jay : public gloox::MessageHandler, public gloox::ConnectionListener {
|
2024-03-30 22:44:52 -03:00
|
|
|
public:
|
|
|
|
Jay(const std::string& jid, const std::string& password);
|
|
|
|
~Jay();
|
|
|
|
|
|
|
|
void handleMessage(const gloox::Message& message, gloox::MessageSession* session = 0) override;
|
2025-02-21 23:01:11 +02:00
|
|
|
void onConnect() override;
|
|
|
|
void onDisconnect(gloox::ConnectionError e) override;
|
|
|
|
bool onTLSConnect(const gloox::CertInfo&) override;
|
2024-03-30 22:44:52 -03:00
|
|
|
|
|
|
|
void run();
|
|
|
|
|
|
|
|
Logger* addLogger(gloox::LogLevel level);
|
2025-02-21 23:01:11 +02:00
|
|
|
void addOwner(const std::string& jid);
|
2024-03-30 22:44:52 -03:00
|
|
|
|
|
|
|
private:
|
|
|
|
gloox::Client client;
|
|
|
|
std::vector<std::unique_ptr<Logger>> loggers;
|
2025-02-21 23:01:11 +02:00
|
|
|
std::set<std::string> owners;
|
2024-03-30 22:44:52 -03:00
|
|
|
};
|