diff options
author | Florent Le Coz <louiz@louiz.org> | 2013-12-26 14:30:07 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2014-01-04 01:59:34 +0100 |
commit | b8ce9ed43d809daefe17714b36aa0874ca5f6cc8 (patch) | |
tree | fa98e3638ce45916d130f67bc2b3faff5907818e | |
parent | 3afb63a650b8b925ce1ba722dd42b7418f623713 (diff) | |
download | biboumi-b8ce9ed43d809daefe17714b36aa0874ca5f6cc8.tar.gz biboumi-b8ce9ed43d809daefe17714b36aa0874ca5f6cc8.tar.bz2 biboumi-b8ce9ed43d809daefe17714b36aa0874ca5f6cc8.tar.xz biboumi-b8ce9ed43d809daefe17714b36aa0874ca5f6cc8.zip |
Check that channels are joined before acting on objects in it
-rw-r--r-- | src/irc/irc_client.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp index 2115bdc..bde9973 100644 --- a/src/irc/irc_client.cpp +++ b/src/irc/irc_client.cpp @@ -297,6 +297,8 @@ void IrcClient::on_part(const IrcMessage& message) { const std::string chan_name = utils::tolower(message.arguments[0]); IrcChannel* channel = this->get_channel(chan_name); + if (!channel->joined) + return ; std::string txt; if (message.arguments.size() >= 2) txt = message.arguments[1]; @@ -325,6 +327,8 @@ void IrcClient::on_error(const IrcMessage& message) iid.chan = it->first; iid.server = this->hostname; IrcChannel* channel = it->second.get(); + if (!channel->joined) + continue; std::string own_nick = channel->get_self()->nick; this->bridge->send_muc_leave(std::move(iid), std::move(own_nick), leave_message, true); } @@ -384,6 +388,8 @@ void IrcClient::on_kick(const IrcMessage& message) const std::string reason = message.arguments[2]; const std::string chan_name = utils::tolower(message.arguments[0]); IrcChannel* channel = this->get_channel(chan_name); + if (!channel->joined) + return ; if (channel->get_self()->nick == target) channel->joined = false; IrcUser author(message.prefix); |