struct Message added in message.hpp
All checks were successful
PR Check / on-push-commit-check (push) Successful in 16m10s

message_to_roster initial commit
This commit is contained in:
sectapunterx 2024-12-03 13:03:38 +03:00
parent 7f5c9cfd49
commit c4923f4a9d
3 changed files with 34 additions and 0 deletions

View file

@ -77,6 +77,9 @@ struct Client {
[[nodiscard]] constexpr auto Jid() const -> const FullJid& {
return this->jid;
}
[[nodiscard]] auto GetRoster() const -> const iq::Roster& {
return this->roster;
}
auto CreateResourceBind() -> boost::asio::awaitable<void> {
SPDLOG_INFO("Send IQ: Set::Bind");

View file

@ -0,0 +1,28 @@
#pragma once
#include <libxml++/libxml++.h>
#include <larra/jid.hpp>
#include <string>
namespace larra::xmpp {
struct Message {
static constexpr auto kDefaultName = "message";
FullJid from;
BareJid to;
std::string type = "chat";
std::string body;
friend auto operator<<(xmlpp::Element* element, const Message& message) -> void {
element->set_attribute("from", ToString(message.from));
element->set_attribute("to", ToString(message.to));
element->set_attribute("type", message.type);
auto bodyElement = element->add_child_element("body");
bodyElement->add_child_text(message.body);
}
};
} // namespace larra::xmpp

View file

@ -0,0 +1,3 @@
#pragma once
#include <larra/roster.hpp>