summaryrefslogtreecommitdiff
path: root/src/bridge/bridge.cpp
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-08-17 20:44:00 +0200
committerlouiz’ <louiz@louiz.org>2016-08-17 20:47:33 +0200
commit5406de35a39c935a19460da06bf3dcd3948a00d5 (patch)
treeab40950828e7d7060826e2189a71880f5aa10886 /src/bridge/bridge.cpp
parenta4ab1db55f8ca8e130528eed01eeee04ffc8369d (diff)
downloadbiboumi-5406de35a39c935a19460da06bf3dcd3948a00d5.tar.gz
biboumi-5406de35a39c935a19460da06bf3dcd3948a00d5.tar.bz2
biboumi-5406de35a39c935a19460da06bf3dcd3948a00d5.tar.xz
biboumi-5406de35a39c935a19460da06bf3dcd3948a00d5.zip
On a client error, do not QUIT, just make the resource leave all channels
This should fix #3205
Diffstat (limited to 'src/bridge/bridge.cpp')
-rw-r--r--src/bridge/bridge.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp
index 8323c77..f6fefd9 100644
--- a/src/bridge/bridge.cpp
+++ b/src/bridge/bridge.cpp
@@ -60,6 +60,20 @@ void Bridge::shutdown(const std::string& exit_message)
}
}
+void Bridge::remove_resource(const std::string& resource,
+ const std::string& part_message)
+{
+ const auto resources_in_chan_copy = this->resources_in_chan;
+ for (const auto& chan_pair: resources_in_chan_copy)
+ {
+ const ChannelKey& channel_key = chan_pair.first;
+ const std::set<Resource>& resources = chan_pair.second;
+ if (resources.count(resource))
+ this->leave_irc_channel({std::get<0>(channel_key), std::get<1>(channel_key), {}},
+ part_message, resource);
+ }
+}
+
void Bridge::clean()
{
auto it = this->irc_clients.begin();
@@ -330,7 +344,7 @@ void Bridge::send_raw_message(const std::string& hostname, const std::string& bo
irc->send_raw(body);
}
-void Bridge::leave_irc_channel(Iid&& iid, std::string&& status_message, const std::string& resource)
+void Bridge::leave_irc_channel(Iid&& iid, const std::string& status_message, const std::string& resource)
{
IrcClient* irc = this->get_irc_client(iid.get_server());
const auto key = iid.to_tuple();