diff options
-rw-r--r-- | src/bridge/bridge.cpp | 3 | ||||
-rw-r--r-- | src/xmpp/xmpp_component.cpp | 8 | ||||
-rw-r--r-- | src/xmpp/xmpp_component.hpp | 3 | ||||
-rw-r--r-- | tests/end_to_end/__main__.py | 6 |
4 files changed, 15 insertions, 5 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp index 57f0628..54bee84 100644 --- a/src/bridge/bridge.cpp +++ b/src/bridge/bridge.cpp @@ -862,7 +862,8 @@ void Bridge::send_message(const Iid& iid, const std::string& nick, const std::st const auto chan_name = Iid(Jid(it->second).local, {}).get_local(); for (const auto& resource: this->resources_in_chan[ChannelKey{chan_name, iid.get_server()}]) this->xmpp.send_message(it->second, this->make_xmpp_body(body, encoding), - this->user_jid + "/" + resource, "chat", true, true); + this->user_jid + "/" + + resource, "chat", true, true, true); } else { diff --git a/src/xmpp/xmpp_component.cpp b/src/xmpp/xmpp_component.cpp index 24a85d7..c44b990 100644 --- a/src/xmpp/xmpp_component.cpp +++ b/src/xmpp/xmpp_component.cpp @@ -269,7 +269,8 @@ void* XmppComponent::get_receive_buffer(const size_t size) const } void XmppComponent::send_message(const std::string& from, Xmpp::body&& body, const std::string& to, - const std::string& type, const bool fulljid, const bool nocopy) + const std::string& type, const bool fulljid, const bool nocopy, + const bool muc_private) { Stanza message("message"); { @@ -301,6 +302,11 @@ void XmppComponent::send_message(const std::string& from, Xmpp::body&& body, con XmlSubNode nocopy(message, "no-copy"); nocopy["xmlns"] = "urn:xmpp:hints"; } + if (muc_private) + { + XmlSubNode x(message, "x"); + x["xmlns"] = MUC_USER_NS; + } } this->send_stanza(message); } diff --git a/src/xmpp/xmpp_component.hpp b/src/xmpp/xmpp_component.hpp index 22d5c48..2bbbe3b 100644 --- a/src/xmpp/xmpp_component.hpp +++ b/src/xmpp/xmpp_component.hpp @@ -112,7 +112,8 @@ public: * server-part of the JID and must be added. */ void send_message(const std::string& from, Xmpp::body&& body, const std::string& to, - const std::string& type, const bool fulljid, const bool nocopy=false); + const std::string& type, const bool fulljid, const bool nocopy=false, + const bool muc_private=false); /** * Send a join from a new participant */ diff --git a/tests/end_to_end/__main__.py b/tests/end_to_end/__main__.py index e024fc5..2becdef 100644 --- a/tests/end_to_end/__main__.py +++ b/tests/end_to_end/__main__.py @@ -1088,7 +1088,8 @@ if __name__ == '__main__': # Message is received with a server-wide JID, by the two resources behind nick_one partial(expect_stanza, ("/message[@from='{lower_nick_two}%{irc_server_one}'][@to='{jid_one}/{resource_one}'][@type='chat']/body[text()='RELLO']", "/message/hints:no-copy", - "/message/carbon:private")), + "/message/carbon:private", + "!/message/muc_user:x")), partial(expect_stanza, "/message[@from='{lower_nick_two}%{irc_server_one}'][@to='{jid_one}/{resource_two}'][@type='chat']/body[text()='RELLO']"), @@ -1280,7 +1281,8 @@ if __name__ == '__main__': # Respond to the message, to the server-wide JID partial(send_stanza, "<message from='{jid_two}/{resource_one}' to='{lower_nick_one}%{irc_server_one}' type='chat'><body>yes</body></message>"), # The response is received from the in-room JID - partial(expect_stanza, "/message[@from='#foo%{irc_server_one}/{nick_two}'][@to='{jid_one}/{resource_one}'][@type='chat']/body[text()='yes']"), + partial(expect_stanza, ("/message[@from='#foo%{irc_server_one}/{nick_two}'][@to='{jid_one}/{resource_one}'][@type='chat']/body[text()='yes']", + "/message/muc_user:x")), ## Do the exact same thing, from a different chan, # to check if the response comes from the right JID |