diff options
author | louiz’ <louiz@louiz.org> | 2017-08-24 23:56:00 +0200 |
---|---|---|
committer | louiz’ <louiz@louiz.org> | 2017-08-24 23:56:00 +0200 |
commit | 1997fb5c6a5f791960575a31bd34dfd24cf96a26 (patch) | |
tree | a46bd26f44ff6c040f6f0ecebc84c673298d329f /src | |
parent | c23c99dac109b3cfd53c72dbcbaf8b483bd6f4d6 (diff) | |
download | biboumi-1997fb5c6a5f791960575a31bd34dfd24cf96a26.tar.gz biboumi-1997fb5c6a5f791960575a31bd34dfd24cf96a26.tar.bz2 biboumi-1997fb5c6a5f791960575a31bd34dfd24cf96a26.tar.xz biboumi-1997fb5c6a5f791960575a31bd34dfd24cf96a26.zip |
Small refactor in on_quit()
Diffstat (limited to 'src')
-rw-r--r-- | src/irc/irc_client.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/irc/irc_client.cpp b/src/irc/irc_client.cpp index ba593c9..7776c8d 100644 --- a/src/irc/irc_client.cpp +++ b/src/irc/irc_client.cpp @@ -1017,19 +1017,17 @@ void IrcClient::on_quit(const IrcMessage& message) const std::string& chan_name = pair.first; IrcChannel* channel = pair.second.get(); const IrcUser* user = channel->find_user(message.prefix); + if (!user) + continue; bool self = false; if (user == channel->get_self()) self = true; - if (user) - { - std::string nick = user->nick; - channel->remove_user(user); - Iid iid; - iid.set_local(chan_name); - iid.set_server(this->hostname); - iid.type = Iid::Type::Channel; - this->bridge.send_muc_leave(iid, std::move(nick), txt, self, false); - } + Iid iid; + iid.set_local(chan_name); + iid.set_server(this->hostname); + iid.type = Iid::Type::Channel; + this->bridge.send_muc_leave(iid, user->nick, txt, self, false); + channel->remove_user(user); } } |