diff --git a/library/include/larra/client/client.hpp b/library/include/larra/client/client.hpp index 8629c05..04ecab5 100644 --- a/library/include/larra/client/client.hpp +++ b/library/include/larra/client/client.hpp @@ -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 { SPDLOG_INFO("Send IQ: Set::Bind"); diff --git a/library/include/larra/client/message.hpp b/library/include/larra/client/message.hpp new file mode 100644 index 0000000..98711cf --- /dev/null +++ b/library/include/larra/client/message.hpp @@ -0,0 +1,28 @@ +#pragma once + +#include + +#include +#include + +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 diff --git a/library/include/larra/client/message_to_roster.hpp b/library/include/larra/client/message_to_roster.hpp new file mode 100644 index 0000000..5f0398c --- /dev/null +++ b/library/include/larra/client/message_to_roster.hpp @@ -0,0 +1,3 @@ +#pragma once + +#include