summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-08-24 23:55:32 +0200
committerlouiz’ <louiz@louiz.org>2017-08-24 23:55:32 +0200
commitc23c99dac109b3cfd53c72dbcbaf8b483bd6f4d6 (patch)
tree97a6c1892a20cec6129ecf81d25020d5d8c144d6
parentfe4ceb72d09968a16105c4c0864705f474d9a863 (diff)
downloadbiboumi-c23c99dac109b3cfd53c72dbcbaf8b483bd6f4d6.tar.gz
biboumi-c23c99dac109b3cfd53c72dbcbaf8b483bd6f4d6.tar.bz2
biboumi-c23c99dac109b3cfd53c72dbcbaf8b483bd6f4d6.tar.xz
biboumi-c23c99dac109b3cfd53c72dbcbaf8b483bd6f4d6.zip
Don’t forget to remove the user from the channel, when kicked
fix #3291
-rw-r--r--src/irc/irc_client.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp
index 46dbdbe..ba593c9 100644
--- a/src/irc/irc_client.cpp
+++ b/src/irc/irc_client.cpp
@@ -1073,12 +1073,18 @@ void IrcClient::on_nick(const IrcMessage& message)
void IrcClient::on_kick(const IrcMessage& message)
{
const std::string chan_name = utils::tolower(message.arguments[0]);
- const std::string target = message.arguments[1];
+ const std::string target_nick = message.arguments[1];
const std::string reason = message.arguments[2];
IrcChannel* channel = this->get_channel(chan_name);
if (!channel->joined)
return ;
- const bool self = channel->get_self()->nick == target;
+ const IrcUser* target = channel->find_user(target_nick);
+ if (!target)
+ {
+ log_warning("Received a KICK command from a nick absent from the channel.");
+ return;
+ }
+ const bool self = channel->get_self() == target;
if (self)
channel->joined = false;
IrcUser author(message.prefix);
@@ -1086,7 +1092,8 @@ void IrcClient::on_kick(const IrcMessage& message)
iid.set_local(chan_name);
iid.set_server(this->hostname);
iid.type = Iid::Type::Channel;
- this->bridge.kick_muc_user(std::move(iid), target, reason, author.nick, self);
+ this->bridge.kick_muc_user(std::move(iid), target_nick, reason, author.nick, self);
+ channel->remove_user(target);
}
void IrcClient::on_invite(const IrcMessage& message)