summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-01-10 00:18:59 +0100
committerlouiz’ <louiz@louiz.org>2017-01-10 00:18:59 +0100
commit6ececd9f3990513ce35a38c2faac7d265e09900e (patch)
treebf441676e56753638797d8f95a422fe4fcdd33db /src
parente31ff3e9e94d943d4f307eb6ab8cee7fbd11b565 (diff)
downloadbiboumi-6ececd9f3990513ce35a38c2faac7d265e09900e.tar.gz
biboumi-6ececd9f3990513ce35a38c2faac7d265e09900e.tar.bz2
biboumi-6ececd9f3990513ce35a38c2faac7d265e09900e.tar.xz
biboumi-6ececd9f3990513ce35a38c2faac7d265e09900e.zip
Only try to join chans only once, even if we received multiple presences
ref #3228
Diffstat (limited to 'src')
-rw-r--r--src/irc/irc_client.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp
index ba13c6a..4fd1333 100644
--- a/src/irc/irc_client.cpp
+++ b/src/irc/irc_client.cpp
@@ -450,7 +450,12 @@ void IrcClient::send_quit_command(const std::string& reason)
void IrcClient::send_join_command(const std::string& chan_name, const std::string& password)
{
if (this->welcomed == false)
- this->channels_to_join.emplace_back(chan_name, password);
+ {
+ const auto it = std::find_if(begin(this->channels_to_join), end(this->channels_to_join),
+ [&chan_name](const auto& pair) { return std::get<0>(pair) == chan_name; });
+ if (it == end(this->channels_to_join))
+ this->channels_to_join.emplace_back(chan_name, password);
+ }
else if (password.empty())
this->send_message(IrcMessage("JOIN", {chan_name}));
else