summaryrefslogtreecommitdiff
path: root/src/irc/irc_client.cpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2013-12-27 12:01:26 +0100
committerFlorent Le Coz <louiz@louiz.org>2014-01-04 01:59:35 +0100
commite8e592d1ace5413a1e7d8b59b9467c78d8d68ea9 (patch)
tree5652ccbca535cffa442a1a13729e4ac93ba4dfe2 /src/irc/irc_client.cpp
parentaa53276859a5fc80071d24111a311297e058e603 (diff)
downloadbiboumi-e8e592d1ace5413a1e7d8b59b9467c78d8d68ea9.tar.gz
biboumi-e8e592d1ace5413a1e7d8b59b9467c78d8d68ea9.tar.bz2
biboumi-e8e592d1ace5413a1e7d8b59b9467c78d8d68ea9.tar.xz
biboumi-e8e592d1ace5413a1e7d8b59b9467c78d8d68ea9.zip
Remove disconnected IrcClients
Diffstat (limited to 'src/irc/irc_client.cpp')
-rw-r--r--src/irc/irc_client.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp
index 4e37a63..afdc629 100644
--- a/src/irc/irc_client.cpp
+++ b/src/irc/irc_client.cpp
@@ -58,8 +58,8 @@ IrcChannel* IrcClient::get_channel(const std::string& name)
bool IrcClient::is_channel_joined(const std::string& name)
{
- IrcChannel* client = this->get_channel(name);
- return client->joined;
+ IrcChannel* channel = this->get_channel(name);
+ return channel->joined;
}
std::string IrcClient::get_own_nick() const
@@ -339,7 +339,12 @@ void IrcClient::on_part(const IrcMessage& message)
bool self = channel->get_self()->nick == nick;
this->bridge->send_muc_leave(std::move(iid), std::move(nick), std::move(txt), self);
if (self)
+ {
channel->joined = false;
+ this->channels.erase(chan_name);
+ // channel pointer is now invalid
+ channel = nullptr;
+ }
}
}
@@ -358,6 +363,7 @@ void IrcClient::on_error(const IrcMessage& message)
std::string own_nick = channel->get_self()->nick;
this->bridge->send_muc_leave(std::move(iid), std::move(own_nick), leave_message, true);
}
+ this->channels.clear();
this->send_gateway_message(std::string("ERROR: ") + leave_message);
}