diff options
author | louiz’ <louiz@louiz.org> | 2016-10-23 23:59:21 +0200 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2016-10-23 23:59:21 +0200 |
commit | c3bb9fe2e2c2a0b2773e9b9824c4e675448b862f (patch) | |
tree | cd9d38b050c1c32c7faa33587fd487b451a60136 /src/bridge | |
parent | 00eb18bae8cf62d49f4b5d42aed8507fcca3c03c (diff) | |
download | biboumi-c3bb9fe2e2c2a0b2773e9b9824c4e675448b862f.tar.gz biboumi-c3bb9fe2e2c2a0b2773e9b9824c4e675448b862f.tar.bz2 biboumi-c3bb9fe2e2c2a0b2773e9b9824c4e675448b862f.tar.xz biboumi-c3bb9fe2e2c2a0b2773e9b9824c4e675448b862f.zip |
Handle forced-join by just sending an invitation
fix #3116
Diffstat (limited to 'src/bridge')
-rw-r--r-- | src/bridge/bridge.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp index ac69ebc..67eb805 100644 --- a/src/bridge/bridge.cpp +++ b/src/bridge/bridge.cpp @@ -839,8 +839,19 @@ void Bridge::send_xmpp_message(const std::string& from, const std::string& autho void Bridge::send_user_join(const std::string& hostname, const std::string& chan_name, const IrcUser* user, const char user_mode, const bool self) { - for (const auto& resource: this->resources_in_chan[ChannelKey{chan_name, hostname}]) - this->send_user_join(hostname, chan_name, user, user_mode, self, resource); + const auto resources = this->resources_in_chan[ChannelKey{chan_name, hostname}]; + if (self && resources.empty()) + { // This was a forced join: no client ever asked to join this room, + // but the server tells us we are in that room anyway. XMPP can’t + // do that, so we invite all the resources to join that channel. + const Iid iid(chan_name, hostname, Iid::Type::Channel); + this->send_xmpp_invitation(iid, ""); + } + else + { + for (const auto& resource: resources) + this->send_user_join(hostname, chan_name, user, user_mode, self, resource); + } } void Bridge::send_user_join(const std::string& hostname, const std::string& chan_name, |