28 lines
912 B
C++
28 lines
912 B
C++
#include <spdlog/spdlog.h>
|
|
|
|
#include <boost/asio/co_spawn.hpp>
|
|
#include <boost/asio/detached.hpp>
|
|
#include <larra/client/client.hpp>
|
|
#include <larra/printer_stream.hpp>
|
|
#include <print>
|
|
|
|
auto Coroutine() -> boost::asio::awaitable<void> {
|
|
SPDLOG_INFO("Connecting client...");
|
|
|
|
try {
|
|
auto client = co_await larra::xmpp::client::CreateClient<larra::xmpp::PrintStream<boost::asio::ip::tcp::socket>>(
|
|
larra::xmpp::PlainUserAccount{.jid = {.username = "test1", .server = "localhost"}, .password = "test1"},
|
|
{.useTls = larra::xmpp::client::Options::kNever});
|
|
} catch(const std::exception& err) {
|
|
SPDLOG_ERROR("{}", err.what());
|
|
co_return;
|
|
}
|
|
SPDLOG_INFO("Done connecting client!");
|
|
}
|
|
|
|
auto main() -> int {
|
|
spdlog::set_level(spdlog::level::trace);
|
|
boost::asio::io_context io_context;
|
|
boost::asio::co_spawn(io_context, Coroutine(), boost::asio::detached);
|
|
io_context.run();
|
|
}
|