24 lines
789 B
C++
24 lines
789 B
C++
|
#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> {
|
||
|
std::println("Connecting client...");
|
||
|
try {
|
||
|
auto client = co_await larra::xmpp::client::CreateClient<larra::xmpp::PrintStream<boost::asio::ip::tcp::socket>>(
|
||
|
larra::xmpp::EncryptionUserAccount{{"sha512sum", "localhost"}, "12345"}, {.useTls = larra::xmpp::client::Options::kNever});
|
||
|
} catch(const std::exception& err) {
|
||
|
std::println("Err: {}", err.what());
|
||
|
co_return;
|
||
|
}
|
||
|
std::println("Done!");
|
||
|
}
|
||
|
|
||
|
auto main() -> int {
|
||
|
boost::asio::io_context io_context;
|
||
|
boost::asio::co_spawn(io_context, Coroutine(), boost::asio::detached);
|
||
|
io_context.run();
|
||
|
}
|