From f8da92a8bed4fccff5e1999460b6ad3723d247f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sch=C3=A4fer?= Date: Thu, 10 Oct 2019 21:15:09 +0200 Subject: =?UTF-8?q?Always=20send=20direct=20messages=20to=20the=20user?= =?UTF-8?q?=E2=80=99s=20bare=20JID?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This has the following advantages: - Works while all resources are offline (persistent channels) - Helps with combating duplicate messages when sent to different resources, resources going offline, carbon-copying etc. etc. As a side effect, this also makes the MUC PMs not be MUC PMs and always be emitted from the server-wide JID of the sending user. Fixes #3313. --- src/bridge/bridge.cpp | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'src/bridge') diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp index 424c72a..ae459fd 100644 --- a/src/bridge/bridge.cpp +++ b/src/bridge/bridge.cpp @@ -872,21 +872,10 @@ void Bridge::send_message(const Iid& iid, const std::string& nick, const std::st } else { - const auto it = this->preferred_user_from.find(iid.get_local()); - if (it != this->preferred_user_from.end()) - { - 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, true); - } - else - { - for (const auto& resource: this->resources_in_server[iid.get_server()]) - this->xmpp.send_message(std::to_string(iid), this->make_xmpp_body(body, encoding), - this->user_jid + "/" + resource, "chat", false, true); - } + this->xmpp.send_message(std::to_string(iid), + this->make_xmpp_body(body, encoding), + this->user_jid, + "chat", false, true); } } -- cgit v1.2.3