Commit 1320dc6d authored by louiz’'s avatar louiz’

Don’t reflect an empty id if it was not included

Instead, generate a uuid for that message
parent 0de282a1
......@@ -233,7 +233,7 @@ void Bridge::send_channel_message(const Iid& iid, const std::string& body, std::
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), irc->get_own_nick());
#endif
if (!first)
if (!first || id.empty())
id = utils::gen_uuid();
for (const auto& resource: this->resources_in_chan[iid.to_tuple()])
this->xmpp.send_muc_message(std::to_string(iid), irc->get_own_nick(), this->make_xmpp_body(line),
......
......@@ -1227,6 +1227,13 @@ if __name__ == '__main__':
partial(expect_stanza,
"/message[@from='#foo%{irc_server_one}/{nick_one}'][@id][@to='{jid_one}/{resource_one}'][@type='groupchat']/body[text()='trois']"),
# Send a simple message, with no id
partial(send_stanza, "<message from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}' type='groupchat'><body>hello</body></message>"),
# Expect a non-empty id as a result (should be a uuid)
partial(expect_stanza,
"!/message[@id='']/body[text()='hello']"),
# Second user joins
partial(send_stanza,
"<presence from='{jid_two}/{resource_one}' to='#foo%{irc_server_one}/{nick_two}' />"),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment