summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonas Schäfer <j.wielicki@sotecware.net>2019-10-10 21:15:09 +0200
committerlouiz’ <louiz@louiz.org>2020-09-23 23:20:47 +0200
commitf8da92a8bed4fccff5e1999460b6ad3723d247f3 (patch)
treecdd299593a800715dd396be428759a3e2c46d187 /src
parent5900c19c22aad36c9dbb6f0ccecf66510def722b (diff)
downloadbiboumi-f8da92a8bed4fccff5e1999460b6ad3723d247f3.tar.gz
biboumi-f8da92a8bed4fccff5e1999460b6ad3723d247f3.tar.bz2
biboumi-f8da92a8bed4fccff5e1999460b6ad3723d247f3.tar.xz
biboumi-f8da92a8bed4fccff5e1999460b6ad3723d247f3.zip
Always send direct messages to the user’s bare JID
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.
Diffstat (limited to 'src')
-rw-r--r--src/bridge/bridge.cpp19
1 files changed, 4 insertions, 15 deletions
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);
}
}