struct Message added in message.hpp
All checks were successful
PR Check / on-push-commit-check (push) Successful in 16m10s
All checks were successful
PR Check / on-push-commit-check (push) Successful in 16m10s
message_to_roster initial commit
This commit is contained in:
parent
7f5c9cfd49
commit
c4923f4a9d
3 changed files with 34 additions and 0 deletions
|
@ -77,6 +77,9 @@ struct Client {
|
||||||
[[nodiscard]] constexpr auto Jid() const -> const FullJid& {
|
[[nodiscard]] constexpr auto Jid() const -> const FullJid& {
|
||||||
return this->jid;
|
return this->jid;
|
||||||
}
|
}
|
||||||
|
[[nodiscard]] auto GetRoster() const -> const iq::Roster& {
|
||||||
|
return this->roster;
|
||||||
|
}
|
||||||
|
|
||||||
auto CreateResourceBind() -> boost::asio::awaitable<void> {
|
auto CreateResourceBind() -> boost::asio::awaitable<void> {
|
||||||
SPDLOG_INFO("Send IQ: Set::Bind");
|
SPDLOG_INFO("Send IQ: Set::Bind");
|
||||||
|
|
28
library/include/larra/client/message.hpp
Normal file
28
library/include/larra/client/message.hpp
Normal 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
|
3
library/include/larra/client/message_to_roster.hpp
Normal file
3
library/include/larra/client/message_to_roster.hpp
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <larra/roster.hpp>
|
Loading…
Reference in a new issue