Add a <item/> node in the presence of a leaving participant

fix #3339
This commit is contained in:
louiz’
2018-03-12 00:13:59 +01:00
parent 158d743bf5
commit bb596582bd
8 changed files with 40 additions and 22 deletions
+4 -1
View File
@@ -33,8 +33,9 @@ IrcUser* IrcChannel::find_user(const std::string& name) const
return nullptr;
}
void IrcChannel::remove_user(const IrcUser* user)
std::unique_ptr<IrcUser> IrcChannel::remove_user(const IrcUser* user)
{
std::unique_ptr<IrcUser> result{};
const auto nick = user->nick;
const bool is_self = (user == this->self);
const auto it = std::find_if(this->users.begin(), this->users.end(),
@@ -44,6 +45,7 @@ void IrcChannel::remove_user(const IrcUser* user)
});
if (it != this->users.end())
{
result = std::move(*it);
this->users.erase(it);
if (is_self)
{
@@ -57,4 +59,5 @@ void IrcChannel::remove_all_users()
{
this->users.clear();
this->self = nullptr;
return result;
}