summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2018-05-15 19:31:26 +0200
committerlouiz’ <louiz@louiz.org>2018-05-15 19:34:58 +0200
commita8e922fc890a8ef2c1c43b940f0cfc3768ea1cff (patch)
tree5a8cb139e68c51a464c696a6a010c4bd1b1f3ffc /src
parent4f6bf078d2e60cab47f43a09decc12aa4fba08ef (diff)
downloadbiboumi-a8e922fc890a8ef2c1c43b940f0cfc3768ea1cff.tar.gz
biboumi-a8e922fc890a8ef2c1c43b940f0cfc3768ea1cff.tar.bz2
biboumi-a8e922fc890a8ef2c1c43b940f0cfc3768ea1cff.tar.xz
biboumi-a8e922fc890a8ef2c1c43b940f0cfc3768ea1cff.zip
Handle the NAMES message for an already-joined or non-existing channel
If a user manually does a NAMES query, the result were interpreted as a user list, which is wrong. And with the special * argument, this would even cause a crash. Fix #3357
Diffstat (limited to 'src')
-rw-r--r--src/irc/irc_client.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp
index fca043c..d0b2153 100644
--- a/src/irc/irc_client.cpp
+++ b/src/irc/irc_client.cpp
@@ -641,6 +641,11 @@ void IrcClient::set_and_forward_user_list(const IrcMessage& message)
{
const std::string chan_name = utils::tolower(message.arguments[2]);
IrcChannel* channel = this->get_channel(chan_name);
+ if (channel->joined)
+ {
+ this->forward_server_message(message);
+ return;
+ }
std::vector<std::string> nicks = utils::split(message.arguments[3], ' ');
for (const std::string& nick: nicks)
{
@@ -776,6 +781,16 @@ void IrcClient::on_channel_completely_joined(const IrcMessage& message)
{
const std::string chan_name = utils::tolower(message.arguments[1]);
IrcChannel* channel = this->get_channel(chan_name);
+ if (chan_name == "*" || channel->joined)
+ {
+ this->forward_server_message(message);
+ return;
+ }
+ if (!channel->get_self())
+ {
+ log_error("End of NAMES list but we never received our own nick.");
+ return;
+ }
channel->joined = true;
this->bridge.send_user_join(this->hostname, chan_name, channel->get_self(),
channel->get_self()->get_most_significant_mode(this->sorted_user_modes), true);