summaryrefslogtreecommitdiff
path: root/src/bridge
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2018-03-22 20:44:30 +0100
committerlouiz’ <louiz@louiz.org>2018-03-22 20:44:30 +0100
commitfaa33c1a712f98de4bafee821bde7eb270bbb7f7 (patch)
tree42ca35320f51e282094388f0df69e0e1fcbdf4f1 /src/bridge
parent9ce0166777fae8482da4bc22b0fe3fe43febd169 (diff)
downloadbiboumi-faa33c1a712f98de4bafee821bde7eb270bbb7f7.tar.gz
biboumi-faa33c1a712f98de4bafee821bde7eb270bbb7f7.tar.bz2
biboumi-faa33c1a712f98de4bafee821bde7eb270bbb7f7.tar.xz
biboumi-faa33c1a712f98de4bafee821bde7eb270bbb7f7.zip
Pass an IrcClient* to send_muc_leave instead of doing an other search
Diffstat (limited to 'src/bridge')
-rw-r--r--src/bridge/bridge.cpp13
-rw-r--r--src/bridge/bridge.hpp3
2 files changed, 6 insertions, 10 deletions
diff --git a/src/bridge/bridge.cpp b/src/bridge/bridge.cpp
index bff86b9..f32ad31 100644
--- a/src/bridge/bridge.cpp
+++ b/src/bridge/bridge.cpp
@@ -429,7 +429,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(), "", true, true, resource);
+ this->send_muc_leave(iid, *channel->get_self(), "", true, true, resource, irc);
}
if (persistent)
this->remove_resource_from_chan(key, resource);
@@ -442,7 +442,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(),
"Biboumi note: " + std::to_string(resources - 1) + " resources are still in this channel.",
- true, true, resource);
+ true, true, resource, irc);
this->remove_resource_from_chan(key, resource);
}
if (this->number_of_channels_the_resource_is_in(iid.get_server(), resource) == 0)
@@ -860,14 +860,9 @@ void Bridge::send_presence_error(const Iid& iid, const std::string& nick,
void Bridge::send_muc_leave(const Iid& iid, const IrcUser& user,
const std::string& message, const bool self,
const bool user_requested,
- const std::string& resource)
+ const std::string& resource,
+ const IrcClient* client)
{
- const IrcClient* client = this->find_irc_client(iid.get_server());
- if (!client)
- {
- log_error("Tried to send an unavailable presence for non existant client: ", std::to_string(iid));
- return;
- }
std::string affiliation;
std::string role;
std::tie(role, affiliation) = get_role_affiliation_from_irc_mode(user.get_most_significant_mode(client->get_sorted_user_modes()));
diff --git a/src/bridge/bridge.hpp b/src/bridge/bridge.hpp
index a4ee693..a190739 100644
--- a/src/bridge/bridge.hpp
+++ b/src/bridge/bridge.hpp
@@ -173,7 +173,8 @@ public:
void send_muc_leave(const Iid& iid, const IrcUser& nick,
const std::string& message, const bool self,
const bool user_requested,
- const std::string& resource="");
+ const std::string& resource,
+ const IrcClient* client);
/**
* 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