// SPDX-FileCopyrightText: 2024 Yury Gubich // SPDX-License-Identifier: GPL-3.0-or-later #include "message.h" #include Message::Message(const std::shared_ptr& config, const std::shared_ptr& client, const Callback& callback): callback(callback), config(config), client(client) { client->registerMessageHandler(this); } Message::~Message() { if (std::shared_ptr cl = client.lock()) cl->removeMessageHandler(this); } void Message::handleMessage(const gloox::Message& message, gloox::MessageSession* session) { callback(message.from().bare(), message.body()); }