summaryrefslogtreecommitdiff
path: root/src/bridge
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-07-08 18:10:47 +0200
committerlouiz’ <louiz@louiz.org>2017-07-08 18:10:47 +0200
commit9fa1852c7ea094086f45e840fa22cc83d56b744e (patch)
tree9d6d628f6403f3cb375206d406ff869c015c3eaf /src/bridge
parent3a95076db40dbdff4b130c5d9b8db81e537a750d (diff)
downloadbiboumi-9fa1852c7ea094086f45e840fa22cc83d56b744e.tar.gz
biboumi-9fa1852c7ea094086f45e840fa22cc83d56b744e.tar.bz2
biboumi-9fa1852c7ea094086f45e840fa22cc83d56b744e.tar.xz
biboumi-9fa1852c7ea094086f45e840fa22cc83d56b744e.zip
Send status code='332' on biboumi or IRC server’s shutdown
Diffstat (limited to 'src/bridge')
-rw-r--r--src/bridge/bridge.cpp9
-rw-r--r--src/bridge/bridge.hpp5
2 files changed, 9 insertions, 5 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp
index f4c7412..89a0af3 100644
--- a/src/bridge/bridge.cpp
+++ b/src/bridge/bridge.cpp
@@ -455,7 +455,7 @@ void Bridge::leave_irc_channel(Iid&& iid, const std::string& status_message, con
}
else if (channel->joined)
{
- this->send_muc_leave(iid, channel->get_self()->nick, "", true, resource);
+ this->send_muc_leave(iid, channel->get_self()->nick, "", true, true, resource);
}
// Since there are no resources left in that channel, we don't
// want to receive private messages using this room's JID
@@ -466,7 +466,7 @@ void Bridge::leave_irc_channel(Iid&& iid, const std::string& status_message, con
if (channel && channel->joined)
this->send_muc_leave(iid, channel->get_self()->nick,
"Biboumi note: " + std::to_string(resources - 1) + " resources are still in this channel.",
- true, resource);
+ true, true, resource);
this->remove_resource_from_chan(key, resource);
if (this->number_of_channels_the_resource_is_in(iid.get_server(), resource) == 0)
this->remove_resource_from_server(iid.get_server(), resource);
@@ -883,16 +883,17 @@ void Bridge::send_presence_error(const Iid& iid, const std::string& nick,
void Bridge::send_muc_leave(const Iid& iid, const std::string& nick,
const std::string& message, const bool self,
+ const bool user_requested,
const std::string& resource)
{
if (!resource.empty())
this->xmpp.send_muc_leave(std::to_string(iid), nick, this->make_xmpp_body(message),
- this->user_jid + "/" + resource, self);
+ this->user_jid + "/" + resource, self, user_requested);
else
{
for (const auto &res: this->resources_in_chan[iid.to_tuple()])
this->xmpp.send_muc_leave(std::to_string(iid), nick, this->make_xmpp_body(message),
- this->user_jid + "/" + res, self);
+ this->user_jid + "/" + res, self, user_requested);
if (self)
this->remove_all_resources_from_chan(iid.to_tuple());
diff --git a/src/bridge/bridge.hpp b/src/bridge/bridge.hpp
index 033291c..496b439 100644
--- a/src/bridge/bridge.hpp
+++ b/src/bridge/bridge.hpp
@@ -169,7 +169,10 @@ public:
/**
* Send an unavailable presence from this participant
*/
- void send_muc_leave(const Iid& iid, const std::string& nick, const std::string& message, const bool self, const std::string& resource = "");
+ void send_muc_leave(const Iid& iid, const std::string& nick,
+ const std::string& message, const bool self,
+ const bool user_requested,
+ const std::string& resource="");
/**
* Send presences to indicate that an user old_nick (ourself if self ==
* true) changed his nick to new_nick. The user_mode is needed because