Send presence in examples/src/connect.cpp
This commit is contained in:
parent
f72ee713d8
commit
e7e84860cc
1 changed files with 6 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
#include <boost/asio/co_spawn.hpp>
|
||||
#include <boost/asio/detached.hpp>
|
||||
#include <larra/client/client.hpp>
|
||||
#include <larra/presence.hpp>
|
||||
#include <larra/printer_stream.hpp>
|
||||
#include <print>
|
||||
|
||||
|
@ -13,6 +14,11 @@ auto Coroutine() -> boost::asio::awaitable<void> {
|
|||
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});
|
||||
co_await std::visit(
|
||||
[](auto& client) -> boost::asio::awaitable<void> {
|
||||
co_await client.Send(larra::xmpp::presence::c2s::Available{});
|
||||
},
|
||||
client);
|
||||
} catch(const std::exception& err) {
|
||||
SPDLOG_ERROR("{}", err.what());
|
||||
co_return;
|
||||
|
|
Loading…
Reference in a new issue