// SPDX-FileCopyrightText: 2024 Yury Gubich // SPDX-License-Identifier: GPL-3.0-or-later #include "module.h" #include "gloox/message.h" Module::Module::Module(const std::shared_ptr& client): client(client) {} Module::Module::~Module() noexcept {} std::vector Module::Module::split(const std::string& string, const std::string& delimiter) { std::vector result; std::size_t last = 0; std::size_t next = string.find(delimiter, last); while (next != std::string::npos) { result.emplace_back(string.substr(last, next - last)); last = next + 1; next = string.find(delimiter, last); } result.emplace_back(string.substr(last)); return result; } void Module::Module::sendMessage(const std::shared_ptr& actor, const std::string& body) { client->send(gloox::Message( gloox::Message::Chat, actor->jid, body )); }