@@ -819,19 +819,19 @@ void Bridge::send_irc_version_request(const std::string& irc_hostname, const std
|
|||||||
void Bridge::send_message(const Iid& iid, const std::string& nick, const std::string& body, const bool muc)
|
void Bridge::send_message(const Iid& iid, const std::string& nick, const std::string& body, const bool muc)
|
||||||
{
|
{
|
||||||
const auto encoding = in_encoding_for(*this, iid);
|
const auto encoding = in_encoding_for(*this, iid);
|
||||||
|
std::string uuid{};
|
||||||
if (muc)
|
if (muc)
|
||||||
{
|
{
|
||||||
#ifdef USE_DATABASE
|
#ifdef USE_DATABASE
|
||||||
const auto xmpp_body = this->make_xmpp_body(body, encoding);
|
const auto xmpp_body = this->make_xmpp_body(body, encoding);
|
||||||
if (!nick.empty() && this->record_history)
|
if (!nick.empty() && this->record_history)
|
||||||
Database::store_muc_message(this->get_bare_jid(), iid.get_local(), iid.get_server(), std::chrono::system_clock::now(),
|
uuid = Database::store_muc_message(this->get_bare_jid(), iid.get_local(), iid.get_server(), std::chrono::system_clock::now(),
|
||||||
std::get<0>(xmpp_body), nick);
|
std::get<0>(xmpp_body), nick);
|
||||||
#endif
|
#endif
|
||||||
for (const auto& resource: this->resources_in_chan[iid.to_tuple()])
|
for (const auto& resource: this->resources_in_chan[iid.to_tuple()])
|
||||||
{
|
{
|
||||||
this->xmpp.send_muc_message(std::to_string(iid), nick, this->make_xmpp_body(body, encoding),
|
this->xmpp.send_muc_message(std::to_string(iid), nick, this->make_xmpp_body(body, encoding),
|
||||||
this->user_jid + "/" + resource, {}, utils::gen_uuid());
|
this->user_jid + "/" + resource, uuid, utils::gen_uuid());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1344,8 +1344,10 @@ if __name__ == '__main__':
|
|||||||
partial(send_stanza, "<message from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}' type='groupchat'><body>coucou</body></message>"),
|
partial(send_stanza, "<message from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}' type='groupchat'><body>coucou</body></message>"),
|
||||||
# Receive the message, forwarded to the two users
|
# Receive the message, forwarded to the two users
|
||||||
partial(expect_unordered, [
|
partial(expect_unordered, [
|
||||||
("/message[@from='#foo%{irc_server_one}/{nick_one}'][@to='{jid_one}/{resource_one}'][@type='groupchat']/body[text()='coucou']",),
|
("/message[@from='#foo%{irc_server_one}/{nick_one}'][@to='{jid_one}/{resource_one}'][@type='groupchat']/body[text()='coucou']",
|
||||||
("/message[@from='#foo%{irc_server_one}/{nick_one}'][@to='{jid_two}/{resource_one}'][@type='groupchat']/body[text()='coucou']",)
|
"/message/stable_id:stanza-id[@by='#foo%{irc_server_one}'][@id]"),
|
||||||
|
("/message[@from='#foo%{irc_server_one}/{nick_one}'][@to='{jid_two}/{resource_one}'][@type='groupchat']/body[text()='coucou']",
|
||||||
|
"/message/stable_id:stanza-id[@by='#foo%{irc_server_one}'][@id]")
|
||||||
]),
|
]),
|
||||||
|
|
||||||
# Send a private message, to a in-room JID
|
# Send a private message, to a in-room JID
|
||||||
|
|||||||
Reference in New Issue
Block a user